From 7d7494b11618d23d5568f61124c8c27f64487532 Mon Sep 17 00:00:00 2001 From: Alec Goncharow Date: Mon, 29 May 2023 17:44:42 -0500 Subject: who shaved all these yaks? --- .config/nvim/lua/autocomplete.lua | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) (limited to '.config/nvim/lua/autocomplete.lua') diff --git a/.config/nvim/lua/autocomplete.lua b/.config/nvim/lua/autocomplete.lua index 775a407..a86e86b 100644 --- a/.config/nvim/lua/autocomplete.lua +++ b/.config/nvim/lua/autocomplete.lua @@ -21,6 +21,28 @@ [''] = 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. + [""] = cmp.mapping(function(fallback) + if vim.fn.pumvisible() == 1 then + feedkey("", "n") + elseif cmp.visible() then + cmp.select_next_item() + else + fallback() + end + end, { + "i", + }), + [""] = cmp.mapping(function(fallback) + if vim.fn.pumvisible() == 1 then + feedkey("", "n") + elseif cmp.visible() then + cmp.select_prev_item() + else + fallback() + end + end, { + "i", + }), }), sources = cmp.config.sources({ { name = 'nvim_lsp' }, @@ -49,12 +71,11 @@ { name = 'buffer' } } }) - -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). - cmp.setup.cmdline(':', { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = 'path' } - }, { - { name = 'cmdline' } - }) - }) + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline(':', { + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }) + }) -- cgit v1.2.3-70-g09d2