-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompletion.lua
More file actions
53 lines (48 loc) · 1.45 KB
/
Copy pathcompletion.lua
File metadata and controls
53 lines (48 loc) · 1.45 KB
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
return {
"hrsh7th/nvim-cmp",
version = false,
dependencies = {
-- Snippet engine
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"rafamadriz/friendly-snippets",
-- Extra sources to make life easy
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
},
opts = function()
local cmp = require("cmp")
cmp.setup({
-- The order of the sources will set the order of snippets
sources = cmp.config.sources({
{ name = "luasnip" },
{ name = "nvim_lsp" },
{ name = "path" },
{ name = "lazydev", group_index = 0 },
}),
mapping = cmp.mapping.preset.insert({
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
["<Tab>"] = cmp.mapping(cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
})),
}),
-- Enables the snippet engine (required)
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
})
-- Disabling for specific file types
cmp.setup.filetype({ "go" }, {
sources = {},
})
-- I have to call this here and in snippetins.lua
-- For some reason this stops html duplication inside
-- jsx and tsx files.
require("luasnip.loaders.from_vscode").lazy_load()
end,
}