summaryrefslogtreecommitdiff
path: root/lua/config/snippets.lua
blob: 8b0d30bf85e02e1d22e07dc559b08268d50b6e3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- ~/.config/nvim/lua/snippets.lua
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node

ls.snippets = {
  all = {
    s("hi", t("Hello, world!")),       -- Type "hi" -> expand to Hello, world!
  },
  lua = {
    s("fn", {                           -- Type "fn" -> expand to a function template
      t("function "), i(1, "name"), t("("), i(2), t({")", "\t"}),
      i(0),
      t({"", "end"})
    }),
  },
}