-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcmp.lua
50 lines (45 loc) · 1 KB
/
cmp.lua
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
local require = require("amc.require_or_nil")
local cmp = require("cmp")
if not cmp then
return
end
-- see nvim-cmp/lua/cmp/config/mapping.lua
---
---cmdline
---
local preset_cmdline = cmp.mapping.preset.cmdline()
cmp.setup.cmdline(":", {
mapping = preset_cmdline,
sources = cmp.config.sources({
{
name = "path"
},
{
name = "cmdline",
option = {
ignore_cmds = { "Man", "!" }
}
}
})
})
---
---nvim_lsp
---
local preset_insert = cmp.mapping.preset.insert()
cmp.setup({
completion = {
autocomplete = false,
},
mapping = cmp.mapping.preset.insert({
["<C-Space>"] = preset_insert["<C-N>"],
["<C-S-Space>"] = preset_insert["<C-P>"],
["<Tab>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
["<S-Tab>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
["<CR>"] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources({
{
name = "nvim_lsp"
},
}),
})