Mercurial > dotfiles
comparison dot_config/nvim/config.lua @ 346:d717168f424f
Switch to nvim-compe for completion
author | zegervdv <zegervdv@me.com> |
---|---|
date | Thu, 04 Feb 2021 18:27:39 +0100 |
parents | 9360c61c5732 |
children | 3d01318e4743 |
comparison
equal
deleted
inserted
replaced
345:9360c61c5732 | 346:d717168f424f |
---|---|
83 use {'tmux-plugins/vim-tmux-focus-events', cond = test_tmux} | 83 use {'tmux-plugins/vim-tmux-focus-events', cond = test_tmux} |
84 | 84 |
85 -- Completion/snippets/LSP | 85 -- Completion/snippets/LSP |
86 use {'neovim/nvim-lspconfig'} | 86 use {'neovim/nvim-lspconfig'} |
87 use { | 87 use { |
88 'nvim-lua/completion-nvim', | 88 'hrsh7th/nvim-compe', |
89 'steelsojka/completion-buffers' | 89 config = function () |
90 require'compe'.setup { | |
91 enabled = true; | |
92 autocomplete = true; | |
93 debug = false; | |
94 min_length = 1; | |
95 preselect = 'enable'; | |
96 throttle_time = 80; | |
97 source_timeout = 200; | |
98 incomplete_delay = 400; | |
99 max_abbr_width = 100; | |
100 max_kind_width = 100; | |
101 max_menu_width = 100; | |
102 | |
103 source = { | |
104 path = true; | |
105 buffer = true; | |
106 calc = true; | |
107 -- vsnip = true; | |
108 nvim_lsp = true; | |
109 -- nvim_lua = true; | |
110 spell = true; | |
111 ultisnips = true; | |
112 -- tags = true; | |
113 -- snippets_nvim = true; | |
114 }; | |
115 } | |
116 | |
117 vim.cmd [[ inoremap <silent><expr> <TAB> compe#complete() ]] | |
118 vim.cmd [[ inoremap <silent><expr> <CR> compe#confirm({ 'keys': "\<Plug>delimitMateCR", 'mode': '' }) ]] | |
119 vim.cmd [[ inoremap <silent><expr> <C-e> compe#close('<C-e>') ]] | |
120 end | |
90 } | 121 } |
91 use { | 122 use { |
92 'nvim-treesitter/nvim-treesitter', | 123 'nvim-treesitter/nvim-treesitter', |
93 'nvim-treesitter/nvim-treesitter-refactor', | 124 'nvim-treesitter/nvim-treesitter-refactor', |
94 'nvim-treesitter/nvim-treesitter-textobjects', | 125 'nvim-treesitter/nvim-treesitter-textobjects', |
266 local params = vim.lsp.util.make_position_params() | 297 local params = vim.lsp.util.make_position_params() |
267 return vim.lsp.buf_request(0, 'textDocument/implementation', params, preview_location_callback) | 298 return vim.lsp.buf_request(0, 'textDocument/implementation', params, preview_location_callback) |
268 end | 299 end |
269 | 300 |
270 local on_attach = function(client) | 301 local on_attach = function(client) |
271 require'completion'.on_attach({ | |
272 sorting = 'alphabet', | |
273 matching_strategy_list = {'exact', 'fuzzy'}, | |
274 chain_complete_list = chain_complete_list, | |
275 }) | |
276 | |
277 mapper('n', '<CR>', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics({show_header=false})<CR>') | 302 mapper('n', '<CR>', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics({show_header=false})<CR>') |
278 mapper('n', 'gd', '<cmd>lua vim.lsp.buf.declaration()<CR>') | 303 mapper('n', 'gd', '<cmd>lua vim.lsp.buf.declaration()<CR>') |
279 mapper('n', '<c-]>', '<cmd>lua vim.lsp.buf.definition()<CR>') | 304 mapper('n', '<c-]>', '<cmd>lua vim.lsp.buf.definition()<CR>') |
280 mapper('n', 'K', '<cmd>lua require"lspsaga.hover".render_hover_doc()<CR>') | 305 mapper('n', 'K', '<cmd>lua require"lspsaga.hover".render_hover_doc()<CR>') |
281 mapper('n', 'gD', '<cmd>lua vim.lsp.buf.implementation()<CR>') | 306 mapper('n', 'gD', '<cmd>lua vim.lsp.buf.implementation()<CR>') |
284 mapper('n', 'tgr', "<cmd>lua require'telescope.builtin'.lsp_references()<CR>") | 309 mapper('n', 'tgr', "<cmd>lua require'telescope.builtin'.lsp_references()<CR>") |
285 mapper('n', 'g0', '<cmd>lua vim.lsp.buf.document_symbol()<CR>') | 310 mapper('n', 'g0', '<cmd>lua vim.lsp.buf.document_symbol()<CR>') |
286 mapper('i', '<c-l>', '<cmd>lua vim.lsp.buf.signature_help()<CR>') | 311 mapper('i', '<c-l>', '<cmd>lua vim.lsp.buf.signature_help()<CR>') |
287 mapper('n', '<leader>f', '<cmd>lua vim.lsp.buf.code_action()<CR>') | 312 mapper('n', '<leader>f', '<cmd>lua vim.lsp.buf.code_action()<CR>') |
288 mapper('n', '<c-p>', '<cmd>lua vim.lsp.buf.formatting()<CR>') | 313 mapper('n', '<c-p>', '<cmd>lua vim.lsp.buf.formatting()<CR>') |
289 mapper("i", "<c-n>", "<Plug>(completion_trigger)", false) | |
290 mapper("i", "<c-j>", "<Plug>(completion_next_source)", false) | |
291 mapper("i", "<c-k>", "<Plug>(completion_prev_source)", false) | |
292 mapper("n", "gp", "<cmd>lua peek_definition()<CR>") | 314 mapper("n", "gp", "<cmd>lua peek_definition()<CR>") |
293 -- mapper("n", "gp", "<cmd>lua require'lspsaga.provider'.preview_definition()<CR>") | 315 -- mapper("n", "gp", "<cmd>lua require'lspsaga.provider'.preview_definition()<CR>") |
294 end | 316 end |
295 | 317 |
296 | 318 |