From 5b1f41a2e1826f301c1e1d0e191b706371532387 Mon Sep 17 00:00:00 2001 From: Oliver Davies <oliver@oliverdavies.dev> Date: Thu, 24 Oct 2024 14:39:00 +0100 Subject: [PATCH] nvim: add Twig snippets for Storybook --- .../neovim/lua/opdavies/snippets/ft/twig.lua | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 config/neovim/lua/opdavies/snippets/ft/twig.lua diff --git a/config/neovim/lua/opdavies/snippets/ft/twig.lua b/config/neovim/lua/opdavies/snippets/ft/twig.lua new file mode 100644 index 0000000..41842e3 --- /dev/null +++ b/config/neovim/lua/opdavies/snippets/ft/twig.lua @@ -0,0 +1,31 @@ +local fmta = require("luasnip.extras.fmt").fmta +local ls = require "luasnip" + +local i = ls.insert_node + +local M = { + stories = fmta( + [[ + {% stories <name> with { title: '<title>' } %} + + <finish> + + {% endstories %} + ]], + { name = i(1), title = i(2), finish = i(0) } + ), + + story = fmta( + [[ + {% story <name> with { + name: '<label>', + args: {}, + } %} + <finish> + {% endstory %} + ]], + { name = i(1, "default"), label = i(2), finish = i(0) } + ), +} + +return M