diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 9809c69..ac6cccb 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -13,7 +13,14 @@ Plug 'fatih/vim-go' Plug 'gabesoft/vim-ags' Plug 'google/protobuf' 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 'kchmck/vim-coffee-script' Plug 'lifepillar/vim-solarized8' @@ -33,7 +40,6 @@ call plug#end() " vim-plug---END - " Solarized syntax enable set termguicolors @@ -264,6 +270,8 @@ let g:tagbar_type_go = { \ 'ctagsargs' : '-sort -silent' \ } +set completeopt=menu,menuone,noselect + lua <lua vim.diagnostic.goto_next()', opts) buf_set_keymap('n', 'q', 'lua vim.diagnostic.setloclist()', opts) buf_set_keymap('n', 'f', 'lua vim.lsp.buf.formatting()', opts) + + buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') end -vim.o.completeopt = "menuone,noselect" -require'compe'.setup { - enabled = true; - autocomplete = true; - debug = false; - min_length = 1; - preselect = 'enable'; - throttle_time = 80; - source_timeout = 200; - resolve_timeout = 800; - 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; - vsnip = true; - luasnip = true; - }; -}; +local cmp = require'cmp' + +local sources = { + { name = 'nvim_lsp' }, + { name = 'nvim_lua' }, + { name = 'buffer' }, +} + +cmp.setup({ + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources(sources), +}) + +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) + require'lspconfig'.gopls.setup{ - on_attach = on_attach + on_attach = on_attach, + capabilities = capabilities, } + require'lspconfig'.solargraph.setup{ - on_attach = on_attach; - bundlerPath = 'bin/bundle'; - useBundler = true; + on_attach = on_attach, + bundlerPath = 'bin/bundle', + useBundler = true, + capabilities = capabilities, } + 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