Mercurial > dotfiles
changeset 439:84b4f33c0403
Replace compe with cmp
author | zegervdv <zegervdv@me.com> |
---|---|
date | Fri, 27 Aug 2021 17:26:42 +0200 |
parents | 766e63b3a8fc |
children | 6503de68af7b |
files | dot_config/nvim/init.lua |
diffstat | 1 files changed, 19 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/dot_config/nvim/init.lua Fri Aug 27 16:53:22 2021 +0200 +++ b/dot_config/nvim/init.lua Fri Aug 27 17:26:42 2021 +0200 @@ -99,11 +99,6 @@ ignored_next_char = string.gsub([[ [%w%%%'%[%.] ]], '%s+', ''), } - require('nvim-autopairs.completion.compe').setup { - map_cr = true, - map_complete = true, - } - npairs.add_rules { Rule(' ', ' '):with_pair(function(opts) local pair = opts.line:sub(opts.col - 1, opts.col) @@ -206,34 +201,28 @@ -- Completion/snippets/LSP use { 'neovim/nvim-lspconfig' } use { - 'hrsh7th/nvim-compe', + 'hrsh7th/nvim-cmp', + requires = { 'hrsh7th/cmp-buffer', 'hrsh7th/cmp-nvim-lsp' }, config = function() - require('compe').setup { - enabled = true, - autocomplete = true, - debug = false, - min_length = 1, - preselect = 'enable', - throttle_time = 80, - source_timeout = 1000, - incomplete_delay = 400, - max_abbr_width = 100, - max_kind_width = 100, - max_menu_width = 100, - documentation = true, - - source = { - path = true, - buffer = true, - nvim_lsp = true, - nvim_lua = false, - spell = false, - vsnip = true, + local cmp = require 'cmp' + cmp.setup { + mapping = { + ['<C-p>'] = cmp.mapping.select_prev_item(), + ['<C-n>'] = cmp.mapping.select_next_item(), + ['<C-d>'] = cmp.mapping.scroll_docs(-4), + ['<C-f>'] = cmp.mapping.scroll_docs(4), + ['<C-Space>'] = cmp.mapping.complete(), + ['<C-e>'] = cmp.mapping.close(), + ['<CR>'] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + }, + sources = { + { name = 'buffer' }, + { name = 'nvim_lsp' }, }, } - - vim.cmd [[ inoremap <silent><expr> <C-y> compe#complete() ]] - vim.cmd [[ inoremap <silent><expr> <C-e> compe#close('<C-e>') ]] end, } use {