Mercurial > dotfiles
annotate dot_config/nvim/init.lua @ 424:f42ea4c4a78c
Add smarter python indentation
author | zegervdv <zegervdv@me.com> |
---|---|
date | Wed, 28 Jul 2021 11:40:52 +0200 |
parents | 5683e8e3e361 |
children | 10916f9b1676 |
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 | |
424 | 240 use { 'vimjas/vim-python-pep8-indent', ft = { 'python' } } |
241 | |
411 | 242 -- Vanity |
243 use { | |
244 'yamatsum/nvim-web-nonicons', | |
245 requires = 'kyazdani42/nvim-web-devicons', | |
246 config = function() | |
247 require 'nvim-nonicons' | |
248 end, | |
249 } | |
250 | |
251 use { | |
252 'glepnir/galaxyline.nvim', | |
253 branch = 'main', | |
254 -- your statusline | |
255 config = function() | |
256 local gl = require 'galaxyline' | |
257 local colors = require('galaxyline.theme').default | |
258 local condition = require 'galaxyline.condition' | |
259 local gls = gl.section | |
260 | |
261 colors.bg = '#2C323C' | |
262 | |
263 gls.left[1] = { | |
264 RainbowRed = { | |
265 provider = function() | |
266 return '▊ ' | |
267 end, | |
268 highlight = { colors.blue, colors.bg }, | |
269 }, | |
270 } | |
271 | |
272 gls.left[2] = { | |
273 FileIcon = { | |
274 provider = 'FileIcon', | |
275 condition = condition.buffer_not_empty, | |
276 highlight = { require('galaxyline.provider_fileinfo').get_file_icon_color, colors.bg }, | |
277 }, | |
278 } | |
279 | |
280 gls.left[3] = { | |
281 FileName = { | |
282 provider = 'FileName', | |
283 condition = condition.buffer_not_empty, | |
284 highlight = { colors.magenta, colors.bg, 'bold' }, | |
285 }, | |
286 } | |
287 | |
288 gls.right[1] = { | |
289 ShowLspClient = { | |
290 provider = 'GetLspClient', | |
291 condition = function() | |
292 local tbl = { ['dashboard'] = true, [''] = true } | |
293 if tbl[vim.bo.filetype] then | |
294 return false | |
295 end | |
296 return true | |
297 end, | |
298 icon = require('nvim-nonicons').get 'server' .. ' LSP:', | |
299 highlight = { colors.green, colors.bg, 'bold' }, | |
300 }, | |
301 } | |
302 | |
303 gls.right[2] = { | |
304 LineInfo = { | |
305 provider = 'LineColumn', | |
306 separator = ' ', | |
307 separator_highlight = { 'NONE', colors.bg }, | |
308 highlight = { colors.fg, colors.bg }, | |
309 }, | |
310 } | |
311 | |
312 gls.right[3] = { | |
313 PerCent = { | |
314 provider = 'LinePercent', | |
315 separator = ' ', | |
316 separator_highlight = { 'NONE', colors.bg }, | |
317 highlight = { colors.fg, colors.bg, 'bold' }, | |
318 }, | |
319 } | |
320 gls.right[8] = { | |
321 RainbowBlue = { | |
322 provider = function() | |
323 return ' ▊' | |
324 end, | |
325 highlight = { colors.blue, colors.bg }, | |
326 }, | |
327 } | |
328 | |
329 gls.short_line_left[1] = { | |
330 BufferType = { | |
331 provider = 'FileTypeName', | |
332 separator = ' ', | |
333 separator_highlight = { 'NONE', colors.bg }, | |
334 highlight = { colors.blue, colors.bg, 'bold' }, | |
335 }, | |
336 } | |
337 | |
338 gls.short_line_left[2] = { | |
339 SFileName = { | |
340 provider = 'SFileName', | |
341 condition = condition.buffer_not_empty, | |
342 highlight = { colors.fg, colors.bg, 'bold' }, | |
343 }, | |
344 } | |
345 | |
346 gls.short_line_right[1] = { | |
347 BufferIcon = { provider = 'BufferIcon', highlight = { colors.fg, colors.bg } }, | |
348 } | |
349 end, | |
350 } | |
351 | |
352 -- File navigation | |
353 use { 'justinmk/vim-dirvish' } | |
354 | |
355 -- Colorscheme | |
356 use { | |
357 'zegervdv/one-lush', | |
358 requires = 'rktjmp/lush.nvim', | |
359 config = function() | |
360 require 'lush_theme.one-lush' | |
361 vim.cmd [[ colorscheme one-lush ]] | |
362 end, | |
363 } | |
364 | |
365 -- Terminal | |
366 use { | |
367 'akinsho/nvim-toggleterm.lua', | |
368 config = function() | |
369 require('toggleterm').setup { | |
370 size = 15, | |
371 open_mapping = [[<F12>]], | |
372 shade_filetypes = { 'none' }, | |
373 shade_terminals = true, | |
374 persist_size = true, | |
375 direction = 'horizontal', | |
376 } | |
377 end, | |
378 } | |
379 | |
380 -- Filetypes | |
416 | 381 use { 'lepture/vim-jinja' } |
411 | 382 end) |
383 end, 0) | |
384 | |
423 | 385 -- Configuration |
386 local opt = vim.opt | |
387 | |
388 opt.backspace = { 'indent', 'eol', 'start' } -- Backspace everything | |
389 | |
390 opt.autoread = true -- Read changed files | |
391 opt.hidden = true -- Allow to move away from modified files | |
392 opt.autowriteall = true -- Write changes when losing focus | |
393 | |
394 -- Visuals | |
395 opt.number = true | |
396 opt.relativenumber = true | |
397 opt.scrolloff = 4 | |
398 opt.showcmd = true -- Show incomplete commands while typing | |
399 | |
400 opt.termguicolors = true | |
401 opt.background = 'dark' | |
402 | |
403 opt.showmatch = true -- Highligh matching braces | |
404 | |
405 opt.wrap = true -- Wrap lines | |
406 opt.wrapmargin = 2 -- Stay 2 chars from side | |
407 opt.textwidth = 79 | |
408 opt.colorcolumn = '81' -- Show indication of 81 chars | |
409 opt.linebreak = true -- Smarter wrapping | |
410 opt.breakindent = true -- Indent wrapped lines to same level | |
411 | |
412 opt.fixendofline = true -- Add EOL when missing | |
413 | |
414 opt.expandtab = true -- Add spaces when pressing tab | |
415 opt.tabstop = 2 -- Tab is 2 spaces | |
416 opt.shiftwidth = 2 -- Shift per 2 spaces | |
417 opt.shiftround = true -- Round shifts to allign (1 space + tab = 2 spaces) | |
418 | |
419 -- Searching and substitute | |
420 opt.magic = true -- Enable regexes | |
421 opt.hlsearch = true -- Highlight all matches | |
422 opt.incsearch = true -- Show matches while typing | |
423 opt.ignorecase = true | |
424 opt.smartcase = true -- When search pattern contains cases, be case sensitive | |
425 opt.gdefault = true -- Use global flag for substitute: replace all matches on line | |
426 opt.inccommand = 'nosplit' -- Show live replacements directly in text | |
427 | |
428 opt.autoindent = true | |
429 opt.cindent = true -- C-syntax based indenting | |
430 | |
431 opt.updatetime = 300 -- Faster triggering of CursorHold events | |
432 | |
433 opt.errorbells = false -- Don't you beep to me | |
434 | |
435 opt.history = 1000 -- Remember last commands | |
436 | |
437 opt.wildmenu = true -- Command completion | |
438 opt.wildmode = { longest = 'full', 'full' } -- Complete the fullest match | |
439 opt.shortmess:append 'c' -- Hide ins-completion messages | |
440 | |
441 opt.ttyfast = true -- fast terminal | |
442 opt.lazyredraw = true | |
443 opt.ttimeoutlen = -1 -- Minimum timeout | |
444 | |
445 opt.diffopt:append 'iwhite' -- Ignore whitespace in diffs | |
446 opt.diffopt:append 'internal' -- Internal diff engine | |
447 opt.diffopt:append 'algorithm:patience' -- Use patience algorithm | |
448 | |
449 opt.tags = { '.git/tags', 'tags' } | |
450 | |
451 opt.path:append '**' -- Recursively search current directory | |
452 | |
453 opt.formatoptions = { | |
454 c = true, -- Wrap comments | |
455 r = true, -- Continue comments | |
456 o = true, -- Insert comment with o/O | |
457 q = true, -- Format comments with gq | |
458 n = true, -- Indent numbered lists | |
459 [2] = true, -- Indent from 2nd line of paragraph | |
460 [1] = true, -- Don't break before one letter words | |
461 } | |
462 | |
463 opt.signcolumn = 'yes' -- Always show signcolumn | |
464 | |
465 opt.cursorline = true | |
466 | |
467 -- Show certain characters | |
468 opt.list = true | |
469 opt.listchars = { trail = '·', extends = '>', precedes = '<', nbsp = '+' } | |
470 | |
471 opt.sessionoptions:remove 'options' -- Remove options from saved sessions (reload from config) | |
472 | |
473 opt.completeopt = { 'menu', 'menuone', 'noselect' } | |
474 | |
475 opt.splitright = true -- Open new splits to right | |
476 opt.virtualedit = 'block' -- Enable block editting | |
477 | |
478 opt.conceallevel = 0 -- Disable conceal | |
479 | |
480 opt.pastetoggle = '<F2>' -- Enable paste mode | |
481 | |
482 opt.undofile = true -- Persistently remember undos | |
483 opt.undolevels = 1000 | |
484 opt.undodir = os.getenv 'HOME' .. '/.config/nvim/tmp/undo//' | |
485 opt.swapfile = false -- Disable swap files | |
486 opt.backup = true -- Keep backups | |
487 opt.backupdir = os.getenv 'HOME' .. '/.config/nvim/tmp/backup//' | |
488 | |
489 -- Files to ignore from completion | |
490 opt.wildignore:append { | |
491 '*/tmp/*', | |
492 '*.so', | |
493 '*.swp', | |
494 '*.zip', | |
495 '*.o', | |
496 '*.bin', | |
497 '*.elf', | |
498 '*.hex', | |
499 '*.eps', | |
500 '.git/*', | |
501 '*.dup', | |
502 '.hg/**', | |
503 '*.orig', | |
504 '*.*~', | |
505 } | |
506 | |
507 opt.mouse = { | |
508 n = true, -- Normal mode | |
509 i = true, -- Insert mode | |
510 c = true, -- Commandline mode | |
511 } | |
512 | |
411 | 513 -- LSP config |
514 local lsp = require 'lspconfig' | |
515 local null_ls = require 'null-ls' | |
516 | |
517 local on_attach = function(client) | |
518 local nnoremap = vim.keymap.nnoremap | |
519 local inoremap = vim.keymap.inoremap | |
520 nnoremap { 'gd', vim.lsp.buf.declaration, silent = true } | |
521 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
|
522 nnoremap { 'K', vim.lsp.buf.hover, silent = true } |
411 | 523 nnoremap { 'gD', vim.lsp.buf.implementation, silent = true } |
524 nnoremap { '1gD', vim.lsp.buf.type_definition, silent = true } | |
525 nnoremap { 'gr', vim.lsp.buf.references, silent = true } | |
526 nnoremap { 'g0', vim.lsp.buf.document_symbol, silent = true } | |
527 nnoremap { | |
528 '<c-p>', | |
529 function() | |
530 vim.lsp.buf.formatting_sync({}, 5000) | |
531 end, | |
532 silent = true, | |
533 } | |
534 -- nnoremap { 'gp', require'lspsaga.provider'.preview_definition, silent = true } | |
535 nnoremap { 'gp', require('goto-preview').goto_preview_definition, silent = true } | |
536 nnoremap { 'gP', require('goto-preview').close_all_win, silent = true } | |
537 | |
538 inoremap { '<c-l>', vim.lsp.buf.signature_help, silent = true } | |
539 | |
540 vim.fn.sign_define( | |
541 'LspDiagnosticsSignError', | |
542 { texthl = 'LspDiagnosticsSignError', linehl = '', numhl = '', text = '▎' } | |
543 ) | |
544 vim.fn.sign_define('LspDiagnosticsSignWarning', { | |
545 texthl = 'LspDiagnosticsSignWarning', | |
546 linehl = '', | |
547 numhl = '', | |
548 text = '▎', | |
549 }) | |
550 vim.fn.sign_define('LspDiagnosticsSignInformation', { | |
551 texthl = 'LspDiagnosticsSignInformation', | |
552 linehl = '', | |
553 numhl = '', | |
554 text = '▎', | |
555 }) | |
556 vim.fn.sign_define( | |
557 'LspDiagnosticsSignHint', | |
558 { texthl = 'LspDiagnosticsSignHint', linehl = '', numhl = '', text = '▎' } | |
559 ) | |
412
ad54efacea8a
Remove lspsaga in favour of built-in hover windows
zegervdv <zegervdv@me.com>
parents:
411
diff
changeset
|
560 |
ad54efacea8a
Remove lspsaga in favour of built-in hover windows
zegervdv <zegervdv@me.com>
parents:
411
diff
changeset
|
561 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
|
562 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
|
563 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
|
564 underline = true, |
32f1aecb9d01
Only show virtual_text diagnostics for Warnings or worse
zegervdv <zegervdv@me.com>
parents:
412
diff
changeset
|
565 update_in_insert = false, |
32f1aecb9d01
Only show virtual_text diagnostics for Warnings or worse
zegervdv <zegervdv@me.com>
parents:
412
diff
changeset
|
566 virtual_text = { severity_limit = 'Warning' }, |
32f1aecb9d01
Only show virtual_text diagnostics for Warnings or worse
zegervdv <zegervdv@me.com>
parents:
412
diff
changeset
|
567 }) |
411 | 568 end |
569 | |
570 local capabilities = vim.lsp.protocol.make_client_capabilities() | |
571 capabilities.textDocument.completion.completionItem.snippetSupport = true | |
572 capabilities.textDocument.completion.completionItem.resolveSupport = { | |
573 properties = { | |
574 'documentation', | |
575 'detail', | |
576 'additionalTextEdits', | |
577 }, | |
578 } | |
579 | |
580 lsp.pyright.setup { on_attach = on_attach, capabilities = capabilities } | |
581 | |
417
8dd914d43a65
Use lspconfig to configure null-ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
416
diff
changeset
|
582 null_ls.config { |
411 | 583 sources = { |
584 null_ls.builtins.formatting.black, | |
585 null_ls.builtins.formatting.stylua, | |
586 }, | |
587 } | |
417
8dd914d43a65
Use lspconfig to configure null-ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
416
diff
changeset
|
588 lsp['null-ls'].setup { |
8dd914d43a65
Use lspconfig to configure null-ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
416
diff
changeset
|
589 on_attach = on_attach, |
8dd914d43a65
Use lspconfig to configure null-ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
416
diff
changeset
|
590 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
|
591 } |
411 | 592 |
593 local luadev = require('lua-dev').setup { | |
594 lspconfig = { | |
595 cmd = { 'lua-language-server' }, | |
596 on_attach = on_attach, | |
597 capabilities = capabilities, | |
598 settings = { | |
599 Lua = { | |
600 diagnostics = { | |
601 globals = { 'use' }, | |
602 }, | |
603 }, | |
604 }, | |
605 }, | |
606 } | |
607 | |
608 lsp.sumneko_lua.setup(luadev) | |
609 | |
610 -- Try importing local config | |
611 local ok, localconfig = pcall(require, 'localconfig') | |
612 if ok then | |
613 localconfig.setup { on_attach = on_attach, capabilities = capabilities } | |
614 end |