Move to nvim-compe for completion
parent
11a9ac9f30
commit
189bf63bde
|
@ -69,8 +69,7 @@ return require('packer').startup {
|
||||||
-- LSP --
|
-- LSP --
|
||||||
use 'neovim/nvim-lspconfig' -- Easy LSP Config
|
use 'neovim/nvim-lspconfig' -- Easy LSP Config
|
||||||
use 'alexaandru/nvim-lspupdate' -- Easy install and update for many LSP servers
|
use 'alexaandru/nvim-lspupdate' -- Easy install and update for many LSP servers
|
||||||
use 'nvim-lua/completion-nvim' -- LSP completion integration
|
use 'hrsh7th/nvim-compe' -- LSP completion integration
|
||||||
use 'nvim-treesitter/completion-treesitter' -- Treesitter completion integration
|
|
||||||
use 'nvim-lua/lsp_extensions.nvim' -- LSP extensions (like closing labels for Dart)
|
use 'nvim-lua/lsp_extensions.nvim' -- LSP extensions (like closing labels for Dart)
|
||||||
|
|
||||||
-- LSP language specific
|
-- LSP language specific
|
||||||
|
|
|
@ -1,13 +1,40 @@
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
-- - LSP completion config -
|
-- - LSP completion config -
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
-- Use <Tab> and <S-Tab> to navigate through popup menu
|
|
||||||
|
|
||||||
-- Set completeopt to have a better completion experience
|
-- Set completeopt to have a better completion experience
|
||||||
vim.o.completeopt = "menuone,noinsert,noselect"
|
vim.o.completeopt = "menuone,noselect"
|
||||||
-- Avoid showing message extra message when using completion
|
|
||||||
vim.cmd('set shortmess+=c')
|
require'compe'.setup {
|
||||||
vim.cmd("autocmd BufEnter * lua require'completion'.on_attach()")
|
enabled = true;
|
||||||
vim.g.completion_matching_strategy_list = {'exact', 'substring', 'fuzzy'}
|
autocomplete = true;
|
||||||
vim.g.completion_confirm_key = '<C-y>'
|
debug = false;
|
||||||
vim.g.completion_enable_snippet = 'UltiSnips'
|
min_length = 1;
|
||||||
|
preselect = 'enable';
|
||||||
|
throttle_time = 80;
|
||||||
|
source_timeout = 200;
|
||||||
|
incomplete_delay = 400;
|
||||||
|
max_abbr_width = 100;
|
||||||
|
max_kind_width = 100;
|
||||||
|
max_menu_width = 100;
|
||||||
|
documentation = true;
|
||||||
|
|
||||||
|
source = {
|
||||||
|
path = true;
|
||||||
|
buffer = true;
|
||||||
|
calc = true;
|
||||||
|
nvim_lsp = true;
|
||||||
|
nvim_lua = true;
|
||||||
|
ultisnips = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
local function set_keymap(...) vim.api.nvim_set_keymap(...) end
|
||||||
|
|
||||||
|
local default_opts = {noremap = true, silent = true, expr = true}
|
||||||
|
|
||||||
|
set_keymap('i', '<C-Space>', 'compe#complete()', default_opts)
|
||||||
|
set_keymap('i', '<C-y>', "compe#confirm('<C-y>')", default_opts)
|
||||||
|
set_keymap('i', '<C-e>', "compe#close('<C-e>')", default_opts)
|
||||||
|
set_keymap('i', '<C-f>', "compe#scroll({ 'delta': +4 })", default_opts)
|
||||||
|
set_keymap('i', '<C-d>', "compe#scroll({ 'delta': -4 })", default_opts)
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
local on_attach = function(client, bufnr)
|
local on_attach = function(client, bufnr)
|
||||||
require'completion'.on_attach()
|
|
||||||
|
|
||||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||||
|
|
||||||
|
@ -24,11 +22,6 @@ local on_attach = function(client, bufnr)
|
||||||
buf_set_keymap('n', '<A-CR>', '<cmd>lua vim.lsp.buf.code_action()<CR>', default_opts)
|
buf_set_keymap('n', '<A-CR>', '<cmd>lua vim.lsp.buf.code_action()<CR>', default_opts)
|
||||||
buf_set_keymap('n', '<Leader>ac', '<cmd>lua vim.lsp.buf.code_action()<CR>', default_opts)
|
buf_set_keymap('n', '<Leader>ac', '<cmd>lua vim.lsp.buf.code_action()<CR>', default_opts)
|
||||||
buf_set_keymap('n', '<Leader>a', '<cmd>lua vim.lsp.buf.code_action_range()<CR>', default_opts)
|
buf_set_keymap('n', '<Leader>a', '<cmd>lua vim.lsp.buf.code_action_range()<CR>', default_opts)
|
||||||
|
|
||||||
local completion_opts = {silent = true}
|
|
||||||
|
|
||||||
-- Completion keymaps
|
|
||||||
buf_set_keymap('i', '<C-n>', '<Plug>(completion_trigger)', completion_opts)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Lsp default language servers
|
-- Lsp default language servers
|
||||||
|
|
Loading…
Reference in New Issue