-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
528 lines (501 loc) · 17.6 KB
/
Copy pathinit.lua
File metadata and controls
528 lines (501 loc) · 17.6 KB
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
523
524
525
526
527
528
return {
-- Configure AstroNvim updates
updater = {
remote = "origin", -- remote to use
channel = "stable", -- "stable" or "nightly"
version = "latest", -- "latest", tag name, or regex search like "v1.*" to only do updates before v2 (STABLE ONLY)
branch = "nightly", -- branch name (NIGHTLY ONLY)
commit = nil, -- commit hash (NIGHTLY ONLY)
pin_plugins = nil, -- nil, true, false (nil will pin plugins on stable only)
skip_prompts = false, -- skip prompts about breaking changes
show_changelog = true, -- show the changelog after performing an update
auto_quit = false, -- automatically quit the current session after a successful update
remotes = { -- easily add new remotes to track
-- ["remote_name"] = "https://remote_url.come/repo.git", -- full remote url
-- ["remote2"] = "github_user/repo", -- GitHub user/repo shortcut,
-- ["remote3"] = "github_user", -- GitHub user assume AstroNvim fork
},
},
-- Set colorscheme to use
colorscheme = "mctheme",
-- colorscheme = "astrotheme",
-- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on
diagnostics = {
virtual_text = true,
underline = true,
},
lsp = {
-- setup_handlers = {
-- -- add custom handler
-- tsserver = function(_, opts) require("typescript-tools").setup { server = opts } end
-- ngserver = function(_,opts) require()end
-- },
-- customize lsp formatting options
formatting = {
-- filter = function(client)
-- if vim.bo.filetype == "angular" then
-- return client.name == "null-ls"
-- end
-- return true
-- end,
-- control auto formatting on save
format_on_save = {
enabled = true, -- enable or disable format on save globally
allow_filetypes = { -- enable format on save for specified filetypes only
-- "go",
},
ignore_filetypes = { -- disable format on save for specified filetypes
-- "python",
},
},
disabled = { -- disable formatting capabilities for the listed language servers
"html" , -- eslint do it better that html-lsp (it doesnt read editorconfig)
-- "tsserver"
-- "sumneko_lua",
},
timeout_ms = 3000, -- default format timeout
-- filter = function(client) -- fully override the default formatting function
-- return true
-- end
},
-- enable servers that you already have installed without mason
servers = {
-- "pyright"
},
config = {
cssmodules_ls = {
filetypes = {"angular","html"}
},
ltex={
filetypes={
"bib",
-- "gitcommit",
-- "markdown",
-- "org",
"plaintex",
-- "rst",
-- "rnoweb",
"tex",
-- "pandoc",
-- "quarto",
-- "rmd",
-- "context",
-- "html",
-- "xhtml",
},
},
tailwindcss= {
-- filetypes = {"angular"}
filetypes = {"angular"}
},
angularls = {
-- filetypes = {"angular"}
filetypes = {"angular","typescript", "html",
"typescriptreact" ,"typescript.tsx"}
}
}
},
-- Configure require("lazy").setup() options
lazy = {
defaults = { lazy = true },
performance = {
rtp = {
-- customize default disabled vim plugins
disabled_plugins = { "tohtml", "gzip", "matchit", "zipPlugin",
"netrwPlugin",
"tarPlugin",
"matchparen"
},
},
},
},
-- This function is run last and is a good place to configuring
-- augroups/autocommands and custom filetypes also this just pure lua so
-- anything that doesn't fit in the normal config locations above can go here
plugins = { {
"akinsho/toggleterm.nvim",
opts = {
float_opts = {
-- The border key is *almost* the same as 'nvim_open_win'
-- see :h nvim_open_win for details on borders however
-- the 'curved' border is a custom border type
-- not natively supported but implemented in this plugin.
width = 160,
height = 200,
-- winblend = 3,
-- zindex =,
},
}
}
-- "pmizio/typescript-tools.nvim", -- add lsp plugin
-- {
-- "williamboman/mason-lspconfig.nvim",
-- opts = {
-- ensure_installed = { "tsserver" }, -- automatically install lsp
-- },
-- },
--
-- cmp = function(opts)
-- local cmp = require "cmp"
-- -- modify the mapping part of the table
-- opts.mapping["<Tab>"] = cmp.mapping.confirm {
-- behavior = cmp.ConfirmBehavior.Insert,
-- select = true,
-- }
-- return opts
-- end
},
polish = function()
-- REFACTOR or DELETE after it will be fixed in 0.10 https://github.com/nvim-telescope/telescope.nvim/issues/2027
-- vim.api.nvim_create_autocmd("WinLeave", {
-- callback = function()
-- if vim.bo.ft == "TelescopePrompt" and vim.fn.mode() == "i" then
-- vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Esc>", true, false, true), "i", false)
-- end
-- end,
-- })
--
-- turn off semantic tokens (break hightlight in TS mb on other languges too)
-- mb should turn it on after fix
-- require('lspconfig').graphql.setup({
-- on_attach = function(client)
-- client.server_capabilities.workspaceSymbolProvider = false
-- end,
-- filetypes = {
-- "graphql",
-- "typescriptreact",
-- "typescript",
-- "javascript",
-- "javascriptreact"
-- }
-- })
--
--
-- vim.opt.list = true
-- vim.opt.listchars:append "space:⋅"
-- vim.opt.listchars:append "eol:↴"
if next(vim.fn.argv()) == nil then
vim.api.nvim_create_autocmd("UIEnter", {
callback = function()
vim.fn.timer_start(100, function()
vim.cmd('SessionManager load_session')
end)
end,
});
end
vim.fn.timer_start(100, function()
vim.cmd('set keymap=russian-jcukenwin')
vim.cmd('set iminsert=0')
vim.cmd('set imsearch=0')
vim.cmd('set laststatus=2')
end)
vim.api.nvim_create_autocmd("BufEnter", {
callback = function()
vim.fn.timer_start(100, function()
vim.cmd('set title')
vim.cmd('set titlestring=%F')
end)
end,
})
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.teraonline_definitions = {
install_info = {
url = "D://pinki//backstep//treesitter-teradefinition", -- local path or git repo
files = { "src/parser.c" }, -- note that some parsers also require src/scanner.c or src/scanner.cc
-- optional entries:
branch = "main", -- default branch in case of git repo if different from master
generate_requires_npm = false, -- if stand-alone parser without npm dependencies
requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c
},
filetype = "def", -- if filetype does not match the parser name
}
vim.cmd([[
autocmd BufRead,BufEnter *.component.html set filetype=angular
]])
--
-- также надо добавить filetype.vim с содержимым
-- autocmd BufRead,BufEnter *.component.html set filetype=angular
-- C:\Users\michaelcarno\AppData\Local\nvim-data\lazy\nvim-treesitter-angular\ftdetect
--
vim.cmd([[
augroup matchup_matchparen_enable_ft
autocmd!
autocmd FileType angular let b:match_words = matchup#util#standard_html()
augroup END
]])
parser_config.angular_beta = {
install_info = {
url = "D:\\angular17tree\\tree-sitter-angular", -- local path or git repo
files = { "src/parser.c", "src/scanner.c" }, -- note that some parsers also require src/scanner.c or src/scanner.cc
-- optional entries:
branch = "main", -- default branch in case of git repo if different from master
generate_requires_npm = false, -- if stand-alone parser without npm dependencies
requires_generate_from_grammar = true, -- if folder contains pre-generated src/parser.c
}
}
--
-- чтобы поменять стандартный репозиторий на свой но надо править lockfile
--
-- parsers.get_parser_configs().angular = {
-- install_info = {
-- url = "https://github.com/steelsojka/tree-sitter-angular",
-- files = { "src/parser.c" },
-- branch = "main"
-- },
-- maintainers = {"@steelsojka"}
-- }
--
-- if not parsers.has_parser("angular") then
-- installer.update("angular")
-- end
-- end
--
--
require("notify").setup({
background_colour = "NotifyBackground",
fps = 1,
icons = {
DEBUG = "",
ERROR = "",
INFO = "",
TRACE = "✎",
WARN = ""
},
level = 2,
minimum_width = 50,
render = "default",
stages = "static",
timeout = 5000,
top_down = true,
max_width = nil,
max_height = nil,
on_open = nil,
on_close = nil
})
-- lsp_mappings.n["<leader>lG"][1] = function() require("telescope.builtin").lsp_dynamic_workspace_symbols() end
-- grep with args plugin
local telescope = require("telescope")
local lga_actions = require("telescope-live-grep-args.actions")
telescope.setup {
extensions = {
live_grep_args = {
auto_quoting = true, -- enable/disable auto-quoting
-- define mappings, e.g.
mappings = { -- extend mappings
i = {
["<C-k>"] = lga_actions.quote_prompt(),
["<C-i>"] = lga_actions.quote_prompt({ postfix = " --iglob " }),
},
},
-- ... also accepts theme settings, for example:
-- theme = "dropdown", -- use dropdown theme
-- theme = { }, -- use own theme spec
-- layout_config = { mirror=true }, -- mirror preview pane
}
}
}
vim.g.firenvim_config = {
globalSettings = { alt = "all" },
localSettings = {
[".*"] = {
cmdline = "neovim",
content = "text",
priority = 1,
selector = "",
takeover = "never"
}
}
}
if vim.g.started_by_firenvim == true then
-- vim.api.nvim_create_autocmd('UIEnter', {
-- pattern = "*",
-- cmd = "set guifont=JetBrainsMono NFP:h15"
-- })
vim.g.icons_enabled = false
vim.api.nvim_create_autocmd("UIEnter", {
callback = function()
vim.fn.timer_start(100, function()
vim.opt.lines = 15
vim.cmd('set guifont=JetBrainsMono:h15')
end)
end,
})
vim.api.nvim_create_autocmd({ 'BufEnter' }, {
pattern = "github.com_*.txt",
cmd = "set filetype=markdown"
})
-- vim.api.nvim_create_autocmd({ 'BufEnter' }, {
-- pattern = "*.txt",
-- cmd = "set filetype=html"
-- })
end
vim.api.nvim_exec('language en_US', true)
-- vim.api.nvim_create_autocmd("LspAttach", {
-- callback = function(args)
-- local client = vim.lsp.get_client_by_id(args.data.client_id)
-- client.server_capabilities.semanticTokensProvider = nil
-- end,
-- });
require 'nvim-treesitter.install'.compilers = { "clang" }
-- require 'nvim-treesitter.install'.compilers = { "clang" }
-- require('lspconfig').tsserver.setup({})
-- require('lspconfig').tsserver.setup {
-- -- init_options = {
-- -- preferences = {
-- -- disableSuggestions = true
-- -- }
-- -- },
-- filetypes = {
-- 'typescript',
-- 'typescriptreact',
-- 'typescript.tsx',
-- },
-- }
-- fixing clangd bug with notification spam
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.offsetEncoding = { "utf-16" }
require("lspconfig").clangd.setup({ capabilities = capabilities })
require("notify").setup({
stages = 'static'
})
vim.g.dotnet_build_project = function()
local default_path = vim.fn.getcwd() .. '/'
if vim.g['dotnet_last_proj_path'] ~= nil then
default_path = vim.g['dotnet_last_proj_path']
end
-- local path = vim.fn.input('Path to your *proj file', default_path, 'file')
-- vim.g['dotnet_last_proj_path'] = path
local msbuildPatch ="\"D:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Current/Bin/msbuild.exe\""
-- local cmd = 'dotnet build -c Debug ' .. path .. ' > /dev/null'
local solution = vim.fn.input('Name solution file: ')
local cmd =msbuildPatch.." "..solution..".sln /p:Configuration=Debug /l:FileLogger,Microsoft.Build.Engine;logfile=Manual_MSBuild_DebugVersion_LOG.log"
print('')
print('Cmd to execute: ' .. cmd)
local f = os.execute(cmd)
if f == 0 then
print('\nBuild: ✔️ ')
else
print('\nBuild: ❌ (code: ' .. f .. ')')
end
end
vim.g.dotnet_get_dll_path = function()
local request = function()
if vim.g['dotnet_last_dll_path'] ~= nim then
return vim.fn.input('Path to dll ', vim.g['dotnet_last_dll_path'] )
end
return vim.fn.input('Path to dll ', vim.fn.getcwd() .. '/bin/Debug/net8-windows/win-x64/', 'file')
end
if vim.g['dotnet_last_dll_path'] == nil then
vim.g['dotnet_last_dll_path'] = request()
else
if vim.fn.confirm('Do you want to change the path to dll?\n' .. vim.g['dotnet_last_dll_path'], '&yes\n&no', 2) == 1 then
vim.g['dotnet_last_dll_path'] = request()
end
end
return vim.g['dotnet_last_dll_path']
end -- lsp_mappings.n["<leader>lG"][1] = function() require("telescope.builtin").lsp_dynamic_workspace_symbols() end
-- vim.keymap.set("n", "<leader>lG", "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>",
-- { desc = "Search global symbol" })
-- cmp customizing
-- vscode icons style
-- local cmp_kinds = {
-- Text = ' ',
-- Method = ' ',
-- Function = ' ',
-- Constructor = ' ',
-- Field = ' ',
-- Variable = ' ',
-- Class = ' ',
-- Interface = ' ',
-- Module = ' ',
-- Property = ' ',
-- Unit = ' ',
-- Value = ' ',
-- Enum = ' ',
-- Keyword = ' ',
-- Snippet = ' ',
-- Color = ' ',
-- File = ' ',
-- Reference = ' ',
-- Folder = ' ',
-- EnumMember = ' ',
-- Constant = ' ',
-- Struct = ' ',
-- Event = ' ',
-- Operator = ' ',
-- TypeParameter = ' ',
-- }
-- require("cmp").setup({
-- window = {
-- completion = {
-- winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
-- col_offset = -3,
-- side_padding = 0,
-- },
-- },
-- formatting = {
-- fields = { "kind", "abbr", "menu" },
-- format = function(entry, vim_item)
-- local kind = require("lspkind").cmp_format({ mode = "symbol_text", maxwidth = 50 })(entry, vim_item)
-- local strings = vim.split(kind.kind, "%s", { trimempty = true })
-- kind.kind = " " .. (strings[1] or "") .. " "
-- kind.menu = " (" .. (strings[2] or "") .. ")"
--
-- return kind
-- end,
-- },
-- })
-- dap.adapters.chrome = {
-- type = "executable",
-- command = "node",
-- args = {
-- "C:\\Users\\michaelcarno\\AppData\\Local\\nvim-data\\mason\\packages\\chrome-debug-adapter\\out\\src\\chromeDebug.js",
-- "45635" }
-- }
--
-- dap.configurations.javascript = {
-- {
-- type = "chrome",
-- request = "attach",
-- program = "${file}",
-- -- debugServer = 45635,
-- cwd = vim.fn.getcwd(),
-- sourceMaps = true,
-- protocol = "inspector",
-- port = 9222,
-- webRoot = "${workspaceFolder}",
-- }
-- }
-- dap.configurations.typescript = {
-- {
-- type = "chrome",
-- request = "attach",
-- program = "${file}",
-- cwd = vim.fn.getcwd(),
-- sourceMaps = true,
-- -- debugServer = 45635,
-- protocol = "inspector",
-- port = 9222,
-- webRoot = "${workspaceFolder}",
-- },
-- }
--
-- vim.opt.list = true
-- vim.opt.listchars:append "space:⋅"
-- vim.opt.listchars:append "eol:↴"
-- Set up custom filetypes
-- vim.filetype.add {
-- extension = {
-- foo = "fooscript",
-- },
-- filename = {
-- ["Foofile"] = "fooscript",
-- },
-- pattern = {
-- ["~/%.config/foo/.*"] = "fooscript",
-- },
-- }
-- command to build treesiter (have to install LLVM)
--cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build
end,
}