From 4179cfdb4dc62f08013314a2c4eca06d0ed5a072 Mon Sep 17 00:00:00 2001 From: talha <-> Date: Thu, 3 Apr 2025 00:45:52 +0500 Subject: Added acme-colors, html snippets --- after/ftplugin/html.lua | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 after/ftplugin/html.lua (limited to 'after/ftplugin/html.lua') diff --git a/after/ftplugin/html.lua b/after/ftplugin/html.lua new file mode 100644 index 0000000..e3ff637 --- /dev/null +++ b/after/ftplugin/html.lua @@ -0,0 +1,37 @@ +-- html snippets +function Snippets(snipType, value) + snippet = "" + if snipType == "comment" then + snippet = [[]] + elseif snipType == "tag" then + snippet = string.format("<%s> ", value, value) + end + return snippet +end + +function JumpInTag() + vim.cmd("normal! f>w") +end + +-- keymaps to insert snippets +vim.keymap.set('i', "", function() + WriteText(Snippets("comment")) + jumpInTag() +end, {noremap=true}) + +vim.keymap.set('i', "", function() + WriteText(Snippets("tag", "i")) + JumpInTag() +end, {noremap=true}) + +vim.keymap.set('i', "", function() + WriteText(Snippets("tag", "b")) + vim.cmd("normal! f>w") + JumpInTag() +end, {noremap=true}) + +vim.keymap.set('i', "", function() + inp = vim.fn.input("Tag: ", "", "file") + WriteText(Snippets("tag", inp)) + JumpInTag() +end, {remap=true}) -- cgit v1.2.3