-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathluasnip.lua
More file actions
55 lines (47 loc) · 1.22 KB
/
Copy pathluasnip.lua
File metadata and controls
55 lines (47 loc) · 1.22 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
54
55
local M = {
"L3MON4D3/LuaSnip",
}
M.config = function()
local ls = require("luasnip")
-- global variable
LUASNIP_ENV = {
s = require("luasnip.nodes.snippet").S,
i = require("luasnip.nodes.insertNode").I,
fmt = require("luasnip.extras.fmt").fmt,
parse = require("luasnip.util.parser").parse_snippet,
p = require("luasnip.extras").partial,
}
ls.config.set_config({
history = true,
updateevents = "TextChanged,TextChangedI",
enable_autosnippets = true,
})
-- load lua snippets
require("luasnip.loaders.from_lua").lazy_load({ paths = "~/.config/nvim/snippets/" })
-- vim.keymap.set({ "i", "s" }, "<a-p>", function()
-- if ls.expand_or_jumpable() then
-- ls.expand()
-- end
-- end)
vim.keymap.set({ "i", "s" }, "<a-k>", function()
if ls.jumpable(1) then
ls.jump(1)
end
end)
vim.keymap.set({ "i", "s" }, "<a-j>", function()
if ls.jumpable(-1) then
ls.jump(-1)
end
end)
-- vim.keymap.set({ "i", "s" }, "<a-l>", function()
-- if ls.choice_active() then
-- ls.change_choice(1)
-- end
-- end)
-- vim.keymap.set({ "i", "s" }, "<a-h>", function()
-- if ls.choice_active() then
-- ls.change_choice(-1)
-- end
-- end)
end
return M