forked from nvim-lua/kickstart.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
781 lines (704 loc) · 24.9 KB
/
Copy pathinit.lua
File metadata and controls
781 lines (704 loc) · 24.9 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
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
vim.g.have_nerd_font = true
-- Make line numbers default
vim.o.number = true
vim.o.relativenumber = true
-- Enable mouse mode, can be useful for resizing splits for example!
vim.o.mouse = 'a'
-- Don't show the mode, since it's already in the status line
vim.o.showmode = false
vim.schedule(function()
vim.o.clipboard = 'unnamedplus'
end)
vim.o.tabstop = 4
vim.o.softtabstop = 0
vim.o.shiftwidth = 4
vim.o.wrap = true
vim.o.swapfile = false
vim.o.breakindent = true
vim.o.undofile = true
vim.o.winborder = 'rounded'
-- Enable true colors
vim.o.termguicolors = true
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
vim.o.ignorecase = true
vim.o.smartcase = true
-- Keep signcolumn on by default
vim.o.signcolumn = 'yes'
-- Decrease update time
vim.o.updatetime = 250
-- Decrease mapped sequence wait time
vim.o.timeoutlen = 300
-- Configure how new splits should be opened
vim.o.splitright = true
vim.o.splitbelow = true
-- Sets how neovim will display certain whitespace characters in the editor.
vim.o.list = true
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
-- Preview substitutions live, as you type!
vim.o.inccommand = 'split'
-- Show which line your cursor is on
vim.o.cursorline = true
-- Minimal number of screen lines to keep above and below the cursor.
vim.o.scrolloff = 10
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
-- instead raise a dialog asking if you wish to save the current file(s)
-- See `:help 'confirm'`
vim.o.confirm = true
vim.o.softtabstop = 4
vim.o.shiftwidth = 4
vim.filetype.add {
extension = {
hlsl = 'hlsl',
compute = 'hlsl',
cginc = 'hlsl',
},
}
-- [[ Basic Keymaps ]]
vim.keymap.set('n', '<leader>w', ':write<cr>')
vim.keymap.set('n', '<leader>e', ':e $MYVIMRC<cr>')
-- Clear highlights on search when pressing <Esc> in normal mode
-- See `:help hlsearch`
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
-- Diagnostic keymaps
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
-- Set Esc Esc as a keybind for exiting terminal mode
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
-- Convenience remaps
vim.keymap.set('n', '<C-j>', '<C-p>', { desc = 'Move up one line' })
vim.keymap.set('n', '<C-h>', ':e #<cr>', { desc = 'Move to alternate' })
vim.keymap.set('n', '<C-s>', '<C-d>', { desc = 'Move Downwards' })
vim.keymap.set('n', '<C-f>', '<C-u>', { desc = 'Move Upwards' })
-- See `:help wincmd` for a list of all window commands
vim.keymap.set('n', '<C-n>', '<C-w><C-H>', { desc = 'Move focus to the left window' })
vim.keymap.set('n', '<C-i>', '<C-w><C-L>', { desc = 'Move focus to the right window' })
vim.keymap.set('n', '<C-e>', '<C-w><C-J>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-u>', '<C-w><C-K>', { desc = 'Move focus to the upper window' })
vim.keymap.set('n', '<C-S-h>', '<C-w>H', { desc = 'Move window to the left' })
vim.keymap.set('n', '<C-S-l>', '<C-w>L', { desc = 'Move window to the right' })
vim.keymap.set('n', '<C-S-j>', '<C-w>J', { desc = 'Move window to the lower' })
vim.keymap.set('n', '<C-S-k>', '<C-w>K', { desc = 'Move window to the upper' })
-- [[ Basic Autocommands ]]
vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight when yanking (copying) text',
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
callback = function()
vim.hl.on_yank()
end,
})
-- Reset cursor when leaving vim
vim.api.nvim_create_autocmd('ExitPre', {
desc = 'Set cursor back to beam when leaving Neovim',
group = vim.api.nvim_create_augroup('Exit', { clear = true }),
command = 'set guicursor=a:ver90',
})
-- Start tree sitter on entering hlsl file
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'hlsl', 'gdshader' },
callback = function()
vim.treesitter.start()
end,
})
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
if vim.v.shell_error ~= 0 then
error('Error cloning lazy.nvim:\n' .. out)
end
end
---@type vim.Option
local rtp = vim.opt.rtp
rtp:prepend(lazypath)
-- [[ Plugins ]]
require('lazy').setup({
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
opts = {
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '‾' },
changedelete = { text = '~' },
},
},
},
{
'uga-rosa/ccc.nvim',
config = function()
require('ccc').setup {
highlighter = {
auto_enable = true,
},
lsp = true,
}
end,
},
{
'mfussenegger/nvim-dap',
dependencies = {
'leoluz/nvim-dap-go',
'rcarriga/nvim-dap-ui',
'nvim-neotest/nvim-nio',
'theHamsta/nvim-dap-virtual-text',
},
config = function()
local dap = require 'dap'
local ui = require 'dapui'
end,
},
{ -- Save files as sudo
'lambdalisue/suda.vim',
},
{ -- Useful plugin to show you pending keybinds.
'folke/which-key.nvim',
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
opts = {
delay = 0,
icons = {
mappings = vim.g.have_nerd_font,
keys = vim.g.have_nerd_font and {} or {
Up = '<Up> ',
Down = '<Down> ',
Left = '<Left> ',
Right = '<Right> ',
C = '<C-…> ',
M = '<M-…> ',
D = '<D-…> ',
S = '<S-…> ',
CR = '<CR> ',
Esc = '<Esc> ',
ScrollWheelDown = '<ScrollWheelDown> ',
ScrollWheelUp = '<ScrollWheelUp> ',
NL = '<NL> ',
BS = '<BS> ',
Space = '<Space> ',
Tab = '<Tab> ',
F1 = '<F1>',
F2 = '<F2>',
F3 = '<F3>',
F4 = '<F4>',
F5 = '<F5>',
F6 = '<F6>',
F7 = '<F7>',
F8 = '<F8>',
F9 = '<F9>',
F10 = '<F10>',
F11 = '<F11>',
F12 = '<F12>',
},
},
-- Document existing key chains
spec = {
{ '<leader>s', group = '[S]earch' },
{ '<leader>t', group = '[T]oggle' },
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
{ '<leader>w', group = '[W]rite', mode = { 'n' } },
},
},
},
{ -- Fuzzy Finder (files, lsp, etc)
'nvim-telescope/telescope.nvim',
event = 'VimEnter',
dependencies = {
'nvim-lua/plenary.nvim',
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
'nvim-telescope/telescope-fzf-native.nvim',
build = 'make',
cond = function()
return vim.fn.executable 'make' == 1
end,
},
{ 'nvim-telescope/telescope-ui-select.nvim' },
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
},
config = function()
require('telescope').setup {
defaults = {
vimgrep_arguments = {
'rg',
'--color=never',
'--no-heading',
'--with-filename',
'--line-number',
'--column',
'--smart-case',
'--no-ignore-vcs',
'-L',
},
path_display = { 'filename_first' },
},
pickers = {
find_files = {
find_command = { 'rg', '--files', '--hidden', '-L', '--no-ignore-vcs' },
},
},
-- `:help telescope.setup()`
extensions = {
['ui-select'] = {
require('telescope.themes').get_dropdown(),
},
},
}
pcall(require('telescope').load_extension, 'fzf')
pcall(require('telescope').load_extension, 'ui-select')
local builtin = require 'telescope.builtin'
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<leader>/', function()
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
winblend = 10,
previewer = false,
})
end, { desc = '[/] Fuzzily search in current buffer' })
-- It's also possible to pass additional configuration options.
-- `:help telescope.builtin.live_grep()`
vim.keymap.set('n', '<leader>s/', function()
builtin.live_grep {
grep_open_files = true,
prompt_title = 'Live Grep in Open Files',
}
end, { desc = '[S]earch [/] in Open Files' })
-- Shortcut for searching Neovim configuration files
vim.keymap.set('n', '<leader>sn', function()
builtin.find_files { cwd = vim.fn.stdpath 'config' }
end, { desc = '[S]earch [N]eovim files' })
end,
},
{
-- completion, annotations and signatures of Neovim apis
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
{ path = '${3rd}/luv/library', words = { 'vim%.uv' } },
},
},
},
{
'ownself/roslyn.nvim',
branch = "improvement",
---@module 'roslyn.config'
---@type RoslynNvimConfig
opts = {
broad_search = false,
-- choose_target = function(target)
-- return vim.iter(target):find(function(item)
-- if string.match(item, 'E:/cinnabar/Development/Unity Projects/Amplitude.Mercury.Unityproject/Amplitude.Mercury.Unityproject.sln') then
-- return item
-- elseif string.match(item, 'E:/thallium/Development/Unity Projects/Amplitude.Mercury.Unityproject/Amplitude.Mercury.Unityproject.sln') then
-- return item
-- end
-- end)
-- end,
filewatching = "roslyn",
config = {
settings = {
format_on_save = false,
['csharp|background_analysis'] = {
dotnet_analyzer_diagnostics_scope = 'none',
dotnet_compiler_diagnostics_scope = 'none',
},
['csharp|formatting'] = {
format_on_save = false,
},
['csharp|completion'] = {
dotnet_provide_regex_completions = false,
dotnet_show_completion_items_from_unimported_namespaces = false,
dotnet_show_name_completion_suggestions = false
},
['csharp|codelens'] = {
dotnet_enable_reference_code_lens = false,
dotnet_enable_tests_code_lens = false,
},
['csharp|symbol_search'] = {
dotnet_searche_reference_assemblies = false
},
['csharp|type_members'] = {
dotnet_member_insertion_location = false,
dotnet_propery_generation_behaviour = false,
},
['csharp|inlay_hints'] = {
csharp_enable_inlay_hints_for_implicit_object_creation = false,
csharp_enable_inlay_hints_for_implicit_variable_types = false,
csharp_enable_inlay_hints_for_lambda_parameter_types = false,
csharp_enable_inlay_hints_for_types = false,
dotnet_enable_inlay_hints_for_indexer_parameters = false,
dotnet_enable_inlay_hints_for_literal_parameters = false,
dotnet_enable_inlay_hints_for_object_creation_parameters = false,
dotnet_enable_inlay_hints_for_other_parameters = false,
dotnet_enable_inlay_hints_for_parameters = false,
dotnet_suppress_inlay_hints_for_parameters_that_differ_only_by_suffix = true,
dotnet_suppress_inlay_hints_for_parameters_that_match_argument_name = true,
dotnet_suppress_inlay_hints_for_parameters_that_match_method_intent = true,
},
},
},
},
},
{
-- Main LSP Configuration
'neovim/nvim-lspconfig',
dependencies = {
{
'mason-org/mason.nvim',
opts = {
registries = {
'github:mason-org/mason-registry',
'github:Crashdummyy/mason-registry',
},
},
},
'mason-org/mason-lspconfig.nvim',
'WhoIsSethDaniel/mason-tool-installer.nvim',
-- Useful status updates for LSP.
{ 'j-hui/fidget.nvim', opts = {} },
-- Allows extra capabilities provided by blink.cmp
'saghen/blink.cmp',
},
config = function()
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
callback = function(event)
local map = function(keys, func, desc, mode)
mode = mode or 'n'
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
end
map('grn', vim.lsp.buf.rename, '[R]e[n]ame')
map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' })
map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols')
map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols')
map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition')
local function client_supports_method(client, method, bufnr)
return client:supports_method(method, bufnr)
end
-- Keymap to toggle inlay hints, if the lsp supports them
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
map('<leader>th', function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
end, '[T]oggle Inlay [H]ints')
end
end,
})
-- Diagnostic Config
-- :help vim.diagnostic.Opts
vim.diagnostic.config {
severity_sort = true,
virtual_lines = { current_line = true },
float = { border = 'rounded', source = 'if_many' },
underline = { severity = vim.diagnostic.severity.ERROR },
signs = vim.g.have_nerd_font and {
text = {
[vim.diagnostic.severity.ERROR] = ' ',
[vim.diagnostic.severity.WARN] = ' ',
[vim.diagnostic.severity.INFO] = ' ',
[vim.diagnostic.severity.HINT] = ' ',
},
} or {},
virtual_text = {
source = 'if_many',
spacing = 2,
format = function(diagnostic)
local diagnostic_message = {
[vim.diagnostic.severity.ERROR] = diagnostic.message,
[vim.diagnostic.severity.WARN] = diagnostic.message,
[vim.diagnostic.severity.INFO] = diagnostic.message,
[vim.diagnostic.severity.HINT] = diagnostic.message,
}
return diagnostic_message[diagnostic.severity]
end,
},
}
local capabilities = require('blink.cmp').get_lsp_capabilities()
local servers = {
gopls = {},
lua_ls = {
settings = {
Lua = {
completion = {
callSnippet = 'Replace',
},
},
},
},
}
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
'stylua',
'gopls',
})
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
require('mason-lspconfig').setup {
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
automatic_installation = false,
handlers = {
function(server_name)
local server = servers[server_name] or {}
-- This handles overriding only values explicitly passed
-- by the server configuration above. Useful when disabling
-- certain features of an LSP (for example, turning off formatting for ts_ls)
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
require('lspconfig')[server_name].setup(server)
end,
},
}
end,
},
{ -- Autoformat
'stevearc/conform.nvim',
event = { 'BufWritePre' },
cmd = { 'ConformInfo' },
keys = {
{
'<leader>f',
function()
require('conform').format { async = true, lsp_format = 'fallback' }
end,
mode = '',
desc = '[F]ormat buffer',
},
},
opts = {
notify_on_error = false,
format_on_save = function(bufnr)
local disable_filetypes = { c = true, cpp = true, cs = true, hlsl = true, gdshader = true, python = true }
if disable_filetypes[vim.bo[bufnr].filetype] then
return nil
else
return {
timeout_ms = 500,
lsp_format = 'fallback',
}
end
end,
formatters_by_ft = {
lua = { 'stylua' },
go = { 'gofmt' },
python = { 'pylint' },
},
},
},
{ -- Autocompletion
'saghen/blink.cmp',
event = 'VimEnter',
version = '1.*',
dependencies = {
-- Snippet Engine
{
'L3MON4D3/LuaSnip',
version = '2.*',
build = (function()
if vim.fn.executable 'make' == 0 then
return
end
return 'make install_jsregexp'
end)(),
dependencies = {
-- https://github.com/rafamadriz/friendly-snippets
{
'rafamadriz/friendly-snippets',
config = function()
require('luasnip.loaders.from_vscode').lazy_load()
end,
},
},
opts = {},
},
'folke/lazydev.nvim',
},
--- @module 'blink.cmp'
--- @type blink.cmp.Config
opts = {
keymap = {
['<C-u>'] = { 'show' },
['<CR>'] = { 'select_and_accept', 'fallback' },
preset = 'default',
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
},
appearance = {
nerd_font_variant = 'mono',
},
completion = {
documentation = { auto_show = true, auto_show_delay_ms = 500 },
},
sources = {
default = { 'lsp', 'path', 'snippets', 'lazydev' },
providers = {
lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
},
},
snippets = { preset = 'luasnip' },
fuzzy = { implementation = 'lua' },
signature = { enabled = true },
},
},
{
'folke/tokyonight.nvim',
priority = 1000,
config = function()
---@diagnostic disable-next-line: missing-fields
require('tokyonight').setup {
styles = {
comments = { italic = false }, -- Disable italics in comments
},
}
-- vim.cmd.colorscheme 'tokyonight-night'
end,
},
{
'rose-pine/neovim',
priority = 1000,
name = 'rose-pine',
config = function()
require('rose-pine').setup {
variant = 'dawn',
}
vim.cmd 'colorscheme rose-pine'
end,
},
-- Highlight todo, notes, etc in comments
{
'folke/todo-comments.nvim',
event = 'VimEnter',
dependencies = { 'nvim-lua/plenary.nvim' },
opts = { signs = false },
},
{ -- Collection of various small independent plugins/modules
'echasnovski/mini.nvim',
config = function()
-- Better Around/Inside textobjects
--
-- Examples:
-- - va) - [V]isually select [A]round [)]paren
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
-- - ci' - [C]hange [I]nside [']quote
require('mini.ai').setup { n_lines = 500 }
-- Add/delete/replace surroundings (brackets, quotes, etc.)
--
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
-- - sd' - [S]urround [D]elete [']quotes
-- - sr)' - [S]urround [R]eplace [)] [']
require('mini.surround').setup()
local statusline = require 'mini.statusline'
statusline.setup { use_icons = vim.g.have_nerd_font }
---@diagnostic disable-next-line: duplicate-set-field
statusline.section_location = function()
return '%2l:%-2v'
end
end,
},
require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
}, {
ui = {
icons = vim.g.have_nerd_font and {} or {
cmd = '⌘',
config = '🛠',
event = '📅',
ft = '📂',
init = '⚙',
keys = '🗝',
plugin = '🔌',
runtime = '💻',
require = '🌙',
source = '📄',
start = '🚀',
task = '📌',
lazy = '💤 ',
},
},
})
vim.lsp.config.pylsp = {
settings = {
pylsp = {
plugins = {
pyflakes = { enabled = false },
pylint = {
enabled = true,
args = { '--rcfile=' .. 'e:/cinnabar/pylintrc', 'debounce=200' },
},
pycodestyle = { enabled = false },
mccabe = { enabled = false },
autopep8 = { enabled = false },
yapf = { enabled = false },
black = { enabled = false },
flake8 = { enabled = false },
pydocstyle = { enabled = false },
},
},
},
}
-- Telescope config
local telescopeConfig = require 'telescope.config'
-- Clone the default Telescope configuration
local vimgrep_arguments = { unpack(telescopeConfig.values.vimgrep_arguments) }
-- I want to search in hidden/dot files.
table.insert(vimgrep_arguments, '--hidden')
-- I don't want to search in the `.git` directory.
table.insert(vimgrep_arguments, '--glob')
table.insert(vimgrep_arguments, '!**/.git/*')
table.insert(vimgrep_arguments, '-L')
-- Make diagnostics wrap properly
local og_virt_text
local og_virt_line
vim.api.nvim_create_autocmd({ 'CursorMoved', 'DiagnosticChanged' }, {
group = vim.api.nvim_create_augroup('diagnostic_only_virtlines', {}),
callback = function()
if og_virt_line == nil then
og_virt_line = vim.diagnostic.config().virtual_lines
end
-- ignore if virtual_lines.current_line is disabled
if not (og_virt_line and og_virt_line.current_line) then
if og_virt_text then
vim.diagnostic.config { virtual_text = og_virt_text }
og_virt_text = nil
end
return
end
if og_virt_text == nil then
og_virt_text = vim.diagnostic.config().virtual_text
end
local lnum = vim.api.nvim_win_get_cursor(0)[1] - 1
if vim.tbl_isempty(vim.diagnostic.get(0, { lnum = lnum })) then
vim.diagnostic.config { virtual_text = og_virt_text }
else
vim.diagnostic.config { virtual_text = false }
end
end,
})
-- Immediately redraw diagnostics when the mode changes
vim.api.nvim_create_autocmd('ModeChanged', {
group = vim.api.nvim_create_augroup('diagnostic_redraw', {}),
callback = function()
pcall(vim.diagnostic.show)
end,
})
vim.lsp.config("roslyn", {
cmd = {
"Microsoft.CodeAnalysis.LanguageServer.exe",
"--stdio",
"--extension=E:/cinnabar/Development/References/StyleCop.Analyzers.1.2.0-beta.556/StyleCop.Analyzers.dll",
"--extension=E:/cinnabar/Development/References/ErrorProne.NET.CoreAnalyzers.0.3.0/ErrorProne.NET.Core.dll",
"--extension=E:/cinnabar/Development/References/ErrorProne.NET.CoreAnalyzers.0.3.0/ErrorProne.Net.CoreAnalyzers.CodeFixes.dll",
"--extension=E:/cinnabar/Development/References/ErrorProne.NET.CoreAnalyzers.0.3.0/ErrorProne.Net.CoreAnalyzers.dll",
"--extension=E:/cinnabar/Development/References/ErrorProne.NET.Structs.0.3.0/ErrorProne.NET.Core.dll",
"--extension=E:/cinnabar/Development/References/ErrorProne.NET.Structs.0.3.0/ErrorProne.Net.StructAnalyzers.CodeFixes.dll",
"--extension=E:/cinnabar/Development/References/ErrorProne.NET.Structs.0.3.0/ErrorProne.Net.StructAnalyzers.dll",
"--extension=E:/cinnabar/Development/References/Microsoft.Unity.Analyzers.1.13.0/Microsoft.Unity.Analyzers.dll",
}
})
-- vim: ts=2 sts=2 sw=2 et