diff options
author | talha <-> | 2025-04-03 00:45:52 +0500 |
---|---|---|
committer | talha <-> | 2025-04-03 00:45:52 +0500 |
commit | 4179cfdb4dc62f08013314a2c4eca06d0ed5a072 (patch) | |
tree | 5295432f7da2f7878318a1b6a1ae3733816e57cd /after/ftplugin | |
parent | dcbb851bbfb45e210331d76db5227ef995366918 (diff) |
Added acme-colors, html snippetsmaster
Diffstat (limited to 'after/ftplugin')
-rw-r--r-- | after/ftplugin/html.lua | 37 |
1 files changed, 37 insertions, 0 deletions
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> </%s>", value, value) + end + return snippet +end + +function JumpInTag() + vim.cmd("normal! f>w") +end + +-- keymaps to insert snippets +vim.keymap.set('i', "<M-s><M-c>", function() + WriteText(Snippets("comment")) + jumpInTag() +end, {noremap=true}) + +vim.keymap.set('i', "<M-s><M-i>", function() + WriteText(Snippets("tag", "i")) + JumpInTag() +end, {noremap=true}) + +vim.keymap.set('i', "<M-s><M-b>", function() + WriteText(Snippets("tag", "b")) + vim.cmd("normal! f>w") + JumpInTag() +end, {noremap=true}) + +vim.keymap.set('i', "<M-s><M-t>", function() + inp = vim.fn.input("Tag: ", "", "file") + WriteText(Snippets("tag", inp)) + JumpInTag() +end, {remap=true}) |