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
This commit is contained in:
Felix Van der Jeugt 2019-03-11 10:42:41 +01:00
parent f05258c275
commit a772f2e466
No known key found for this signature in database
GPG Key ID: 58B209295023754D
1 changed files with 22 additions and 0 deletions

View File

@ -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, '<Backspace>', 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('<vis-delete-char-prev>', 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("<xclip -o")
end)