From 8986d060f2f308ba768758ef9c3077f00f3d6b2a Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 23 Jun 2024 14:12:17 +0200 Subject: checkpoint --- config/essentials/vis/visrc.lua | 42 ++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) (limited to 'config/essentials/vis/visrc.lua') diff --git a/config/essentials/vis/visrc.lua b/config/essentials/vis/visrc.lua index a763edc..2a6a706 100644 --- a/config/essentials/vis/visrc.lua +++ b/config/essentials/vis/visrc.lua @@ -69,7 +69,7 @@ end ----------------------------------- vis:command_register("make", function() - vis:command("!make && head -n 1") + vis:command("!make; head -n 1") end, "make") vis:command_register("Q", function() vis:command("qa!") @@ -100,16 +100,10 @@ map_cmd(m.NORMAL, " q", "q!", "Quit (force)") map_cmd(m.NORMAL, " s", "!doas vis $vis_filepath", "Edit as superuser") map_cmd(m.NORMAL, " w", "w", "Write") map_cmd(m.NORMAL, " x", "!chmod u+x $vis_filepath", "Make active file executable") - -vis:map(m.NORMAL, " eh", function() - vis:command("!lowdown $vis_filepath > ${vis_filepath%.md}.html") - vis:info("exported.") -end, "Export markdown to html") +map_cmd(m.NORMAL, "!", "!bash", "Run bash") map_keys(m.NORMAL, " nl", ":\\&2 printf '\\2: %s\\\\n' \"$\\2\"/", "Print variable" ) - map_keys(m.NORMAL, ";v", 'V:x/^(\\s*)(.+)$/ c/\\1"$(\\2)"/', "Surround in variable") + map_keys(m.NORMAL, "\\v", 'V:x/^(\\s*)(.+)$/ c/\\1"$(\\2)"/', "Surround in variable") map_keys(m.NORMAL, ";|", "V:x/\\| / c/|\n\t/", "Wrap one-line multi pipe command") map_keys( m.NORMAL, - ";e", + "\\e", 'V:x/^(\\s*)(.+)$/ c/\\1[ "\\2" ] || exit 1/', "Condition exit if empty" ) - map_keys(m.NORMAL, ";sc", ":-/\\/,/\\/", "Expand to case") - map_keys(m.NORMAL, ";sw", ":-/\\/", "Expand to while") - map_keys(m.NORMAL, ";sf", ":-/\\/,/\\/", "Expand to for") - map_keys(m.NORMAL, ";si", ":-/\\/,/\\/", "Expand to if") + map_cmd(m.NORMAL, "\\sc", "-/\\/,/\\/", "Expand to case") + map_cmd(m.NORMAL, "\\sw", "-/\\/", "Expand to while") + map_cmd(m.NORMAL, "\\sf", "-/\\/,/\\/", "Expand to for") + map_cmd(m.NORMAL, "\\si", "-/\\/,/\\/", "Expand to if") end + + if win.syntax == "markdown" then + vis:map(m.NORMAL, "\\h", function() + vis:command("!lowdown $vis_filepath > ${vis_filepath%.md}.html") + vis:info("exported.") + end, "Export markdown to html") + map_cmd(m.NORMAL, "\\sl", "-+x/(\\d+|[-*])\\s+.+\n/", "Expand to list item") + end + + if win.syntax == "ansi_c" then + map_keys(m.NORMAL, "\\a", "f,a hdwi", "Align table") + end + end) -- cgit v1.2.3