From 58cad94a41ccafc6399a37fbd353c6d94f449c91 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Wed, 12 Apr 2023 18:49:17 -0400 Subject: [PATCH] nvim: added completion engine --- src/.config/nvim/init.vim | 5 ++++- src/.config/nvim/lua/init.lua | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/.config/nvim/init.vim b/src/.config/nvim/init.vim index dba1907..f0bb05e 100755 --- a/src/.config/nvim/init.vim +++ b/src/.config/nvim/init.vim @@ -161,8 +161,11 @@ if has('python3') " my devices without python3 probably don't need these Plug 'neovim/nvim-lspconfig' - Plug 'nvim-lua/completion-nvim' Plug 'nvim-lua/lsp-status.nvim' + + Plug 'hrsh7th/nvim-cmp' + Plug 'hrsh7th/cmp-nvim-lsp' + Plug 'stevearc/dressing.nvim' endif diff --git a/src/.config/nvim/lua/init.lua b/src/.config/nvim/lua/init.lua index d760ffb..0d9b398 100644 --- a/src/.config/nvim/lua/init.lua +++ b/src/.config/nvim/lua/init.lua @@ -97,3 +97,22 @@ require('leap').opts.labels = { "a", "s", "d", "f", "k", "l", "h", "o", "d", "w", "e", "m", "b", "u", "y", "v", "r", "g", "t", "c", "x", "/", "z", } + +local cmp = require'cmp' +cmp.setup({ + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'buffer' }, + }) +})