Skip to content

Commit

Permalink
Merge pull request AstroNvim#234 from kabinspace/cmp-tab-selection
Browse files Browse the repository at this point in the history
Add tab selection for cmp
  • Loading branch information
mehalter committed Mar 30, 2022
2 parents 225f1ae + 30c33bf commit 9bec1b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 7 additions & 3 deletions lua/configs/cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@ function M.config()
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
},
["<CR>"] = cmp.mapping.confirm(),
["<CR>"] = cmp.mapping.confirm { select = true },
["<Tab>"] = cmp.mapping(function(fallback)
if luasnip.expandable() then
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expandable() then
luasnip.expand()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
Expand All @@ -105,7 +107,9 @@ function M.config()
"s",
}),
["<S-Tab>"] = cmp.mapping(function(fallback)
if luasnip.jumpable(-1) then
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
Expand Down
1 change: 0 additions & 1 deletion lua/core/mappings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ map("v", ">", ">gv", opts)
-- Move text up and down
map("v", "<A-j>", "<cmd>m .+1<CR>==", opts)
map("v", "<A-k>", "<cmd>m .-2<CR>==", opts)
map("v", "p", '"_dP', opts)

-- Visual Block --
-- Move text up and down
Expand Down

0 comments on commit 9bec1b1

Please sign in to comment.