Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tarebyte committed Apr 18, 2022
1 parent 8ea7808 commit 5a244f6
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions .config/nvim/lua/user/cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,13 @@ cmp.setup({
formatting = {
format = lspkind.cmp_format({ preset = "codicons" }),
},
mapping = {
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
["<C-e>"] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-y>"] = cmp.config.disable,
["<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)
["<Tab>"] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expandable() then
Expand All @@ -51,18 +46,17 @@ cmp.setup({
else
fallback()
end
end, { "i", "s" }),

["<S-Tab>"] = cmp.mapping(function(fallback)
end,
["<S-Tab>"] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
},
end
}),
sources = {
{ name = "nvim_lsp" },
{ name = "nvim_lua" },
Expand Down

0 comments on commit 5a244f6

Please sign in to comment.