From 436de412e740056ba33fb540f78dd43d29d0ec6b Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Wed, 3 Nov 2021 18:01:27 +0100 Subject: use coq instead of cmp --- nvim/init.vim | 27 ++++----------------------- nvim/lua/lsp.lua | 28 ++-------------------------- 2 files changed, 6 insertions(+), 49 deletions(-) diff --git a/nvim/init.vim b/nvim/init.vim index a0d4d6f..2e42f7e 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -25,16 +25,10 @@ Plug 'google/vim-searchindex' Plug 'rktjmp/lush.nvim' Plug 'ellisonleao/gruvbox.nvim' -" LSP if has('nvim') Plug 'neovim/nvim-lspconfig' - Plug 'hrsh7th/cmp-nvim-lsp' - Plug 'hrsh7th/cmp-buffer' - Plug 'hrsh7th/nvim-cmp' - - " For vsnip users. - Plug 'hrsh7th/cmp-vsnip' - Plug 'hrsh7th/vim-vsnip' + Plug 'ms-jpq/coq_nvim', {'branch': 'coq'} + Plug 'ms-jpq/coq.artifacts', {'branch': 'artifacts'} endif @@ -127,6 +121,8 @@ let b:ale_fixers = { if has('nvim') lua require('evil_lualine') lua require('git') + + let g:coq_settings = { 'auto_start': v:true } lua require('lsp') colorscheme gruvbox @@ -184,9 +180,6 @@ nnoremap ,o :only " gs = open git status nnoremap ff :Files . nnoremap co :Commits -nnoremap :gf :GFiles -nnoremap :gs :GFiles? -nnoremap :gd :Git diff nnoremap pa :set paste nnoremap npa :set nopaste @@ -195,18 +188,6 @@ nnoremap npa :set nopaste nmap cr :!command cargo r nmap :EditorConfigReload - -" Use `[g` and `]g` to navigate diagnostics -nmap [g (coc-diagnostic-prev) -nmap ]g (coc-diagnostic-next) - -" GoTo code navigation. -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) - - if &diff "Get from remote nnoremap dr :diffgetRE diff --git a/nvim/lua/lsp.lua b/nvim/lua/lsp.lua index f881977..a63b761 100644 --- a/nvim/lua/lsp.lua +++ b/nvim/lua/lsp.lua @@ -1,29 +1,5 @@ local nvim_lsp = require('lspconfig') -local cmp = require'cmp' - -cmp.setup({ - sources = { - {name = 'buffer'}, - {name = 'nvim_lsp'}, - {name = 'vsnip'}, - }, - snippet = { - expand = function(args) - vim.fn["vsnip#anonymous"](args.body) - end, - }, - mapping = { - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm({ select = true }), - }, - documentation = { - border = 'rounded', - }, -}) - --- Use an on_attach function to only map the following keys --- after the language server attaches to the current buffer +local coq = require('coq') local on_attach = function(client, bufnr) local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end @@ -50,7 +26,7 @@ end local servers = { 'jedi_language_server', 'rust_analyzer', 'tsserver', 'clangd' } for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup { - capabilities = capabilities, + capabilities = coq.lsp_ensure_capabilities(), on_attach = on_attach, flags = { debounce_text_changes = 150, -- cgit v1.2.3-18-g5258