diff --git a/site-modules/core/files/vim/init.vim b/site-modules/core/files/vim/init.vim index f55254f..3a5a533 100644 --- a/site-modules/core/files/vim/init.vim +++ b/site-modules/core/files/vim/init.vim @@ -74,6 +74,3 @@ nnoremap " ignored from command-t file searches. let g:CommandTWildIgnore="*/node_modules/*,*/vendor/*,*/runtime/*,*/public_html/*,*/pack/*" -" Required for complietion with nvim-cmp -set completeopt=menu,menuone,noselect - diff --git a/site-modules/core/files/vim/plugin/completion.lua b/site-modules/core/files/vim/plugin/completion.lua index b5f60d8..6483675 100644 --- a/site-modules/core/files/vim/plugin/completion.lua +++ b/site-modules/core/files/vim/plugin/completion.lua @@ -28,11 +28,6 @@ Text = "", Operator = "", } -local has_words_before = function() - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil -end - cmp.setup({ mapping = cmp.mapping.preset.insert({ [''] = cmp.get_config().mapping[''], @@ -41,29 +36,17 @@ cmp.setup({ [''] = function() luasnip.jump(-1) end, [''] = cmp.mapping.abort(), - [''] = cmp.mapping(function(_fallback) - if cmp.visible() then - cmp.confirm({ select = true }) - else - vim.api.nvim_feedkeys('\n', 'nt', false) - end - end, { 'i', 's' }), + [''] = cmp.mapping.confirm({ select = true }), [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then + if luasnip.expand_or_jumpable() then luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() else fallback() end end, { "i", "s" }), [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then + if luasnip.jumpable(-1) then luasnip.jump(-1) else fallback()