-
Notifications
You must be signed in to change notification settings - Fork 3
/
completion.nix
70 lines (66 loc) · 2.03 KB
/
completion.nix
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
64
65
66
67
68
69
70
{ pkgs, ... }: {
binaries = [];
lazy = with pkgs.vimPlugins;
# lua
''
{
dir = "${nvim-autopairs}",
name = "autopairs",
event = "InsertEnter",
opts = {},
},
{
dir = "${nvim-cmp}",
name = "nvim-cmp",
event = { "InsertEnter", "CmdlineEnter" },
dependencies = {
{ dir = "${cmp-nvim-lsp}", name = "cmp-nvim-lsp" },
{ dir = "${cmp-path}", name = "cmp-path" },
{ dir = "${cmp-buffer}", name = "cmp-buffer" },
{ dir = "${cmp-cmdline}", name = "cmp-cmdline" },
{ dir = "${cmp-nvim-lsp-signature-help}", name = "cmp-signature-help" },
-- adding icons to completion menu
{ dir = "${lspkind-nvim}", name = "cmp-lspkind" },
},
config = function ()
local cmp = require('cmp')
local lspkind = require('lspkind')
cmp.setup({
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'nvim_lsp_signature_help' },
{ name = 'path' },
}),
snippet = {
expand = function(args)
vim.snippet.expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({}),
formatting = {
format = lspkind.cmp_format({
mode = "symbol",
}),
},
})
-- Use buffer source for `/` and `?`
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' },
},
})
-- Use cmdline & path source for ':'
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' },
}, {
{ name = 'cmdline' },
}),
matching = { disallow_symbol_nonprefix_matching = false },
})
end,
},
'';
}