Replace completion engine to nvim-cmp

This commit is contained in:
Kevin Cotugno 2022-08-08 08:12:48 -07:00
parent e42b26426d
commit 4eb6fe9284

View File

@ -13,7 +13,14 @@ Plug 'fatih/vim-go'
Plug 'gabesoft/vim-ags' Plug 'gabesoft/vim-ags'
Plug 'google/protobuf' Plug 'google/protobuf'
Plug 'hashivim/vim-terraform' Plug 'hashivim/vim-terraform'
Plug 'hrsh7th/nvim-compe' Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-calc'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-nvim-lua'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/vim-vsnip'
Plug 'junegunn/fzf' Plug 'junegunn/fzf'
Plug 'kchmck/vim-coffee-script' Plug 'kchmck/vim-coffee-script'
Plug 'lifepillar/vim-solarized8' Plug 'lifepillar/vim-solarized8'
@ -33,7 +40,6 @@ call plug#end()
" vim-plug---END " vim-plug---END
" Solarized " Solarized
syntax enable syntax enable
set termguicolors set termguicolors
@ -264,6 +270,8 @@ let g:tagbar_type_go = {
\ 'ctagsargs' : '-sort -silent' \ 'ctagsargs' : '-sort -silent'
\ } \ }
set completeopt=menu,menuone,noselect
lua <<EOF lua <<EOF
local on_attach = function(client, bufnr) local on_attach = function(client, bufnr)
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
@ -291,42 +299,53 @@ local on_attach = function(client, bufnr)
buf_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts) buf_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
buf_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts) buf_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts) buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
end end
vim.o.completeopt = "menuone,noselect" local cmp = require'cmp'
require'compe'.setup {
enabled = true; local sources = {
autocomplete = true; { name = 'nvim_lsp' },
debug = false; { name = 'nvim_lua' },
min_length = 1; { name = 'buffer' },
preselect = 'enable'; }
throttle_time = 80;
source_timeout = 200; cmp.setup({
resolve_timeout = 800; snippet = {
incomplete_delay = 400; expand = function(args)
max_abbr_width = 100; vim.fn["vsnip#anonymous"](args.body)
max_kind_width = 100; end,
max_menu_width = 100; },
documentation = true; mapping = cmp.mapping.preset.insert({
source = { ['<C-f>'] = cmp.mapping.scroll_docs(4),
path = true; ['<CR>'] = cmp.mapping.confirm({ select = true }),
buffer = true; }),
calc = true; sources = cmp.config.sources(sources),
nvim_lsp = true; })
nvim_lua = true;
vsnip = true; local capabilities = vim.lsp.protocol.make_client_capabilities()
luasnip = true; capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
};
};
require'lspconfig'.gopls.setup{ require'lspconfig'.gopls.setup{
on_attach = on_attach on_attach = on_attach,
capabilities = capabilities,
} }
require'lspconfig'.solargraph.setup{ require'lspconfig'.solargraph.setup{
on_attach = on_attach; on_attach = on_attach,
bundlerPath = 'bin/bundle'; bundlerPath = 'bin/bundle',
useBundler = true; useBundler = true,
capabilities = capabilities,
} }
require'lspconfig'.rust_analyzer.setup{ require'lspconfig'.rust_analyzer.setup{
on_attach = on_attach on_attach = on_attach,
capabilities = capabilities,
}
require'lspconfig'.clangd.setup{
on_attach = on_attach,
capabilities = capabilities,
} }
EOF EOF