From a772f2e466d84274ecc54a8ff8d88736ed03e90f Mon Sep 17 00:00:00 2001 From: Felix Van der Jeugt Date: Mon, 11 Mar 2019 10:42:41 +0100 Subject: [PATCH] multiple changes to vis rc - add interactive for latex - backspace 4 spaces at a time - add binding for opening a file with sent - add binding for pasting the primary selection --- config/vis/visrc.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/config/vis/visrc.lua b/config/vis/visrc.lua index a22204e..7c53916 100644 --- a/config/vis/visrc.lua +++ b/config/vis/visrc.lua @@ -47,6 +47,7 @@ interactives = { ["python"] = "!python -i $vis_filename", ["haskell"] = "!stack ghci $vis_filepath", ["lithaskell"] = "!stack ghci $vis_filepath", + ["latex"] = "!pdflatex $vis_filepath", } vis:map(vis.modes.NORMAL, ";i", function() local command = interactives[vis.win.syntax] @@ -62,3 +63,24 @@ end) vis:map(vis.modes.NORMAL, ";b", function() vis:command('set theme dark-16') end) + +vis:map(vis.modes.INSERT, '', function() + local found_tab = true + local tabwidth = 4 + for selection in vis.win:selections_iterator() do + local pos = selection.pos + if not pos or pos < tabwidth or vis.win.file:content(pos - tabwidth, tabwidth) ~= string.rep(' ', tabwidth) then + found_tab = false + break + end + end + vis:feedkeys(string.rep('', found_tab and tabwidth or 1)) +end) + +vis:map(vis.modes.NORMAL, ";s", function() + vis:command("!sent $vis_filepath") +end) + +vis:map(vis.modes.NORMAL, ";p", function() + vis:command("