-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzpreztorc
63 lines (60 loc) · 1.61 KB
/
zpreztorc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
vim.opt.completeopt = { "menu", "menuone", "noselect" }
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local cmp = require("cmp")
local lspkind = require("lspkind")
local luasnip = require("luasnip")
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
cmp.setup({
sources = cmp.config.sources({
{ name = "nvim_lua" },
{ name = "nvim_lsp" },
{ name = "path" },
{ name = "luasnip", keyword_length = 1 },
{ name = "buffer", keyword_length = 5 },
}),
completion = {
keyword_length = 2,
},
mapping = {
["<Tab>"] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end,
["<S-Tab>"] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end,
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<C-n>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "s" }),
["<C-p>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "s" }),
["<Down>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "s" }),
["<Up>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "s" }),
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
formatting = {
format = lspkind.cmp_format({
with_text = true,
menu = {
nvim_lsp = "[LSP]",
nvim_lua = "[api]",
buffer = "[buf]",
path = "[path]",
luasnip = "[snip]",
},
}),
},
experimental = {
native_menu = false,
ghost_text = true,
},
})