aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim/lua/autocomplete.lua
diff options
context:
space:
mode:
authorAlec Goncharow <alec@goncharow.dev>2023-05-29 17:44:42 -0500
committerAlec Goncharow <alec@goncharow.dev>2023-05-29 17:44:42 -0500
commit7d7494b11618d23d5568f61124c8c27f64487532 (patch)
tree5a61c047c31b005c1d796083d071a91ef437bdfd /.config/nvim/lua/autocomplete.lua
parentc6e51c4d78b68ac17dc7c9285647d1d27209aef2 (diff)
who shaved all these yaks?
Diffstat (limited to '.config/nvim/lua/autocomplete.lua')
-rw-r--r--.config/nvim/lua/autocomplete.lua39
1 files changed, 30 insertions, 9 deletions
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 @@
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
+ ["<Tab>"] = cmp.mapping(function(fallback)
+ if vim.fn.pumvisible() == 1 then
+ feedkey("<C-n>", "n")
+ elseif cmp.visible() then
+ cmp.select_next_item()
+ else
+ fallback()
+ end
+ end, {
+ "i",
+ }),
+ ["<S-Tab>"] = cmp.mapping(function(fallback)
+ if vim.fn.pumvisible() == 1 then
+ feedkey("<C-p>", "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' }
+ })
+ })