Mercurial > dotfiles
annotate dot_config/nvim/config.lua @ 384:a8231e54e6b1
Add patience algorithm for diffs
author | zegervdv <zegervdv@me.com> |
---|---|
date | Fri, 23 Apr 2021 09:35:34 +0200 |
parents | 41a8b9f51e05 |
children | b89d28b33253 |
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 |
380 | 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 |
325
ce396166d009
Move packer setup in a function, load on demand
zegervdv <zegervdv@me.com>
parents:
324
diff
changeset
|
15 -- Packer configuration is compiled and only needs to be loaded on changes |
380 | 16 vim.cmd 'packadd packer.nvim' |
325
ce396166d009
Move packer setup in a function, load on demand
zegervdv <zegervdv@me.com>
parents:
324
diff
changeset
|
17 |
372 | 18 require('packer').startup(function() |
380 | 19 use { 'wbthomason/packer.nvim', opt = true } |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
20 |
372 | 21 -- General plugins |
380 | 22 use { 'tpope/vim-sensible' } |
23 use { 'tpope/vim-repeat' } | |
24 use { 'tpope/vim-rsi' } | |
25 use { 'sgur/vim-editorconfig' } | |
26 use { 'ShikChen/osc52.vim' } | |
27 use { 'einfachtoll/didyoumean' } | |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
28 |
380 | 29 use { 'tpope/vim-obsession' } |
372 | 30 use { |
31 'tpope/vim-eunuch', | |
32 cmd = { | |
33 'Remove', | |
34 'Unlink', | |
35 'Move', | |
36 'Rename', | |
37 'Mkdir', | |
38 'Chmod', | |
39 'Find', | |
40 'Locate', | |
41 'SudoEdit', | |
380 | 42 'SudoWrite', |
43 }, | |
372 | 44 } |
325
ce396166d009
Move packer setup in a function, load on demand
zegervdv <zegervdv@me.com>
parents:
324
diff
changeset
|
45 |
380 | 46 use { 'psliwka/vim-smoothie' } |
372 | 47 |
48 -- Spelling/autocorrection | |
380 | 49 use { 'tpope/vim-abolish' } |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
50 |
372 | 51 -- Git/VCS |
380 | 52 use { 'vim-scripts/gitignore' } |
53 use { 'sjl/splice.vim', opt = true, cmd = { 'SpliceInit' } } | |
54 use { 'tpope/vim-git' } | |
372 | 55 |
56 -- Comments | |
380 | 57 use { 'b3nj5m1n/kommentary' } |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
58 |
372 | 59 -- Undoing |
380 | 60 use { 'sjl/gundo.vim', cmd = { 'GundoToggle' } } |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
61 |
372 | 62 -- Parentheses etc |
380 | 63 use { 'tpope/vim-surround' } |
64 use { 'raimondi/delimitMate' } | |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
65 |
372 | 66 -- Moving around within lines |
380 | 67 use { 'wellle/targets.vim', event = 'InsertEnter *' } |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
68 |
372 | 69 -- Peek at lines |
380 | 70 use { 'nacro90/numb.nvim', config = function() require'numb'.setup() end } |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
71 |
372 | 72 -- Searching |
380 | 73 use { 'mhinz/vim-grepper', cmd = { 'Grepper' } } |
325
ce396166d009
Move packer setup in a function, load on demand
zegervdv <zegervdv@me.com>
parents:
324
diff
changeset
|
74 |
372 | 75 -- Keymaps TODO: to be removed when #13823 is merged |
380 | 76 use { 'tjdevries/astronauta.nvim', config = function() require 'astronauta.keymap' end } |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
77 |
372 | 78 -- Indent lines |
79 use { | |
80 'lukas-reineke/indent-blankline.nvim', | |
81 branch = 'lua', | |
380 | 82 config = function() |
83 vim.g.indent_blankline_buftype_exclude = { 'terminal', 'help', 'nofile' } | |
372 | 84 vim.g.indent_blankline_show_first_indent_level = false |
85 end, | |
86 } | |
371
1dfda47d5d9e
Add more lua based plugins: lush, navigator, numb
zegervdv <zegervdv@me.com>
parents:
370
diff
changeset
|
87 |
372 | 88 -- Increment/decrement |
89 use { | |
90 'zegervdv/nrpattern.nvim', | |
91 requires = 'tpope/vim-repeat', | |
380 | 92 config = function() |
93 local nrpattern = require 'nrpattern' | |
94 local defaults = require 'nrpattern.default' | |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
95 |
380 | 96 defaults[{ 'input', 'output' }] = |
97 { priority = 12, filetypes = { 'verilog', 'systemverilog' } } | |
98 defaults[{ '\'1', '\'0' }] = { priority = 9, filetypes = { 'verilog', 'systemverilog' } } | |
372 | 99 |
100 nrpattern.setup(defaults) | |
101 end, | |
102 } | |
362 | 103 |
372 | 104 -- Tmux |
380 | 105 function test_tmux() return os.getenv('TMUX') ~= nil end |
106 use { 'tmux-plugins/vim-tmux-focus-events', cond = test_tmux } | |
372 | 107 use { |
108 'numtostr/navigator.nvim', | |
109 config = function() | |
110 require('Navigator').setup { auto_save = 'current', disable_on_zoom = true } | |
362 | 111 |
372 | 112 local nnoremap = vim.keymap.nnoremap |
113 nnoremap { '<c-h>', require'Navigator'.left, silent = true } | |
114 nnoremap { '<c-j>', require'Navigator'.down, silent = true } | |
115 nnoremap { '<c-k>', require'Navigator'.up, silent = true } | |
116 nnoremap { '<c-l>', require'Navigator'.right, silent = true } | |
117 end, | |
380 | 118 requires = 'tjdevries/astronauta.nvim', |
372 | 119 } |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
120 |
372 | 121 -- Completion/snippets/LSP |
380 | 122 use { 'neovim/nvim-lspconfig' } |
372 | 123 use { |
124 'hrsh7th/nvim-compe', | |
380 | 125 config = function() |
372 | 126 require'compe'.setup { |
380 | 127 enabled = true, |
128 autocomplete = true, | |
129 debug = false, | |
130 min_length = 1, | |
131 preselect = 'enable', | |
132 throttle_time = 80, | |
133 source_timeout = 1000, | |
134 incomplete_delay = 400, | |
135 max_abbr_width = 100, | |
136 max_kind_width = 100, | |
137 max_menu_width = 100, | |
138 documentation = true, | |
346
d717168f424f
Switch to nvim-compe for completion
zegervdv <zegervdv@me.com>
parents:
345
diff
changeset
|
139 |
372 | 140 source = { |
380 | 141 path = true, |
142 buffer = true, | |
143 nvim_lsp = true, | |
144 nvim_lua = true, | |
145 spell = true, | |
146 ultisnips = true, | |
372 | 147 -- TODO add vsnip for LSP snippets |
380 | 148 }, |
372 | 149 } |
346
d717168f424f
Switch to nvim-compe for completion
zegervdv <zegervdv@me.com>
parents:
345
diff
changeset
|
150 |
372 | 151 vim.cmd [[ inoremap <silent><expr> <C-y> compe#complete() ]] |
152 vim.cmd [[ inoremap <silent><expr> <CR> compe#confirm({ 'keys': "\<Plug>delimitMateCR", 'mode': '' }) ]] | |
153 vim.cmd [[ inoremap <silent><expr> <C-e> compe#close('<C-e>') ]] | |
380 | 154 end, |
372 | 155 } |
156 use { | |
157 { | |
158 'nvim-treesitter/nvim-treesitter', | |
380 | 159 config = function() |
160 require 'nvim-treesitter.highlight' | |
370
5ffb0fd7b98d
Move treesitter config into packer_compiled
zegervdv <zegervdv@me.com>
parents:
368
diff
changeset
|
161 |
372 | 162 require'nvim-treesitter.configs'.setup { |
380 | 163 highlight = { enable = false }, |
372 | 164 incremental_selection = { |
165 enable = true, | |
166 keymaps = { | |
380 | 167 init_selection = 'gnn', |
168 node_incremental = 'grn', | |
169 scope_incremental = 'grc', | |
170 node_decremental = 'grm', | |
171 }, | |
372 | 172 }, |
173 refactor = { | |
174 highlight_definitions = { enable = true }, | |
380 | 175 smart_rename = { enable = true, keymaps = { smart_rename = 'gsr' } }, |
372 | 176 navigation = { |
177 enable = true, | |
380 | 178 keymaps = { goto_definition = 'gnd', list_definitions = 'gnD' }, |
370
5ffb0fd7b98d
Move treesitter config into packer_compiled
zegervdv <zegervdv@me.com>
parents:
368
diff
changeset
|
179 }, |
372 | 180 }, |
181 textobjects = { | |
182 move = { | |
183 enable = true, | |
380 | 184 goto_next_start = { [']]'] = '@block.outer' }, |
185 goto_previous_start = { ['[['] = '@block.outer' }, | |
186 goto_next_end = { [']['] = '@block.outer' }, | |
187 goto_previous_end = { ['[]'] = '@block.outer' }, | |
370
5ffb0fd7b98d
Move treesitter config into packer_compiled
zegervdv <zegervdv@me.com>
parents:
368
diff
changeset
|
188 }, |
361 | 189 }, |
380 | 190 playground = { enable = true, disable = {}, updatetime = 25, persist_queries = false }, |
361 | 191 } |
380 | 192 end, |
372 | 193 }, |
194 'nvim-treesitter/nvim-treesitter-refactor', | |
195 'nvim-treesitter/nvim-treesitter-textobjects', | |
380 | 196 { 'nvim-treesitter/playground', opt = true }, |
372 | 197 } |
380 | 198 use { 'SirVer/ultisnips' } |
199 use { 'glepnir/lspsaga.nvim', config = function() require'lspsaga'.init_lsp_saga {} end } | |
361 | 200 |
372 | 201 -- Vanity |
202 use { | |
203 'yamatsum/nvim-web-nonicons', | |
204 requires = 'kyazdani42/nvim-web-devicons', | |
380 | 205 config = function() require 'nvim-nonicons' end, |
372 | 206 } |
361 | 207 |
372 | 208 use { |
209 'glepnir/galaxyline.nvim', | |
210 branch = 'main', | |
211 -- your statusline | |
380 | 212 config = function() |
213 local gl = require 'galaxyline' | |
372 | 214 local colors = require('galaxyline.theme').default |
215 local condition = require('galaxyline.condition') | |
216 local gls = gl.section | |
217 | |
218 colors.bg = '#2C323C' | |
361 | 219 |
372 | 220 gls.left[1] = { |
221 RainbowRed = { | |
222 provider = function() return '▊ ' end, | |
380 | 223 highlight = { colors.blue, colors.bg }, |
372 | 224 }, |
225 } | |
226 | |
227 gls.left[2] = { | |
228 FileIcon = { | |
229 provider = 'FileIcon', | |
230 condition = condition.buffer_not_empty, | |
380 | 231 highlight = { require('galaxyline.provider_fileinfo').get_file_icon_color, colors.bg }, |
372 | 232 }, |
233 } | |
361 | 234 |
372 | 235 gls.left[3] = { |
236 FileName = { | |
237 provider = 'FileName', | |
238 condition = condition.buffer_not_empty, | |
380 | 239 highlight = { colors.magenta, colors.bg, 'bold' }, |
240 }, | |
372 | 241 } |
242 | |
243 gls.left[4] = { | |
244 DiagnosticError = { | |
245 provider = 'DiagnosticError', | |
246 icon = ' ', | |
380 | 247 highlight = { colors.red, colors.bg }, |
248 }, | |
372 | 249 } |
361 | 250 |
372 | 251 gls.right[1] = { |
252 ShowLspClient = { | |
253 provider = 'GetLspClient', | |
380 | 254 condition = function() |
255 local tbl = { ['dashboard'] = true, [''] = true } | |
256 if tbl[vim.bo.filetype] then return false end | |
372 | 257 return true |
258 end, | |
259 icon = require'nvim-nonicons'.get('server') .. ' LSP:', | |
380 | 260 highlight = { colors.green, colors.bg, 'bold' }, |
261 }, | |
372 | 262 } |
361 | 263 |
372 | 264 gls.right[2] = { |
265 LineInfo = { | |
266 provider = 'LineColumn', | |
267 separator = ' ', | |
380 | 268 separator_highlight = { 'NONE', colors.bg }, |
269 highlight = { colors.fg, colors.bg }, | |
372 | 270 }, |
271 } | |
361 | 272 |
372 | 273 gls.right[3] = { |
274 PerCent = { | |
275 provider = 'LinePercent', | |
276 separator = ' ', | |
380 | 277 separator_highlight = { 'NONE', colors.bg }, |
278 highlight = { colors.fg, colors.bg, 'bold' }, | |
279 }, | |
372 | 280 } |
281 gls.right[8] = { | |
282 RainbowBlue = { | |
283 provider = function() return ' ▊' end, | |
380 | 284 highlight = { colors.blue, colors.bg }, |
372 | 285 }, |
286 } | |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
287 |
372 | 288 gls.short_line_left[1] = { |
289 BufferType = { | |
290 provider = 'FileTypeName', | |
291 separator = ' ', | |
380 | 292 separator_highlight = { 'NONE', colors.bg }, |
293 highlight = { colors.blue, colors.bg, 'bold' }, | |
294 }, | |
372 | 295 } |
296 | |
297 gls.short_line_left[2] = { | |
298 SFileName = { | |
380 | 299 provider = 'SFileName', |
372 | 300 condition = condition.buffer_not_empty, |
380 | 301 highlight = { colors.fg, colors.bg, 'bold' }, |
302 }, | |
372 | 303 } |
325
ce396166d009
Move packer setup in a function, load on demand
zegervdv <zegervdv@me.com>
parents:
324
diff
changeset
|
304 |
372 | 305 gls.short_line_right[1] = { |
380 | 306 BufferIcon = { provider = 'BufferIcon', highlight = { colors.fg, colors.bg } }, |
372 | 307 } |
308 end, | |
309 } | |
310 | |
311 -- File navigation | |
380 | 312 use { 'justinmk/vim-dirvish' } |
338
890fe7d01f19
Use toggleterm as more robust terminal integration
zegervdv <zegervdv@me.com>
parents:
337
diff
changeset
|
313 |
372 | 314 -- Colorscheme |
315 use { | |
316 'zegervdv/one-lush', | |
317 requires = 'rktjmp/lush.nvim', | |
318 config = function() | |
381 | 319 require 'lush_theme.one-lush' |
320 vim.cmd [[ colorscheme one-lush ]] | |
372 | 321 end, |
322 } | |
324
64a0c6cec54c
Use packer for plugin management in lua
zegervdv <zegervdv@me.com>
parents:
323
diff
changeset
|
323 |
372 | 324 -- Terminal |
325 use { | |
326 'akinsho/nvim-toggleterm.lua', | |
327 config = function() | |
328 require'toggleterm'.setup { | |
381 | 329 size = 15, |
372 | 330 open_mapping = [[<F12>]], |
381 | 331 shade_filetypes = { 'none' }, |
372 | 332 shade_terminals = true, |
333 persist_size = true, | |
334 direction = 'horizontal', | |
335 } | |
336 end, | |
337 } | |
336
7a8b66395d69
Add floating terminal to be toggled via c-z
zegervdv <zegervdv@me.com>
parents:
335
diff
changeset
|
338 |
372 | 339 -- Filetypes |
380 | 340 use { 'Glench/Vim-Jinja2-Syntax' } |
372 | 341 |
342 end) | |
343 | |
344 -- LSP config | |
380 | 345 local lsp = require 'lspconfig' |
346 local lsputil = require 'lspconfig.util' | |
319
b93f12d23fbd
Rename init.lua to config.lua
Zeger Van de Vannet <zegervdv@me.com>
parents:
diff
changeset
|
347 |
b93f12d23fbd
Rename init.lua to config.lua
Zeger Van de Vannet <zegervdv@me.com>
parents:
diff
changeset
|
348 local on_attach = function(client) |
372 | 349 local nnoremap = vim.keymap.nnoremap |
350 local inoremap = vim.keymap.inoremap | |
380 | 351 nnoremap { '<CR>', require'lspsaga.diagnostic'.show_line_diagnostics, silent = true } |
352 nnoremap { 'gd', vim.lsp.buf.declaration, silent = true } | |
353 nnoremap { '<c-]>', vim.lsp.buf.definition, silent = true } | |
354 nnoremap { 'K', require'lspsaga.hover'.render_hover_doc, silent = true } | |
355 nnoremap { 'gD', vim.lsp.buf.implementation, silent = true } | |
356 nnoremap { '1gD', vim.lsp.buf.type_definition, silent = true } | |
357 nnoremap { 'gr', vim.lsp.buf.references, silent = true } | |
358 nnoremap { 'g0', vim.lsp.buf.document_symbol, silent = true } | |
359 nnoremap { '<c-p>', vim.lsp.buf.formatting, silent = true } | |
360 nnoremap { 'gp', require'lspsaga.provider'.preview_definition, silent = true } | |
372 | 361 |
380 | 362 inoremap { '<c-l>', vim.lsp.buf.signature_help, silent = true } |
382 | 363 |
364 vim.cmd [[ sign define LspDiagnosticsSignError text=▊ texthl=LspDiagnosticsSignError linehl= numhl= ]] | |
365 vim.cmd [[ sign define LspDiagnosticsSignWarning text=▊ texthl=LspDiagnosticsSignWarning linehl= numhl= ]] | |
366 vim.cmd [[ sign define LspDiagnosticsSignInformation text=▊ texthl=LspDiagnosticsSignInformation linehl= numhl= ]] | |
367 vim.cmd [[ sign define LspDiagnosticsSignHint text=▊ texthl=LspDiagnosticsSignHint linehl= numhl= ]] | |
319
b93f12d23fbd
Rename init.lua to config.lua
Zeger Van de Vannet <zegervdv@me.com>
parents:
diff
changeset
|
368 end |
b93f12d23fbd
Rename init.lua to config.lua
Zeger Van de Vannet <zegervdv@me.com>
parents:
diff
changeset
|
369 |
380 | 370 vim.lsp.handlers['textDocument/formatting'] = function(err, _, result, _, bufnr) |
371 if err ~= nil or result == nil then return end | |
372 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
|
373 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
|
374 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
|
375 -- 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
|
376 -- 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
|
377 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
|
378 end |
f300ef1bc475
Do not run LSP diagnostics while in insert mode
Zeger Van de Vannet <zegervdv@me.com>
parents:
363
diff
changeset
|
379 end |
f300ef1bc475
Do not run LSP diagnostics while in insert mode
Zeger Van de Vannet <zegervdv@me.com>
parents:
363
diff
changeset
|
380 |
380 | 381 vim.lsp.handlers['textDocument/publishDiagnostics'] = |
382 function(...) | |
383 vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, | |
384 { underline = true, update_in_insert = false })(...) | |
385 end | |
319
b93f12d23fbd
Rename init.lua to config.lua
Zeger Van de Vannet <zegervdv@me.com>
parents:
diff
changeset
|
386 |
380 | 387 lsp.pyright.setup { on_attach = on_attach } |
319
b93f12d23fbd
Rename init.lua to config.lua
Zeger Van de Vannet <zegervdv@me.com>
parents:
diff
changeset
|
388 |
b93f12d23fbd
Rename init.lua to config.lua
Zeger Van de Vannet <zegervdv@me.com>
parents:
diff
changeset
|
389 if (vim.fn.executable('efm-langserver') == 1) then |
323
3b25f3aa7014
Use efm folders to store efm configuration per language
zegervdv <zegervdv@me.com>
parents:
322
diff
changeset
|
390 require 'efm/python' |
379 | 391 require 'efm/lua' |
322
deb606f02fc4
Test if flake8, black are available before adding
zegervdv <zegervdv@me.com>
parents:
321
diff
changeset
|
392 |
323
3b25f3aa7014
Use efm folders to store efm configuration per language
zegervdv <zegervdv@me.com>
parents:
322
diff
changeset
|
393 -- May not be installed, use pcall to handle errors |
368
72e8dd5a4ab5
Clean up LSP peek functions
Zeger Van de Vannet <zegervdv@me.com>
parents:
367
diff
changeset
|
394 -- pcall(require, 'efm/systemverilog') |
327 | 395 pcall(require, 'efm/flp') |
323
3b25f3aa7014
Use efm folders to store efm configuration per language
zegervdv <zegervdv@me.com>
parents:
322
diff
changeset
|
396 |
380 | 397 local language_cfg = require 'efm/languages' |
322
deb606f02fc4
Test if flake8, black are available before adding
zegervdv <zegervdv@me.com>
parents:
321
diff
changeset
|
398 |
367
f0a89299e854
Enable EFM only on selected filetypes
zegervdv <zegervdv@me.com>
parents:
366
diff
changeset
|
399 local filetypes = {} |
380 | 400 for lang, _ in pairs(language_cfg) do table.insert(filetypes, lang) end |
367
f0a89299e854
Enable EFM only on selected filetypes
zegervdv <zegervdv@me.com>
parents:
366
diff
changeset
|
401 |
380 | 402 lsp.efm.setup { |
367
f0a89299e854
Enable EFM only on selected filetypes
zegervdv <zegervdv@me.com>
parents:
366
diff
changeset
|
403 on_attach = on_attach, |
f0a89299e854
Enable EFM only on selected filetypes
zegervdv <zegervdv@me.com>
parents:
366
diff
changeset
|
404 filetypes = filetypes, |
380 | 405 init_options = { documentFormatting = true }, |
367
f0a89299e854
Enable EFM only on selected filetypes
zegervdv <zegervdv@me.com>
parents:
366
diff
changeset
|
406 root_dir = lsputil.root_pattern('.git', '.hg'), |
380 | 407 settings = { rootMarkers = { '.git/', '.hg/' }, languages = language_cfg }, |
319
b93f12d23fbd
Rename init.lua to config.lua
Zeger Van de Vannet <zegervdv@me.com>
parents:
diff
changeset
|
408 } |
b93f12d23fbd
Rename init.lua to config.lua
Zeger Van de Vannet <zegervdv@me.com>
parents:
diff
changeset
|
409 end |
332
5b166328c2fd
Use localconfig lua file to load device specific configuration
Zeger Van de Vannet <zegervdv@me.com>
parents:
331
diff
changeset
|
410 |
5b166328c2fd
Use localconfig lua file to load device specific configuration
Zeger Van de Vannet <zegervdv@me.com>
parents:
331
diff
changeset
|
411 -- 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
|
412 local ok, localconfig = pcall(require, 'localconfig') |
380 | 413 if ok then localconfig.setup { on_attach = on_attach } end |