Commit: accd186d1d013b214153fa0e28197a674be9238c
Parent: 740408d5f1ab3d203b569e7eb229ba30109fa567
Author: Randy Palamar
Date: Thu, 13 Apr 2023 09:11:34 -0600
vis: macros.lua: use win.syntax for lang keys
Diffstat:
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/.config/vis/macros.lua b/.config/vis/macros.lua
@@ -1,5 +1,3 @@
-require('util')
-
-- function chain
local function fc(argv)
return function ()
@@ -30,7 +28,7 @@ end
local function macros(win)
local m = vis.modes
local lang = {}
- lang['.tex'] = {
+ lang["latex"] = {
{ m.NORMAL, "\\al", fc({ ins("\\begin{align*}\n\\end{align*}"), fk("O") }) },
{ m.NORMAL, "\\bf", fc({ ins("\\textbf{}"), fk("hi") }) },
{ m.NORMAL, "\\ca", fc({ ins("\\begin{cases}\n\\end{cases}"), fk("O") }) },
@@ -41,13 +39,11 @@ local function macros(win)
{ m.NORMAL, "\\se", fc({ ins("\\section{}"), fk("hi") }) },
{ m.NORMAL, "\\su", fc({ ins("\\subsection{}"), fk("hi") }) },
}
- lang['.hs'] = {
+ lang["haskell"] = {
{ m.NORMAL, "gq", fk("vip:|hindent<Enter><Escape>") },
}
- local _, e = util:splitext(win.file.name)
-
- local binds = lang[e]
+ local binds = lang[win.syntax]
if binds == nil then return end
for _, map in pairs(binds) do