diff options
| author | JackJ30 <jackqjamison@gmail.com> | 2025-05-28 20:23:13 -0400 |
|---|---|---|
| committer | JackJ30 <jackqjamison@gmail.com> | 2025-05-28 20:23:13 -0400 |
| commit | 9a715c6e6c568cfce48e0249c81e24ebf4648474 (patch) | |
| tree | e7b6533dc1714872edbff45ff95ee5383cb7c4be /.config | |
| parent | 91f219193e541469eb335f2977c9fa2c1eaab2ba (diff) | |
improve cmp keybinds
Diffstat (limited to '.config')
| -rw-r--r-- | .config/nvim/lua/user/plugins/cmp.lua | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/.config/nvim/lua/user/plugins/cmp.lua b/.config/nvim/lua/user/plugins/cmp.lua index a7afe9f..f515e17 100644 --- a/.config/nvim/lua/user/plugins/cmp.lua +++ b/.config/nvim/lua/user/plugins/cmp.lua @@ -9,6 +9,7 @@ return { }, opts = function() local cmp = require('cmp') + local select_opts = {behavior = cmp.SelectBehavior.Select} return { snippet = { @@ -16,12 +17,19 @@ return { require('luasnip').lsp_expand(args.body) end, }, - mapping = cmp.mapping.preset.insert(), + mapping = { + ['<C-p>'] = cmp.mapping.select_prev_item(select_opts), + ['<C-n>'] = cmp.mapping.select_next_item(select_opts), + ['<C-u>'] = cmp.mapping.scroll_docs(-4), + ['<C-d>'] = cmp.mapping.scroll_docs(4), + ['<C-e>'] = cmp.mapping.abort(), + ['<Tab>'] = cmp.mapping.confirm({select = true}), + }, sources = cmp.config.sources({ - { name = 'nvim_lsp', max_item_count = 5 }, - { name = "luasnip", max_item_count = 5 }, + { name = 'nvim_lsp', max_item_count = 5, keyword_length = 1 }, + { name = "luasnip", max_item_count = 5, keyword_length = 2 }, }, { - { name = 'buffer', max_item_count = 2 }, + { name = 'buffer', max_item_count = 2, keyword_length = 3 }, }, { { name = 'path', max_item_count = 2 }, }), |
