Mercurial > dotfiles
annotate dot_config/nvim/init.lua @ 423:5683e8e3e361
Use lua to configure
author | zegervdv <zegervdv@me.com> |
---|---|
date | Sun, 25 Jul 2021 18:16:46 +0200 |
parents | 24330d37c9e3 |
children | f42ea4c4a78c |
rev | line source |
---|---|
411 | 1 -- |
2 -- Neovim dotfiles | |
3 -- | |
4 -- | |
5 local execute = vim.api.nvim_command | |
6 local fn = vim.fn | |
7 | |
8 -- Bootstrap package manager | |
9 local install_path = fn.stdpath 'data' .. '/site/pack/packer/opt/packer.nvim' | |
10 | |
11 if fn.empty(fn.glob(install_path)) > 0 then | |
12 execute('!git clone https://github.com/wbthomason/packer.nvim ' .. install_path) | |
13 end | |
14 | |
15 vim.defer_fn(function() | |
16 -- Packer configuration is compiled and only needs to be loaded on changes | |
17 vim.cmd 'packadd packer.nvim' | |
18 | |
19 require('packer').startup(function() | |
20 use { 'wbthomason/packer.nvim', opt = true } | |
21 | |
22 -- General plugins | |
23 use { 'tpope/vim-sensible' } | |
24 use { 'tpope/vim-repeat' } | |
25 use { 'tpope/vim-rsi' } | |
26 use { 'sgur/vim-editorconfig' } | |
27 use { 'ShikChen/osc52.vim' } | |
28 use { 'einfachtoll/didyoumean' } | |
29 | |
30 use { 'tpope/vim-obsession' } | |
31 use { | |
32 'tpope/vim-eunuch', | |
33 cmd = { | |
34 'Delete', | |
35 'Unlink', | |
36 'Move', | |
37 'Rename', | |
38 'Mkdir', | |
39 'Chmod', | |
40 'Cfind', | |
41 'Clocate', | |
42 'Lfind', | |
43 'Llocate', | |
44 'SudoEdit', | |
45 'SudoWrite', | |
46 'Wall', | |
47 }, | |
48 } | |
49 | |
50 use { 'psliwka/vim-smoothie' } | |
51 | |
52 use { 'nvim-lua/plenary.nvim' } | |
53 | |
54 -- Spelling/autocorrection | |
55 use { 'tpope/vim-abolish' } | |
56 | |
57 -- Git/VCS | |
58 use { 'vim-scripts/gitignore' } | |
423 | 59 use { |
60 'sjl/splice.vim', | |
61 opt = true, | |
62 cmd = { 'SpliceInit' }, | |
63 config = function() | |
64 vim.g.splice_initial_diff_grid = 1 | |
65 vim.g.splice_initial_diff_compare = 1 | |
66 vim.g.splice_initial_diff_path = 0 | |
67 vim.g.splice_initial_scrollbind_grid = 1 | |
68 vim.g.splice_initial_scrollbind_compare = 1 | |
69 vim.g.splice_initial_scrollbind_path = 1 | |
70 vim.g.splice_wrap = 'nowrap' | |
71 end, | |
72 } | |
411 | 73 use { 'tpope/vim-git' } |
74 | |
75 -- Comments | |
76 use { 'b3nj5m1n/kommentary' } | |
77 | |
78 -- Undoing | |
79 use { 'sjl/gundo.vim', cmd = { 'GundoToggle' } } | |
80 | |
81 -- Parentheses etc | |
82 use { 'tpope/vim-surround' } | |
423 | 83 use { |
84 'raimondi/delimitMate', | |
85 config = function() | |
86 vim.g.delimitMate_expand_cr = 1 | |
87 vim.g.delimitMate_expand_space = 1 | |
88 end, | |
89 } | |
411 | 90 |
91 -- Moving around within lines | |
92 use { 'wellle/targets.vim', event = 'InsertEnter *' } | |
93 | |
94 -- Searching | |
95 use { 'mhinz/vim-grepper', cmd = { 'Grepper' } } | |
96 | |
97 -- Keymaps TODO: to be removed when #13823 is merged | |
98 use { | |
99 'tjdevries/astronauta.nvim', | |
100 config = function() | |
101 require 'astronauta.keymap' | |
102 end, | |
103 } | |
104 | |
105 -- Opening files | |
106 use { 'wsdjeg/vim-fetch' } | |
107 | |
108 -- Indent lines | |
109 use { | |
110 'lukas-reineke/indent-blankline.nvim', | |
111 config = function() | |
112 vim.g.indent_blankline_buftype_exclude = { 'terminal', 'help', 'nofile' } | |
113 vim.g.indent_blankline_show_first_indent_level = false | |
422
24330d37c9e3
Use special char for indentline with no gaps
zegervdv <zegervdv@me.com>
parents:
417
diff
changeset
|
114 vim.g.indent_blankline_char = '│' |
411 | 115 end, |
116 } | |
117 | |
118 -- Increment/decrement | |
119 use { | |
120 'zegervdv/nrpattern.nvim', | |
121 requires = 'tpope/vim-repeat', | |
122 config = function() | |
123 local nrpattern = require 'nrpattern' | |
124 local defaults = require 'nrpattern.default' | |
125 | |
126 defaults[{ 'input', 'output' }] = { priority = 12, filetypes = { 'verilog', 'systemverilog' } } | |
127 defaults[{ "'1", "'0" }] = { priority = 9, filetypes = { 'verilog', 'systemverilog' } } | |
128 | |
129 nrpattern.setup(defaults) | |
130 end, | |
131 } | |
132 | |
133 -- Tmux | |
134 use { | |
135 'numtostr/navigator.nvim', | |
136 config = function() | |
137 require('Navigator').setup { auto_save = 'current', disable_on_zoom = true } | |
138 | |
139 local nnoremap = vim.keymap.nnoremap | |
140 nnoremap { '<c-h>', require('Navigator').left, silent = true } | |
141 nnoremap { '<c-j>', require('Navigator').down, silent = true } | |
142 nnoremap { '<c-k>', require('Navigator').up, silent = true } | |
143 nnoremap { '<c-l>', require('Navigator').right, silent = true } | |
144 end, | |
145 requires = 'tjdevries/astronauta.nvim', | |
146 after = 'astronauta.nvim', | |
147 } | |
148 | |
149 -- Completion/snippets/LSP | |
150 use { 'neovim/nvim-lspconfig' } | |
151 use { | |
152 'hrsh7th/nvim-compe', | |
153 config = function() | |
154 require('compe').setup { | |
155 enabled = true, | |
156 autocomplete = true, | |
157 debug = false, | |
158 min_length = 1, | |
159 preselect = 'enable', | |
160 throttle_time = 80, | |
161 source_timeout = 1000, | |
162 incomplete_delay = 400, | |
163 max_abbr_width = 100, | |
164 max_kind_width = 100, | |
165 max_menu_width = 100, | |
166 documentation = true, | |
167 | |
168 source = { | |
169 path = true, | |
170 buffer = true, | |
171 nvim_lsp = true, | |
415
85832377f39e
Disable compe's built-in lua completion
zegervdv <zegervdv@me.com>
parents:
413
diff
changeset
|
172 nvim_lua = false, |
411 | 173 spell = false, |
174 vsnip = true, | |
175 }, | |
176 } | |
177 | |
178 vim.cmd [[ inoremap <silent><expr> <C-y> compe#complete() ]] | |
179 vim.cmd [[ inoremap <silent><expr> <CR> compe#confirm({ 'keys': "\<Plug>delimitMateCR", 'mode': '' }) ]] | |
180 vim.cmd [[ inoremap <silent><expr> <C-e> compe#close('<C-e>') ]] | |
181 end, | |
182 } | |
183 use { | |
184 { | |
185 'nvim-treesitter/nvim-treesitter', | |
186 config = function() | |
187 require 'nvim-treesitter.highlight' | |
188 | |
189 require('nvim-treesitter.configs').setup { | |
190 highlight = { enable = false }, | |
191 incremental_selection = { | |
192 enable = true, | |
193 keymaps = { | |
194 init_selection = 'gnn', | |
195 node_incremental = 'grn', | |
196 scope_incremental = 'grc', | |
197 node_decremental = 'grm', | |
198 }, | |
199 }, | |
200 refactor = { | |
201 highlight_definitions = { enable = true }, | |
202 smart_rename = { enable = true, keymaps = { smart_rename = 'gsr' } }, | |
203 navigation = { | |
204 enable = true, | |
205 keymaps = { goto_definition = 'gnd', list_definitions = 'gnD' }, | |
206 }, | |
207 }, | |
208 textobjects = { | |
209 move = { | |
210 enable = true, | |
211 goto_next_start = { [']]'] = '@block.outer' }, | |
212 goto_previous_start = { ['[['] = '@block.outer' }, | |
213 goto_next_end = { [']['] = '@block.outer' }, | |
214 goto_previous_end = { ['[]'] = '@block.outer' }, | |
215 }, | |
216 }, | |
217 playground = { enable = true, disable = {}, updatetime = 25, persist_queries = false }, | |
218 } | |
219 end, | |
220 }, | |
221 'nvim-treesitter/nvim-treesitter-refactor', | |
222 'nvim-treesitter/nvim-treesitter-textobjects', | |
223 { 'nvim-treesitter/playground', opt = true }, | |
224 } | |
225 use { 'hrsh7th/vim-vsnip', requires = 'hrsh7th/vim-vsnip-integ' } | |
226 use { | |
227 'rmagatti/goto-preview', | |
228 config = function() | |
229 require('goto-preview').setup {} | |
230 end, | |
231 } | |
232 use { | |
233 'jose-elias-alvarez/null-ls.nvim', | |
234 requires = 'nvim-lua/plenary.nvim', | |
235 } | |
236 use { | |
237 'folke/lua-dev.nvim', | |
238 } | |
239 | |
240 -- Vanity | |
241 use { | |
242 'yamatsum/nvim-web-nonicons', | |
243 requires = 'kyazdani42/nvim-web-devicons', | |
244 config = function() | |
245 require 'nvim-nonicons' | |
246 end, | |
247 } | |
248 | |
249 use { | |
250 'glepnir/galaxyline.nvim', | |
251 branch = 'main', | |
252 -- your statusline | |
253 config = function() | |
254 local gl = require 'galaxyline' | |
255 local colors = require('galaxyline.theme').default | |
256 local condition = require 'galaxyline.condition' | |
257 local gls = gl.section | |
258 | |
259 colors.bg = '#2C323C' | |
260 | |
261 gls.left[1] = { | |
262 RainbowRed = { | |
263 provider = function() | |
264 return '▊ ' | |
265 end, | |
266 highlight = { colors.blue, colors.bg }, | |
267 }, | |
268 } | |
269 | |
270 gls.left[2] = { | |
271 FileIcon = { | |
272 provider = 'FileIcon', | |
273 condition = condition.buffer_not_empty, | |
274 highlight = { require('galaxyline.provider_fileinfo').get_file_icon_color, colors.bg }, | |
275 }, | |
276 } | |
277 | |
278 gls.left[3] = { | |
279 FileName = { | |
280 provider = 'FileName', | |
281 condition = condition.buffer_not_empty, | |
282 highlight = { colors.magenta, colors.bg, 'bold' }, | |
283 }, | |
284 } | |
285 | |
286 gls.right[1] = { | |
287 ShowLspClient = { | |
288 provider = 'GetLspClient', | |
289 condition = function() | |
290 local tbl = { ['dashboard'] = true, [''] = true } | |
291 if tbl[vim.bo.filetype] then | |
292 return false | |
293 end | |
294 return true | |
295 end, | |
296 icon = require('nvim-nonicons').get 'server' .. ' LSP:', | |
297 highlight = { colors.green, colors.bg, 'bold' }, | |
298 }, | |
299 } | |
300 | |
301 gls.right[2] = { | |
302 LineInfo = { | |
303 provider = 'LineColumn', | |
304 separator = ' ', | |
305 separator_highlight = { 'NONE', colors.bg }, | |
306 highlight = { colors.fg, colors.bg }, | |
307 }, | |
308 } | |
309 | |
310 gls.right[3] = { | |
311 PerCent = { | |
312 provider = 'LinePercent', | |
313 separator = ' ', | |
314 separator_highlight = { 'NONE', colors.bg }, | |
315 highlight = { colors.fg, colors.bg, 'bold' }, | |
316 }, | |
317 } | |
318 gls.right[8] = { | |
319 RainbowBlue = { | |
320 provider = function() | |
321 return ' ▊' | |
322 end, | |
323 highlight = { colors.blue, colors.bg }, | |
324 }, | |
325 } | |
326 | |
327 gls.short_line_left[1] = { | |
328 BufferType = { | |
329 provider = 'FileTypeName', | |
330 separator = ' ', | |
331 separator_highlight = { 'NONE', colors.bg }, | |
332 highlight = { colors.blue, colors.bg, 'bold' }, | |
333 }, | |
334 } | |
335 | |
336 gls.short_line_left[2] = { | |
337 SFileName = { | |
338 provider = 'SFileName', | |
339 condition = condition.buffer_not_empty, | |
340 highlight = { colors.fg, colors.bg, 'bold' }, | |
341 }, | |
342 } | |
343 | |
344 gls.short_line_right[1] = { | |
345 BufferIcon = { provider = 'BufferIcon', highlight = { colors.fg, colors.bg } }, | |
346 } | |
347 end, | |
348 } | |
349 | |
350 -- File navigation | |
351 use { 'justinmk/vim-dirvish' } | |
352 | |
353 -- Colorscheme | |
354 use { | |
355 'zegervdv/one-lush', | |
356 requires = 'rktjmp/lush.nvim', | |
357 config = function() | |
358 require 'lush_theme.one-lush' | |
359 vim.cmd [[ colorscheme one-lush ]] | |
360 end, | |
361 } | |
362 | |
363 -- Terminal | |
364 use { | |
365 'akinsho/nvim-toggleterm.lua', | |
366 config = function() | |
367 require('toggleterm').setup { | |
368 size = 15, | |
369 open_mapping = [[<F12>]], | |
370 shade_filetypes = { 'none' }, | |
371 shade_terminals = true, | |
372 persist_size = true, | |
373 direction = 'horizontal', | |
374 } | |
375 end, | |
376 } | |
377 | |
378 -- Filetypes | |
416 | 379 use { 'lepture/vim-jinja' } |
411 | 380 end) |
381 end, 0) | |
382 | |
423 | 383 -- Configuration |
384 local opt = vim.opt | |
385 | |
386 opt.backspace = { 'indent', 'eol', 'start' } -- Backspace everything | |
387 | |
388 opt.autoread = true -- Read changed files | |
389 opt.hidden = true -- Allow to move away from modified files | |
390 opt.autowriteall = true -- Write changes when losing focus | |
391 | |
392 -- Visuals | |
393 opt.number = true | |
394 opt.relativenumber = true | |
395 opt.scrolloff = 4 | |
396 opt.showcmd = true -- Show incomplete commands while typing | |
397 | |
398 opt.termguicolors = true | |
399 opt.background = 'dark' | |
400 | |
401 opt.showmatch = true -- Highligh matching braces | |
402 | |
403 opt.wrap = true -- Wrap lines | |
404 opt.wrapmargin = 2 -- Stay 2 chars from side | |
405 opt.textwidth = 79 | |
406 opt.colorcolumn = '81' -- Show indication of 81 chars | |
407 opt.linebreak = true -- Smarter wrapping | |
408 opt.breakindent = true -- Indent wrapped lines to same level | |
409 | |
410 opt.fixendofline = true -- Add EOL when missing | |
411 | |
412 opt.expandtab = true -- Add spaces when pressing tab | |
413 opt.tabstop = 2 -- Tab is 2 spaces | |
414 opt.shiftwidth = 2 -- Shift per 2 spaces | |
415 opt.shiftround = true -- Round shifts to allign (1 space + tab = 2 spaces) | |
416 | |
417 -- Searching and substitute | |
418 opt.magic = true -- Enable regexes | |
419 opt.hlsearch = true -- Highlight all matches | |
420 opt.incsearch = true -- Show matches while typing | |
421 opt.ignorecase = true | |
422 opt.smartcase = true -- When search pattern contains cases, be case sensitive | |
423 opt.gdefault = true -- Use global flag for substitute: replace all matches on line | |
424 opt.inccommand = 'nosplit' -- Show live replacements directly in text | |
425 | |
426 opt.autoindent = true | |
427 opt.cindent = true -- C-syntax based indenting | |
428 | |
429 opt.updatetime = 300 -- Faster triggering of CursorHold events | |
430 | |
431 opt.errorbells = false -- Don't you beep to me | |
432 | |
433 opt.history = 1000 -- Remember last commands | |
434 | |
435 opt.wildmenu = true -- Command completion | |
436 opt.wildmode = { longest = 'full', 'full' } -- Complete the fullest match | |
437 opt.shortmess:append 'c' -- Hide ins-completion messages | |
438 | |
439 opt.ttyfast = true -- fast terminal | |
440 opt.lazyredraw = true | |
441 opt.ttimeoutlen = -1 -- Minimum timeout | |
442 | |
443 opt.diffopt:append 'iwhite' -- Ignore whitespace in diffs | |
444 opt.diffopt:append 'internal' -- Internal diff engine | |
445 opt.diffopt:append 'algorithm:patience' -- Use patience algorithm | |
446 | |
447 opt.tags = { '.git/tags', 'tags' } | |
448 | |
449 opt.path:append '**' -- Recursively search current directory | |
450 | |
451 opt.formatoptions = { | |
452 c = true, -- Wrap comments | |
453 r = true, -- Continue comments | |
454 o = true, -- Insert comment with o/O | |
455 q = true, -- Format comments with gq | |
456 n = true, -- Indent numbered lists | |
457 [2] = true, -- Indent from 2nd line of paragraph | |
458 [1] = true, -- Don't break before one letter words | |
459 } | |
460 | |
461 opt.signcolumn = 'yes' -- Always show signcolumn | |
462 | |
463 opt.cursorline = true | |
464 | |
465 -- Show certain characters | |
466 opt.list = true | |
467 opt.listchars = { trail = '·', extends = '>', precedes = '<', nbsp = '+' } | |
468 | |
469 opt.sessionoptions:remove 'options' -- Remove options from saved sessions (reload from config) | |
470 | |
471 opt.completeopt = { 'menu', 'menuone', 'noselect' } | |
472 | |
473 opt.splitright = true -- Open new splits to right | |
474 opt.virtualedit = 'block' -- Enable block editting | |
475 | |
476 opt.conceallevel = 0 -- Disable conceal | |
477 | |
478 opt.pastetoggle = '<F2>' -- Enable paste mode | |
479 | |
480 opt.undofile = true -- Persistently remember undos | |
481 opt.undolevels = 1000 | |
482 opt.undodir = os.getenv 'HOME' .. '/.config/nvim/tmp/undo//' | |
483 opt.swapfile = false -- Disable swap files | |
484 opt.backup = true -- Keep backups | |
485 opt.backupdir = os.getenv 'HOME' .. '/.config/nvim/tmp/backup//' | |
486 | |
487 -- Files to ignore from completion | |
488 opt.wildignore:append { | |
489 '*/tmp/*', | |
490 '*.so', | |
491 '*.swp', | |
492 '*.zip', | |
493 '*.o', | |
494 '*.bin', | |
495 '*.elf', | |
496 '*.hex', | |
497 '*.eps', | |
498 '.git/*', | |
499 '*.dup', | |
500 '.hg/**', | |
501 '*.orig', | |
502 '*.*~', | |
503 } | |
504 | |
505 opt.mouse = { | |
506 n = true, -- Normal mode | |
507 i = true, -- Insert mode | |
508 c = true, -- Commandline mode | |
509 } | |
510 | |
411 | 511 -- LSP config |
512 local lsp = require 'lspconfig' | |
513 local null_ls = require 'null-ls' | |
514 | |
515 local on_attach = function(client) | |
516 local nnoremap = vim.keymap.nnoremap | |
517 local inoremap = vim.keymap.inoremap | |
518 nnoremap { 'gd', vim.lsp.buf.declaration, silent = true } | |
519 nnoremap { '<c-]>', vim.lsp.buf.definition, silent = true } | |
412
ad54efacea8a
Remove lspsaga in favour of built-in hover windows
zegervdv <zegervdv@me.com>
parents:
411
diff
changeset
|
520 nnoremap { 'K', vim.lsp.buf.hover, silent = true } |
411 | 521 nnoremap { 'gD', vim.lsp.buf.implementation, silent = true } |
522 nnoremap { '1gD', vim.lsp.buf.type_definition, silent = true } | |
523 nnoremap { 'gr', vim.lsp.buf.references, silent = true } | |
524 nnoremap { 'g0', vim.lsp.buf.document_symbol, silent = true } | |
525 nnoremap { | |
526 '<c-p>', | |
527 function() | |
528 vim.lsp.buf.formatting_sync({}, 5000) | |
529 end, | |
530 silent = true, | |
531 } | |
532 -- nnoremap { 'gp', require'lspsaga.provider'.preview_definition, silent = true } | |
533 nnoremap { 'gp', require('goto-preview').goto_preview_definition, silent = true } | |
534 nnoremap { 'gP', require('goto-preview').close_all_win, silent = true } | |
535 | |
536 inoremap { '<c-l>', vim.lsp.buf.signature_help, silent = true } | |
537 | |
538 vim.fn.sign_define( | |
539 'LspDiagnosticsSignError', | |
540 { texthl = 'LspDiagnosticsSignError', linehl = '', numhl = '', text = '▎' } | |
541 ) | |
542 vim.fn.sign_define('LspDiagnosticsSignWarning', { | |
543 texthl = 'LspDiagnosticsSignWarning', | |
544 linehl = '', | |
545 numhl = '', | |
546 text = '▎', | |
547 }) | |
548 vim.fn.sign_define('LspDiagnosticsSignInformation', { | |
549 texthl = 'LspDiagnosticsSignInformation', | |
550 linehl = '', | |
551 numhl = '', | |
552 text = '▎', | |
553 }) | |
554 vim.fn.sign_define( | |
555 'LspDiagnosticsSignHint', | |
556 { texthl = 'LspDiagnosticsSignHint', linehl = '', numhl = '', text = '▎' } | |
557 ) | |
412
ad54efacea8a
Remove lspsaga in favour of built-in hover windows
zegervdv <zegervdv@me.com>
parents:
411
diff
changeset
|
558 |
ad54efacea8a
Remove lspsaga in favour of built-in hover windows
zegervdv <zegervdv@me.com>
parents:
411
diff
changeset
|
559 vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'single' }) |
ad54efacea8a
Remove lspsaga in favour of built-in hover windows
zegervdv <zegervdv@me.com>
parents:
411
diff
changeset
|
560 vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'single' }) |
413
32f1aecb9d01
Only show virtual_text diagnostics for Warnings or worse
zegervdv <zegervdv@me.com>
parents:
412
diff
changeset
|
561 vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { |
32f1aecb9d01
Only show virtual_text diagnostics for Warnings or worse
zegervdv <zegervdv@me.com>
parents:
412
diff
changeset
|
562 underline = true, |
32f1aecb9d01
Only show virtual_text diagnostics for Warnings or worse
zegervdv <zegervdv@me.com>
parents:
412
diff
changeset
|
563 update_in_insert = false, |
32f1aecb9d01
Only show virtual_text diagnostics for Warnings or worse
zegervdv <zegervdv@me.com>
parents:
412
diff
changeset
|
564 virtual_text = { severity_limit = 'Warning' }, |
32f1aecb9d01
Only show virtual_text diagnostics for Warnings or worse
zegervdv <zegervdv@me.com>
parents:
412
diff
changeset
|
565 }) |
411 | 566 end |
567 | |
568 local capabilities = vim.lsp.protocol.make_client_capabilities() | |
569 capabilities.textDocument.completion.completionItem.snippetSupport = true | |
570 capabilities.textDocument.completion.completionItem.resolveSupport = { | |
571 properties = { | |
572 'documentation', | |
573 'detail', | |
574 'additionalTextEdits', | |
575 }, | |
576 } | |
577 | |
578 lsp.pyright.setup { on_attach = on_attach, capabilities = capabilities } | |
579 | |
417
8dd914d43a65
Use lspconfig to configure null-ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
416
diff
changeset
|
580 null_ls.config { |
411 | 581 sources = { |
582 null_ls.builtins.formatting.black, | |
583 null_ls.builtins.formatting.stylua, | |
584 }, | |
585 } | |
417
8dd914d43a65
Use lspconfig to configure null-ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
416
diff
changeset
|
586 lsp['null-ls'].setup { |
8dd914d43a65
Use lspconfig to configure null-ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
416
diff
changeset
|
587 on_attach = on_attach, |
8dd914d43a65
Use lspconfig to configure null-ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
416
diff
changeset
|
588 root_dir = require('lspconfig.util').root_pattern('.hg', '.git'), |
8dd914d43a65
Use lspconfig to configure null-ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
416
diff
changeset
|
589 } |
411 | 590 |
591 local luadev = require('lua-dev').setup { | |
592 lspconfig = { | |
593 cmd = { 'lua-language-server' }, | |
594 on_attach = on_attach, | |
595 capabilities = capabilities, | |
596 settings = { | |
597 Lua = { | |
598 diagnostics = { | |
599 globals = { 'use' }, | |
600 }, | |
601 }, | |
602 }, | |
603 }, | |
604 } | |
605 | |
606 lsp.sumneko_lua.setup(luadev) | |
607 | |
608 -- Try importing local config | |
609 local ok, localconfig = pcall(require, 'localconfig') | |
610 if ok then | |
611 localconfig.setup { on_attach = on_attach, capabilities = capabilities } | |
612 end |