general cleanup

This commit is contained in:
Felix Van der Jeugt 2024-07-24 08:35:41 +02:00
parent ffced8fca4
commit 3ffb35cc2e
No known key found for this signature in database
GPG key ID: 58B209295023754D
25 changed files with 149 additions and 120 deletions

View file

@ -21,6 +21,13 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win)
vis:command('set number')
end)
vis.events.subscribe(vis.events.FILE_SAVE_PRE, function(file, path)
if file.size ~= 0 and file:content(file.size - 1, 1) ~= "\n" then
file:insert(file.size, "\n")
end
return true
end)
vis:map(vis.modes.NORMAL, ";;", "<vis-window-next>")
--------------------------------------------------------------------------------
@ -34,6 +41,15 @@ vis:map(vis.modes.NORMAL, "<Escape>", function()
end
end)
--------------------------------------------------------------------------------
-- Fancy cd
vis:command_register("rcd", function(argv, force, cur_win, selection, range)
handle = io.popen('f=$(mktemp); st -e ranger --choosedir="$f" --show-only-dirs; cat "$f"')
local output = handle:read()
handle:close()
vis:command('cd '..output)
end)
--------------------------------------------------------------------------------
-- Fuzzy search filenames to open files