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