aboutsummaryrefslogtreecommitdiff
path: root/env/.config/nvim/after/plugin/snippets.lua
blob: 6bf38ab70b1ccdc465a71b55b980c9ea0c429783 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
local ok, luasnip= pcall(require, 'luasnip')
if ok then
    luasnip.filetype_extend("javascript", { "jsdoc" })
    luasnip.filetype_extend("lua", { "luadoc" })
    luasnip.filetype_extend("rust", { "rustdoc" })
    luasnip.filetype_extend("c", { "cdoc" })

    vim.keymap.set({"i"}, "<C-s>e", function() luasnip.expand() end, {silent = true})

    vim.keymap.set({"i", "s"}, "<C-s>;", function() luasnip.jump(1) end, {silent = true})
    vim.keymap.set({"i", "s"}, "<C-s>,", function() luasnip.jump(-1) end, {silent = true})

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