-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitOld.lua
523 lines (460 loc) Β· 16.2 KB
/
initOld.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
-- Bootstrap packer.nvim if it's not already install
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
vim.cmd [[packadd packer.nvim]]
return true
end
return false
end
-- Initialize packer.nvim if it isn't already
require('packer').startup(function(use)
use 'wbthomason/packer.nvim' -- Packer manager
-- Dashboard plugin for Neovim
use {
'glepnir/dashboard-nvim',
requires = { 'nvim-tree/nvim-web-devicons' } -- Optional: Adds icons
}
use 'nvim-treesitter/nvim-treesitter'
-- Onedark color scheme
use 'navarasu/onedark.nvim'
use { "catppuccin/nvim", as = "catppuccin" }
use 'xero/miasma.nvim'
use {
'lewis6991/gitsigns.nvim',
requires = { 'nvim-lua/plenary.nvim' }
}
use 'sindrets/diffview.nvim'
use 'tpope/vim-fugitive'
use {
'nmac427/guess-indent.nvim',
config = function() require('guess-indent').setup {} end,
}
-- Telescope and its dependency plenary.nvim
use {
'nvim-telescope/telescope.nvim', tag = '0.1.8',
-- or , branch = '0.1.x',
requires = { {'nvim-lua/plenary.nvim'} }
}
use {
'nvim-lualine/lualine.nvim',
requires = { 'nvim-tree/nvim-web-devicons', opt = true }
}
-- LSP configurations for Neovim
use 'neovim/nvim-lspconfig'
-- Optional: Autocompletion plugins (recommended)
use 'hrsh7th/nvim-cmp' -- Completion plugin
use 'hrsh7th/cmp-nvim-lsp' -- LSP source for nvim-cmp
use 'saadparwaiz1/cmp_luasnip' -- Snippets source for nvim-cmp
use 'L3MON4D3/LuaSnip' -- Snippets plugin
use {
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
requires = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
-- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
}
}
use('jose-elias-alvarez/null-ls.nvim')
use('MunifTanjim/prettier.nvim')
use {
'luckasRanarison/tailwind-tools.nvim',
config = function()
-- Your configuration goes here
end,
-- Specify dependencies
requires = {
{ 'nvim-treesitter/nvim-treesitter' },
{ 'nvim-telescope/telescope.nvim', opt = true },
{ 'neovim/nvim-lspconfig', opt = true },
},
run = ':UpdateRemotePlugins',
}
use {
'seblj/roslyn.nvim',
ft = 'cs', -- Load this plugin only when editing C# files
config = function()
-- Configuration for roslyn.nvim
require('roslyn').setup({
config = {
-- Here you can pass in any options that you would like to pass to `vim.lsp.start`.
-- Use `:h vim.lsp.ClientConfig` to see all possible options.
-- The only options that are overwritten and won't have any effect by setting here:
-- - `name`
-- - `cmd`
-- - `root_dir`
},
exe = {
"dotnet",
"/Users/5pk/.local/share/nvim/roslyn/Microsoft.CodeAnalysis.LanguageServer.dll", -- Hardcoded path
},
-- Set `filewatching` to false if you experience performance problems.
filewatching = true,
-- Optional function to choose a specific solution
choose_sln = nil, -- You can provide your own function here if needed
})
end
}
use {
"ThePrimeagen/harpoon",
branch = "harpoon2",
requires = { {"nvim-lua/plenary.nvim"} }
}
end)
local harpoon = require("harpoon")
harpoon:setup()
vim.o.ignorecase = true
vim.o.smartcase = true
-- Enable relative line numbers
vim.opt.relativenumber = true
-- Also show the absolute line number on the current line
vim.opt.number = true
vim.g.mapleader = " " -- Set leader to spacebar
-- Create mappings
-- Mapping for harpoon functions
vim.keymap.set("n", "<leader>a", function() harpoon:list():add() end)
vim.keymap.set("n", "<leader>h", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
vim.keymap.set("n", "<leader>1", function() harpoon:list():select(1) end)
vim.keymap.set("n", "<leader>2", function() harpoon:list():select(2) end)
vim.keymap.set("n", "<leader>3", function() harpoon:list():select(3) end)
vim.keymap.set("n", "<leader>4", function() harpoon:list():select(4) end)
-- Toggle previous & next buffers stored within Harpoon list
vim.keymap.set("n", "<leader>[", function() harpoon:list():prev() end,{ noremap = true, silent = true } )
vim.keymap.set("n", "<leader>]", function() harpoon:list():next() end,{ noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>dvo', ':DiffviewOpen<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>dvc', ':DiffviewClose<CR>', { noremap = true, silent = true })
vim.keymap.set('n', '<leader>pf', function()
require('telescope.builtin').find_files({
no_ignore = true, -- Show ignored files (e.g., files in .gitignore)
hidden = true -- Show hidden files (e.g., dotfiles)
})
end, { noremap = true, silent = true })
vim.keymap.set('n', '<leader>ff', ':Telescope git_files<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', 'gd', "<cmd>lua vim.lsp.buf.definition()<CR>zz", { noremap = true, silent = true })
--vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', "<cmd>lua vim.lsp.buf.definition()<CR>", { noremap = true, silent = true })
-- Map <leader>lg to :Telescope live_grep
vim.api.nvim_set_keymap('n', '<leader>lg', ':Telescope live_grep<CR>', { noremap = true, silent = true })
-- Map <leader>op to :Neotree toggle
vim.api.nvim_set_keymap('n', '<leader>tr', ':Neotree toggle<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>p', '<cmd>Prettier<CR>', { noremap = true, silent = true })
-- Remap Ctrl+d to scroll down and center
vim.keymap.set('n', '<C-d>', '<C-d>zz', { noremap = true, silent = true })
-- Remap Ctrl+u to scroll up and center
vim.keymap.set('n', '<C-u>', '<C-u>zz', { noremap = true, silent = true })
-- Remap 'n' to search and center the screen
vim.keymap.set('n', 'n', 'nzzzv', { noremap = true, silent = true })
-- Remap 'N' to search backwards and center the screen
vim.keymap.set('n', 'N', 'Nzzzv', { noremap = true, silent = true })
-- remap l to turn on and off rel line numbers
vim.api.nvim_set_keymap('n', '<leader>ln', ':set relativenumber!<CR>', { noremap = true, silent = true })
-- Map <C-f9> to exit insert mode (Esc) and write the file (:w)
vim.api.nvim_set_keymap('n', '<F9>', '<Esc>:w<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('i', '<C-F9>', '<Esc>:w<CR>', { noremap = true, silent = true })
vim.o.shiftwidth = 4
vim.o.tabstop = 4
vim.o.softtabstop = 4
local null_ls = require("null-ls")
local group = vim.api.nvim_create_augroup("lsp_format_on_save", { clear = false })
local event = "BufWritePre" -- or "BufWritePost"
local async = event == "BufWritePost"
null_ls.setup({
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.keymap.set("n", "<Leader>fm", function()
vim.lsp.buf.format({ bufnr = vim.api.nvim_get_current_buf() })
end, { buffer = bufnr, desc = "[lsp] format" })
end
if client.supports_method("textDocument/rangeFormatting") then
vim.keymap.set("x", "<Leader>fm", function()
vim.lsp.buf.format({ bufnr = vim.api.nvim_get_current_buf() })
end, { buffer = bufnr, desc = "[lsp] format" })
end
end,
})
local prettier = require("prettier")
prettier.setup({
bin = 'prettier', -- or `'prettierd'` (v0.23.3+)
filetypes = {
"css",
"graphql",
"html",
"javascript",
"javascriptreact",
"json",
"less",
"markdown",
"scss",
"typescript",
"typescriptreact",
"yaml",
},
})
require("tailwind-tools").setup({
server = {
override = true, -- setup the server from the plugin if true
settings = {}, -- shortcut for `settings.tailwindCSS`
on_attach = function(client, bufnr) end, -- callback triggered when the server attaches to a buffer
},
document_color = {
enabled = true, -- can be toggled by commands
kind = "inline", -- "inline" | "foreground" | "background"
inline_symbol = "σ°€ ", -- only used in inline mode
debounce = 200, -- in milliseconds, only applied in insert mode
},
conceal = {
enabled = false, -- can be toggled by commands
min_length = nil, -- only conceal classes exceeding the provided length
symbol = "σ±Ώ", -- only a single character is allowed
highlight = { -- extmark highlight options, see :h 'highlight'
fg = "#38BDF8",
},
},
cmp = {
highlight = "foreground", -- color preview style, "foreground" | "background"
},
telescope = {
utilities = {
callback = function(name, class) end, -- callback used when selecting an utility class in telescope
},
},
-- see the extension section to learn more
extension = {
queries = {}, -- a list of filetypes having custom `class` queries
patterns = { -- a map of filetypes to Lua pattern lists
-- exmaple:
-- rust = { "class=[\"']([^\"']+)[\"']" },
-- javascript = { "clsx%(([^)]+)%)" },
},
},
})
vim.cmd('colorscheme catppuccin-macchiato')
-- Change the color of absolute line numbers
vim.api.nvim_set_hl(0, 'LineNr', { fg = '#9E9E9E', bg = '#23273B' })
-- Change the color of relative line numbers
vim.api.nvim_set_hl(0, 'LineNrRelative', { fg = '#9E9E9E', bg = '#23273B' })
-- Optionally, change the color of the current line number (the line where the cursor is)
vim.api.nvim_set_hl(0, 'CursorLineNr', { fg = '#9E9E9E', bold = true })
require('dashboard').setup({
theme = 'doom', -- Use the 'doom' theme for a layout similar to your screenshot
config = {
header={
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
" /) ",
" /\\___/\\ (( ",
" |\\__/,| (`\\ \\`@_@'/ )) ",
" _.|o o |_ ) ) {_:Y:.}_// ",
" -(((---(((------------------{_}^-'{_}------- ",
" ββ β βββββββ βββββββ ββ ββ βββ ββ ββ ",
" β β β β β β β β β β βββ β ",
" |\\__/,| (`\\ β βββ β ββββ β β βββ β β β _._ _,-'\"\"`-._ ",
" |_ _ |.--.) ) β β βββββ β β β β β β (,-.`._,'( |\\`-/|",
" ( T ) / β β β ββββ βββ β β β β `-.-' \\ )-`( , o o)",
" (((^_(((/(((_/ β β β β βββββ ββ ββ β βββββ β `- \\`_`\"'-",
" βββ ββββββββββββββββββββ βββββ βββββββ βββ ",
" |\\ _,,,---,,_ /\\_/\\ ___ ",
" ZZZzz /,`.-'`' -. ;-;;,_ = o_o =_______ \\ \\ ",
" |,4- ) )-,_. ,\\ ( `'-' __^ __( \\.__) ) ",
" '---''(_/--' `-'\\_) (@)<_____>__(_____)____/ ",
"",
"",
"",
"",
"",
"",
"",
"",
"",
},
center = {
{
icon = 'ο ',
desc = 'Find File ',
key = 'f',
action = 'Telescope find_files'
},
{
icon = 'ο
',
desc = 'New file ',
key = 'e',
action = 'enew'
},
{
icon = 'ο ',
desc = 'Recent files ',
key = 'r',
action = 'Telescope oldfiles'
},
{
icon = 'σ° ',
desc = 'Find text ',
key = 't',
action = 'Telescope live_grep'
},
{
icon = 'ο ',
desc = 'Configuration ',
key = 'c',
action = 'edit ~/.config/nvim/init.lua'
},
{
icon = 'οͺ ',
desc = 'Update Plugins ',
key = 'u',
action = 'PackerSync'
},
{
icon = 'σ°© ',
desc = 'Quit Neovim ',
key = 'q',
action = 'qa'
},
},
footer = { "v0.9.0 and ξ©Ή36 Plugins" },
},
})
require('lualine').setup({
sections = {
lualine_c = {
{ 'filename', path = 1 } -- Set path = 1 to show the full path
}
}
})
require('gitsigns').setup()
-- Set up nvim-cmp.
local cmp = require'cmp'
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item.
['<Tab>'] = cmp.mapping.select_next_item(),
['<S-Tab>'] = cmp.mapping.select_prev_item(),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
}, {
{ name = 'buffer' },
})
})
-- Set up lspconfig.
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
require('lspconfig')['ts_ls'].setup {
capabilities = capabilities,
on_attach = function(client, bufnr)
-- Your custom on_attach function here
end,
}
require'lspconfig'.rust_analyzer.setup{
-- You can add your specific configuration here.
on_attach = function(_, bufnr)
local opts = { noremap=true, silent=true }
-- Keybindings for LSP actions
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', '<Cmd>lua vim.lsp.buf.references()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>rn', '<Cmd>lua vim.lsp.buf.rename()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>ca', '<Cmd>lua vim.lsp.buf.code_action()<CR>', opts)
end,
settings = {
["rust-analyzer"] = {
cargo = {
allFeatures = true,
},
procMacro = {
enable = true,
},
}
}
}
-- Import the nvim-tree plugin safely
local status_ok, nvim_tree = pcall(require, "nvim-tree")
if not status_ok then
return
end
-- Recommended settings for nvim-tree
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- Setup nvim-tree with some basic options
nvim_tree.setup({
disable_netrw = true,
hijack_netrw = true,
open_on_setup = false,
ignore_ft_on_setup = {},
auto_close = true,
open_on_tab = false,
hijack_cursor = false,
update_cwd = true,
diagnostics = {
enable = false,
icons = {
hint = "οͺ",
info = "ο",
warning = "ο±",
error = "ο",
},
},
git = {
enable = true,
ignore = false,
timeout = 500,
},
view = {
width = 30,
side = "left",
auto_resize = true,
mappings = {
custom_only = false,
list = {},
},
},
filters = {
dotfiles = false,
custom = {},
},
})
local lspconfig = require('lspconfig')
local cmp = require'cmp'
-- Setup nvim-cmp for autocompletion
cmp.setup {
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = {
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
}, {
{ name = 'buffer' },
})
}
vim.g.dashboard_default_executive = 'telescope'