summaryrefslogtreecommitdiff
path: root/lua/config/luasnip.lua
blob: f3b39b400cbc5c95dadddd81d7cadb53598c4716 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
return function()
  local ls = require("luasnip")

  -- Expand snippet
  vim.keymap.set("i", "<C-K>", function() ls.expand() end, { silent = true })

  -- Jump forward/backward
  vim.keymap.set({ "i", "s" }, "<C-L>", function() ls.jump(1) end, { silent = true })
  vim.keymap.set({ "i", "s" }, "<C-J>", function() ls.jump(-1) end, { silent = true })

  -- Change choice in choice node
  vim.keymap.set({ "i", "s" }, "<C-E>", function()
    if ls.choice_active() then
      ls.change_choice(1)
    end
  end, { silent = true })

  -- Optionally, load snippets here if you have them
  -- require("luasnip.loaders.from_vscode").lazy_load()
end