Mercurial > dotfiles
annotate dot_config/nvim/config.lua @ 409:f0300cd1584c
Defer loading of packer config
author | zegervdv <zegervdv@me.com> |
---|---|
date | Sat, 17 Jul 2021 11:32:01 +0200 |
parents | 4406fc85ba0a |
children |
rev | line source |
---|---|
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
1 -- |
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
2 -- Neovim dotfiles |
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
3 -- |
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
4 -- |
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
5 local execute = vim.api.nvim_command |
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
6 local fn = vim.fn |
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
7 |
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
8 -- Bootstrap package manager |
406 | 9 local install_path = fn.stdpath 'data' .. '/site/pack/packer/opt/packer.nvim' |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
10 |
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
11 if fn.empty(fn.glob(install_path)) > 0 then |
380 | 12 execute('!git clone https://github.com/wbthomason/packer.nvim ' .. install_path) |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
13 end |
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
14 |
409 | 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 } | |
325
ce396166d009
Move packer setup in a function, load on demand
zegervdv <zegervdv@me.com>
parents:
324
diff
changeset
|
21 |
409 | 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' } | |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
29 |
409 | 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' } | |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
51 |
409 | 52 use { 'nvim-lua/plenary.nvim' } |
53 | |
54 -- Spelling/autocorrection | |
55 use { 'tpope/vim-abolish' } | |
56 | |
57 -- Git/VCS | |
58 use { 'vim-scripts/gitignore' } | |
59 use { 'sjl/splice.vim', opt = true, cmd = { 'SpliceInit' } } | |
60 use { 'tpope/vim-git' } | |
61 | |
62 -- Comments | |
63 use { 'b3nj5m1n/kommentary' } | |
64 | |
65 -- Undoing | |
66 use { 'sjl/gundo.vim', cmd = { 'GundoToggle' } } | |
325
ce396166d009
Move packer setup in a function, load on demand
zegervdv <zegervdv@me.com>
parents:
324
diff
changeset
|
67 |
409 | 68 -- Parentheses etc |
69 use { 'tpope/vim-surround' } | |
70 use { 'raimondi/delimitMate' } | |
71 | |
72 -- Moving around within lines | |
73 use { 'wellle/targets.vim', event = 'InsertEnter *' } | |
74 | |
75 -- Searching | |
76 use { 'mhinz/vim-grepper', cmd = { 'Grepper' } } | |
372 | 77 |
409 | 78 -- Keymaps TODO: to be removed when #13823 is merged |
79 use { | |
80 'tjdevries/astronauta.nvim', | |
81 config = function() | |
82 require 'astronauta.keymap' | |
83 end, | |
84 } | |
401
7948403a514c
Add plenary for local config scripts
Zeger Van de Vannet <zegervdv@me.com>
parents:
400
diff
changeset
|
85 |
409 | 86 -- Opening files |
87 use { 'wsdjeg/vim-fetch' } | |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
88 |
409 | 89 -- Indent lines |
90 use { | |
91 'lukas-reineke/indent-blankline.nvim', | |
92 config = function() | |
93 vim.g.indent_blankline_buftype_exclude = { 'terminal', 'help', 'nofile' } | |
94 vim.g.indent_blankline_show_first_indent_level = false | |
95 end, | |
96 } | |
372 | 97 |
409 | 98 -- Increment/decrement |
99 use { | |
100 'zegervdv/nrpattern.nvim', | |
101 requires = 'tpope/vim-repeat', | |
102 config = function() | |
103 local nrpattern = require 'nrpattern' | |
104 local defaults = require 'nrpattern.default' | |
105 | |
106 defaults[{ 'input', 'output' }] = { priority = 12, filetypes = { 'verilog', 'systemverilog' } } | |
107 defaults[{ "'1", "'0" }] = { priority = 9, filetypes = { 'verilog', 'systemverilog' } } | |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
108 |
409 | 109 nrpattern.setup(defaults) |
110 end, | |
111 } | |
112 | |
113 -- Tmux | |
114 use { | |
115 'numtostr/navigator.nvim', | |
116 config = function() | |
117 require('Navigator').setup { auto_save = 'current', disable_on_zoom = true } | |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
118 |
409 | 119 local nnoremap = vim.keymap.nnoremap |
120 nnoremap { '<c-h>', require('Navigator').left, silent = true } | |
121 nnoremap { '<c-j>', require('Navigator').down, silent = true } | |
122 nnoremap { '<c-k>', require('Navigator').up, silent = true } | |
123 nnoremap { '<c-l>', require('Navigator').right, silent = true } | |
124 end, | |
125 requires = 'tjdevries/astronauta.nvim', | |
126 after = 'astronauta.nvim', | |
127 } | |
325
ce396166d009
Move packer setup in a function, load on demand
zegervdv <zegervdv@me.com>
parents:
324
diff
changeset
|
128 |
409 | 129 -- Completion/snippets/LSP |
130 use { 'neovim/nvim-lspconfig' } | |
131 use { | |
132 'hrsh7th/nvim-compe', | |
133 config = function() | |
134 require('compe').setup { | |
135 enabled = true, | |
136 autocomplete = true, | |
137 debug = false, | |
138 min_length = 1, | |
139 preselect = 'enable', | |
140 throttle_time = 80, | |
141 source_timeout = 1000, | |
142 incomplete_delay = 400, | |
143 max_abbr_width = 100, | |
144 max_kind_width = 100, | |
145 max_menu_width = 100, | |
146 documentation = true, | |
399
59db83251de2
Add vim-fetch to open file patterns with linenrs/colnrs
zegervdv <zegervdv@me.com>
parents:
398
diff
changeset
|
147 |
409 | 148 source = { |
149 path = true, | |
150 buffer = true, | |
151 nvim_lsp = true, | |
152 nvim_lua = true, | |
153 spell = false, | |
154 vsnip = true, | |
155 }, | |
156 } | |
371
1dfda47d5d9e
Add more lua based plugins: lush, navigator, numb
zegervdv <zegervdv@me.com>
parents:
370
diff
changeset
|
157 |
409 | 158 vim.cmd [[ inoremap <silent><expr> <C-y> compe#complete() ]] |
159 vim.cmd [[ inoremap <silent><expr> <CR> compe#confirm({ 'keys': "\<Plug>delimitMateCR", 'mode': '' }) ]] | |
160 vim.cmd [[ inoremap <silent><expr> <C-e> compe#close('<C-e>') ]] | |
161 end, | |
162 } | |
163 use { | |
164 { | |
165 'nvim-treesitter/nvim-treesitter', | |
166 config = function() | |
167 require 'nvim-treesitter.highlight' | |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
168 |
409 | 169 require('nvim-treesitter.configs').setup { |
170 highlight = { enable = false }, | |
171 incremental_selection = { | |
172 enable = true, | |
173 keymaps = { | |
174 init_selection = 'gnn', | |
175 node_incremental = 'grn', | |
176 scope_incremental = 'grc', | |
177 node_decremental = 'grm', | |
178 }, | |
179 }, | |
180 refactor = { | |
181 highlight_definitions = { enable = true }, | |
182 smart_rename = { enable = true, keymaps = { smart_rename = 'gsr' } }, | |
183 navigation = { | |
184 enable = true, | |
185 keymaps = { goto_definition = 'gnd', list_definitions = 'gnD' }, | |
186 }, | |
187 }, | |
188 textobjects = { | |
189 move = { | |
190 enable = true, | |
191 goto_next_start = { [']]'] = '@block.outer' }, | |
192 goto_previous_start = { ['[['] = '@block.outer' }, | |
193 goto_next_end = { [']['] = '@block.outer' }, | |
194 goto_previous_end = { ['[]'] = '@block.outer' }, | |
195 }, | |
196 }, | |
197 playground = { enable = true, disable = {}, updatetime = 25, persist_queries = false }, | |
198 } | |
199 end, | |
200 }, | |
201 'nvim-treesitter/nvim-treesitter-refactor', | |
202 'nvim-treesitter/nvim-treesitter-textobjects', | |
203 { 'nvim-treesitter/playground', opt = true }, | |
204 } | |
205 use { 'hrsh7th/vim-vsnip', requires = 'hrsh7th/vim-vsnip-integ' } | |
206 use { | |
207 'glepnir/lspsaga.nvim', | |
208 config = function() | |
209 require('lspsaga').init_lsp_saga {} | |
210 end, | |
211 } | |
212 use { | |
213 'rmagatti/goto-preview', | |
214 config = function() | |
215 require('goto-preview').setup {} | |
216 end, | |
217 } | |
218 use { | |
219 'jose-elias-alvarez/null-ls.nvim', | |
220 requires = 'nvim-lua/plenary.nvim', | |
221 } | |
222 use { | |
223 'folke/lua-dev.nvim', | |
224 } | |
362 | 225 |
409 | 226 -- Vanity |
227 use { | |
228 'yamatsum/nvim-web-nonicons', | |
229 requires = 'kyazdani42/nvim-web-devicons', | |
230 config = function() | |
231 require 'nvim-nonicons' | |
232 end, | |
233 } | |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
234 |
409 | 235 use { |
236 'glepnir/galaxyline.nvim', | |
237 branch = 'main', | |
238 -- your statusline | |
239 config = function() | |
240 local gl = require 'galaxyline' | |
241 local colors = require('galaxyline.theme').default | |
242 local condition = require 'galaxyline.condition' | |
243 local gls = gl.section | |
244 | |
245 colors.bg = '#2C323C' | |
346
d717168f424f
Switch to nvim-compe for completion
zegervdv <zegervdv@me.com>
parents:
345
diff
changeset
|
246 |
409 | 247 gls.left[1] = { |
248 RainbowRed = { | |
249 provider = function() | |
250 return '▊ ' | |
251 end, | |
252 highlight = { colors.blue, colors.bg }, | |
253 }, | |
254 } | |
255 | |
256 gls.left[2] = { | |
257 FileIcon = { | |
258 provider = 'FileIcon', | |
259 condition = condition.buffer_not_empty, | |
260 highlight = { require('galaxyline.provider_fileinfo').get_file_icon_color, colors.bg }, | |
261 }, | |
262 } | |
346
d717168f424f
Switch to nvim-compe for completion
zegervdv <zegervdv@me.com>
parents:
345
diff
changeset
|
263 |
409 | 264 gls.left[3] = { |
265 FileName = { | |
266 provider = 'FileName', | |
267 condition = condition.buffer_not_empty, | |
268 highlight = { colors.magenta, colors.bg, 'bold' }, | |
269 }, | |
270 } | |
271 | |
272 gls.right[1] = { | |
273 ShowLspClient = { | |
274 provider = 'GetLspClient', | |
275 condition = function() | |
276 local tbl = { ['dashboard'] = true, [''] = true } | |
277 if tbl[vim.bo.filetype] then | |
278 return false | |
279 end | |
280 return true | |
281 end, | |
282 icon = require('nvim-nonicons').get 'server' .. ' LSP:', | |
283 highlight = { colors.green, colors.bg, 'bold' }, | |
284 }, | |
285 } | |
370
5ffb0fd7b98d
Move treesitter config into packer_compiled
zegervdv <zegervdv@me.com>
parents:
368
diff
changeset
|
286 |
409 | 287 gls.right[2] = { |
288 LineInfo = { | |
289 provider = 'LineColumn', | |
290 separator = ' ', | |
291 separator_highlight = { 'NONE', colors.bg }, | |
292 highlight = { colors.fg, colors.bg }, | |
293 }, | |
294 } | |
295 | |
296 gls.right[3] = { | |
297 PerCent = { | |
298 provider = 'LinePercent', | |
299 separator = ' ', | |
300 separator_highlight = { 'NONE', colors.bg }, | |
301 highlight = { colors.fg, colors.bg, 'bold' }, | |
372 | 302 }, |
409 | 303 } |
304 gls.right[8] = { | |
305 RainbowBlue = { | |
306 provider = function() | |
307 return ' ▊' | |
308 end, | |
309 highlight = { colors.blue, colors.bg }, | |
372 | 310 }, |
409 | 311 } |
312 | |
313 gls.short_line_left[1] = { | |
314 BufferType = { | |
315 provider = 'FileTypeName', | |
316 separator = ' ', | |
317 separator_highlight = { 'NONE', colors.bg }, | |
318 highlight = { colors.blue, colors.bg, 'bold' }, | |
361 | 319 }, |
409 | 320 } |
321 | |
322 gls.short_line_left[2] = { | |
323 SFileName = { | |
324 provider = 'SFileName', | |
325 condition = condition.buffer_not_empty, | |
326 highlight = { colors.fg, colors.bg, 'bold' }, | |
327 }, | |
328 } | |
329 | |
330 gls.short_line_right[1] = { | |
331 BufferIcon = { provider = 'BufferIcon', highlight = { colors.fg, colors.bg } }, | |
361 | 332 } |
380 | 333 end, |
409 | 334 } |
361 | 335 |
409 | 336 -- File navigation |
337 use { 'justinmk/vim-dirvish' } | |
361 | 338 |
409 | 339 -- Colorscheme |
340 use { | |
341 'zegervdv/one-lush', | |
342 requires = 'rktjmp/lush.nvim', | |
343 config = function() | |
344 require 'lush_theme.one-lush' | |
345 vim.cmd [[ colorscheme one-lush ]] | |
346 end, | |
347 } | |
372 | 348 |
409 | 349 -- Terminal |
350 use { | |
351 'akinsho/nvim-toggleterm.lua', | |
352 config = function() | |
353 require('toggleterm').setup { | |
354 size = 15, | |
355 open_mapping = [[<F12>]], | |
356 shade_filetypes = { 'none' }, | |
357 shade_terminals = true, | |
358 persist_size = true, | |
359 direction = 'horizontal', | |
360 } | |
361 end, | |
362 } | |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
363 |
409 | 364 -- Filetypes |
365 use { 'Glench/Vim-Jinja2-Syntax' } | |
366 end) | |
367 end, 0) | |
372 | 368 |
369 -- LSP config | |
380 | 370 local lsp = require 'lspconfig' |
406 | 371 local null_ls = require 'null-ls' |
319
b93f12d23fbd
Rename init.lua to config.lua
Zeger Van de Vannet <zegervdv@me.com>
parents:
diff
changeset
|
372 |
b93f12d23fbd
Rename init.lua to config.lua
Zeger Van de Vannet <zegervdv@me.com>
parents:
diff
changeset
|
373 local on_attach = function(client) |
372 | 374 local nnoremap = vim.keymap.nnoremap |
375 local inoremap = vim.keymap.inoremap | |
394
a80312c2755b
Add goto-preview in favour of lspsaga for previewing
Zeger Van de Vannet <zegervdv@me.com>
parents:
390
diff
changeset
|
376 -- nnoremap { '', require'lspsaga.diagnostic'.show_line_diagnostics, silent = true } |
380 | 377 nnoremap { 'gd', vim.lsp.buf.declaration, silent = true } |
378 nnoremap { '<c-]>', vim.lsp.buf.definition, silent = true } | |
406 | 379 nnoremap { 'K', require('lspsaga.hover').render_hover_doc, silent = true } |
380 | 380 nnoremap { 'gD', vim.lsp.buf.implementation, silent = true } |
381 nnoremap { '1gD', vim.lsp.buf.type_definition, silent = true } | |
382 nnoremap { 'gr', vim.lsp.buf.references, silent = true } | |
383 nnoremap { 'g0', vim.lsp.buf.document_symbol, silent = true } | |
406 | 384 nnoremap { |
385 '<c-p>', | |
386 function() | |
387 vim.lsp.buf.formatting_sync({}, 5000) | |
388 end, | |
389 silent = true, | |
390 } | |
394
a80312c2755b
Add goto-preview in favour of lspsaga for previewing
Zeger Van de Vannet <zegervdv@me.com>
parents:
390
diff
changeset
|
391 -- nnoremap { 'gp', require'lspsaga.provider'.preview_definition, silent = true } |
406 | 392 nnoremap { 'gp', require('goto-preview').goto_preview_definition, silent = true } |
393 nnoremap { 'gP', require('goto-preview').close_all_win, silent = true } | |
372 | 394 |
380 | 395 inoremap { '<c-l>', vim.lsp.buf.signature_help, silent = true } |
382 | 396 |
406 | 397 vim.fn.sign_define( |
398 'LspDiagnosticsSignError', | |
399 { texthl = 'LspDiagnosticsSignError', linehl = '', numhl = '', text = '▎' } | |
400 ) | |
398 | 401 vim.fn.sign_define('LspDiagnosticsSignWarning', { |
402 texthl = 'LspDiagnosticsSignWarning', | |
403 linehl = '', | |
404 numhl = '', | |
405 text = '▎', | |
406 }) | |
407 vim.fn.sign_define('LspDiagnosticsSignInformation', { | |
408 texthl = 'LspDiagnosticsSignInformation', | |
409 linehl = '', | |
410 numhl = '', | |
411 text = '▎', | |
412 }) | |
406 | 413 vim.fn.sign_define( |
414 'LspDiagnosticsSignHint', | |
415 { texthl = 'LspDiagnosticsSignHint', linehl = '', numhl = '', text = '▎' } | |
416 ) | |
319
b93f12d23fbd
Rename init.lua to config.lua
Zeger Van de Vannet <zegervdv@me.com>
parents:
diff
changeset
|
417 end |
b93f12d23fbd
Rename init.lua to config.lua
Zeger Van de Vannet <zegervdv@me.com>
parents:
diff
changeset
|
418 |
380 | 419 vim.lsp.handlers['textDocument/formatting'] = function(err, _, result, _, bufnr) |
406 | 420 if err ~= nil or result == nil then |
421 return | |
422 end | |
380 | 423 if not vim.api.nvim_buf_get_option(bufnr, 'modified') then |
364
f300ef1bc475
Do not run LSP diagnostics while in insert mode
Zeger Van de Vannet <zegervdv@me.com>
parents:
363
diff
changeset
|
424 local view = vim.fn.winsaveview() |
f300ef1bc475
Do not run LSP diagnostics while in insert mode
Zeger Van de Vannet <zegervdv@me.com>
parents:
363
diff
changeset
|
425 vim.lsp.util.apply_text_edits(result, bufnr) |
f300ef1bc475
Do not run LSP diagnostics while in insert mode
Zeger Van de Vannet <zegervdv@me.com>
parents:
363
diff
changeset
|
426 -- Fix to reload Treesitter |
f300ef1bc475
Do not run LSP diagnostics while in insert mode
Zeger Van de Vannet <zegervdv@me.com>
parents:
363
diff
changeset
|
427 -- vim.api.nvim_command("edit") |
f300ef1bc475
Do not run LSP diagnostics while in insert mode
Zeger Van de Vannet <zegervdv@me.com>
parents:
363
diff
changeset
|
428 vim.fn.winrestview(view) |
f300ef1bc475
Do not run LSP diagnostics while in insert mode
Zeger Van de Vannet <zegervdv@me.com>
parents:
363
diff
changeset
|
429 end |
f300ef1bc475
Do not run LSP diagnostics while in insert mode
Zeger Van de Vannet <zegervdv@me.com>
parents:
363
diff
changeset
|
430 end |
f300ef1bc475
Do not run LSP diagnostics while in insert mode
Zeger Van de Vannet <zegervdv@me.com>
parents:
363
diff
changeset
|
431 |
406 | 432 vim.lsp.handlers['textDocument/publishDiagnostics'] = function(...) |
433 vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { underline = true, update_in_insert = false })(...) | |
434 end | |
319
b93f12d23fbd
Rename init.lua to config.lua
Zeger Van de Vannet <zegervdv@me.com>
parents:
diff
changeset
|
435 |
403
483c3746730f
Pass capabilities for snippet completion
Zeger Van de Vannet <zegervdv@me.com>
parents:
402
diff
changeset
|
436 local capabilities = vim.lsp.protocol.make_client_capabilities() |
483c3746730f
Pass capabilities for snippet completion
Zeger Van de Vannet <zegervdv@me.com>
parents:
402
diff
changeset
|
437 capabilities.textDocument.completion.completionItem.snippetSupport = true |
483c3746730f
Pass capabilities for snippet completion
Zeger Van de Vannet <zegervdv@me.com>
parents:
402
diff
changeset
|
438 capabilities.textDocument.completion.completionItem.resolveSupport = { |
483c3746730f
Pass capabilities for snippet completion
Zeger Van de Vannet <zegervdv@me.com>
parents:
402
diff
changeset
|
439 properties = { |
483c3746730f
Pass capabilities for snippet completion
Zeger Van de Vannet <zegervdv@me.com>
parents:
402
diff
changeset
|
440 'documentation', |
483c3746730f
Pass capabilities for snippet completion
Zeger Van de Vannet <zegervdv@me.com>
parents:
402
diff
changeset
|
441 'detail', |
483c3746730f
Pass capabilities for snippet completion
Zeger Van de Vannet <zegervdv@me.com>
parents:
402
diff
changeset
|
442 'additionalTextEdits', |
406 | 443 }, |
403
483c3746730f
Pass capabilities for snippet completion
Zeger Van de Vannet <zegervdv@me.com>
parents:
402
diff
changeset
|
444 } |
483c3746730f
Pass capabilities for snippet completion
Zeger Van de Vannet <zegervdv@me.com>
parents:
402
diff
changeset
|
445 |
483c3746730f
Pass capabilities for snippet completion
Zeger Van de Vannet <zegervdv@me.com>
parents:
402
diff
changeset
|
446 lsp.pyright.setup { on_attach = on_attach, capabilities = capabilities } |
319
b93f12d23fbd
Rename init.lua to config.lua
Zeger Van de Vannet <zegervdv@me.com>
parents:
diff
changeset
|
447 |
404
04483ffbd282
Replace efm with null-ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
403
diff
changeset
|
448 null_ls.setup { |
04483ffbd282
Replace efm with null-ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
403
diff
changeset
|
449 on_attach = on_attach, |
04483ffbd282
Replace efm with null-ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
403
diff
changeset
|
450 sources = { |
04483ffbd282
Replace efm with null-ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
403
diff
changeset
|
451 null_ls.builtins.formatting.black, |
405 | 452 null_ls.builtins.formatting.stylua, |
404
04483ffbd282
Replace efm with null-ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
403
diff
changeset
|
453 }, |
04483ffbd282
Replace efm with null-ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
403
diff
changeset
|
454 } |
332
5b166328c2fd
Use localconfig lua file to load device specific configuration
Zeger Van de Vannet <zegervdv@me.com>
parents:
331
diff
changeset
|
455 |
408
4406fc85ba0a
Add lua-language-server and lua-dev config for lua plugin development
zegervdv <zegervdv@me.com>
parents:
406
diff
changeset
|
456 local luadev = require('lua-dev').setup { |
4406fc85ba0a
Add lua-language-server and lua-dev config for lua plugin development
zegervdv <zegervdv@me.com>
parents:
406
diff
changeset
|
457 lspconfig = { |
4406fc85ba0a
Add lua-language-server and lua-dev config for lua plugin development
zegervdv <zegervdv@me.com>
parents:
406
diff
changeset
|
458 cmd = { 'lua-language-server' }, |
4406fc85ba0a
Add lua-language-server and lua-dev config for lua plugin development
zegervdv <zegervdv@me.com>
parents:
406
diff
changeset
|
459 on_attach = on_attach, |
4406fc85ba0a
Add lua-language-server and lua-dev config for lua plugin development
zegervdv <zegervdv@me.com>
parents:
406
diff
changeset
|
460 capabilities = capabilities, |
4406fc85ba0a
Add lua-language-server and lua-dev config for lua plugin development
zegervdv <zegervdv@me.com>
parents:
406
diff
changeset
|
461 settings = { |
4406fc85ba0a
Add lua-language-server and lua-dev config for lua plugin development
zegervdv <zegervdv@me.com>
parents:
406
diff
changeset
|
462 Lua = { |
4406fc85ba0a
Add lua-language-server and lua-dev config for lua plugin development
zegervdv <zegervdv@me.com>
parents:
406
diff
changeset
|
463 diagnostics = { |
4406fc85ba0a
Add lua-language-server and lua-dev config for lua plugin development
zegervdv <zegervdv@me.com>
parents:
406
diff
changeset
|
464 globals = { 'use' }, |
4406fc85ba0a
Add lua-language-server and lua-dev config for lua plugin development
zegervdv <zegervdv@me.com>
parents:
406
diff
changeset
|
465 }, |
4406fc85ba0a
Add lua-language-server and lua-dev config for lua plugin development
zegervdv <zegervdv@me.com>
parents:
406
diff
changeset
|
466 }, |
4406fc85ba0a
Add lua-language-server and lua-dev config for lua plugin development
zegervdv <zegervdv@me.com>
parents:
406
diff
changeset
|
467 }, |
4406fc85ba0a
Add lua-language-server and lua-dev config for lua plugin development
zegervdv <zegervdv@me.com>
parents:
406
diff
changeset
|
468 }, |
4406fc85ba0a
Add lua-language-server and lua-dev config for lua plugin development
zegervdv <zegervdv@me.com>
parents:
406
diff
changeset
|
469 } |
4406fc85ba0a
Add lua-language-server and lua-dev config for lua plugin development
zegervdv <zegervdv@me.com>
parents:
406
diff
changeset
|
470 |
4406fc85ba0a
Add lua-language-server and lua-dev config for lua plugin development
zegervdv <zegervdv@me.com>
parents:
406
diff
changeset
|
471 lsp.sumneko_lua.setup(luadev) |
4406fc85ba0a
Add lua-language-server and lua-dev config for lua plugin development
zegervdv <zegervdv@me.com>
parents:
406
diff
changeset
|
472 |
332
5b166328c2fd
Use localconfig lua file to load device specific configuration
Zeger Van de Vannet <zegervdv@me.com>
parents:
331
diff
changeset
|
473 -- Try importing local config |
5b166328c2fd
Use localconfig lua file to load device specific configuration
Zeger Van de Vannet <zegervdv@me.com>
parents:
331
diff
changeset
|
474 local ok, localconfig = pcall(require, 'localconfig') |
406 | 475 if ok then |
476 localconfig.setup { on_attach = on_attach, capabilities = capabilities } | |
477 end |