summaryrefslogtreecommitdiff
path: root/lua/config/snippets.lua
diff options
context:
space:
mode:
authorbh <qn+git@excalibur.computer>2025-11-13 20:36:04 +0800
committerbh <qn+git@excalibur.computer>2025-11-13 20:36:04 +0800
commit6ba386ec6d6cc68b39621db3dfd216a79659fcd7 (patch)
tree4ce981182619bd024cee4499f314bc4a955e1041 /lua/config/snippets.lua
parent1afa56764aaddbbc4253c8e61086aedec2340efd (diff)
Backup for LuaSnips
Diffstat (limited to 'lua/config/snippets.lua')
-rw-r--r--lua/config/snippets.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/lua/config/snippets.lua b/lua/config/snippets.lua
new file mode 100644
index 0000000..8b0d30b
--- /dev/null
+++ b/lua/config/snippets.lua
@@ -0,0 +1,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"})
+ }),
+ },
+}
+