Skip to content

Commit 5a244f6

Browse files
committedApr 18, 2022
1 parent 8ea7808 commit 5a244f6

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed
 

‎.config/nvim/lua/user/cmp.lua

+10-16
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,13 @@ cmp.setup({
2828
formatting = {
2929
format = lspkind.cmp_format({ preset = "codicons" }),
3030
},
31-
mapping = {
32-
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
33-
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
34-
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
35-
["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
36-
["<C-e>"] = cmp.mapping({
37-
i = cmp.mapping.abort(),
38-
c = cmp.mapping.close(),
39-
}),
31+
mapping = cmp.mapping.preset.insert({
32+
["<C-b>"] = cmp.mapping.scroll_docs(-4),
33+
["<C-f>"] = cmp.mapping.scroll_docs(4),
34+
["<C-Space>"] = cmp.mapping.complete(),
35+
["<C-y>"] = cmp.config.disable,
4036
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
41-
42-
["<Tab>"] = cmp.mapping(function(fallback)
37+
["<Tab>"] = function(fallback)
4338
if cmp.visible() then
4439
cmp.select_next_item()
4540
elseif luasnip.expandable() then
@@ -51,18 +46,17 @@ cmp.setup({
5146
else
5247
fallback()
5348
end
54-
end, { "i", "s" }),
55-
56-
["<S-Tab>"] = cmp.mapping(function(fallback)
49+
end,
50+
["<S-Tab>"] = function(fallback)
5751
if cmp.visible() then
5852
cmp.select_prev_item()
5953
elseif luasnip.jumpable(-1) then
6054
luasnip.jump(-1)
6155
else
6256
fallback()
6357
end
64-
end, { "i", "s" }),
65-
},
58+
end
59+
}),
6660
sources = {
6761
{ name = "nvim_lsp" },
6862
{ name = "nvim_lua" },

0 commit comments

Comments
 (0)
Please sign in to comment.