vis: add keys for shell and themes, change current dir keys

This commit is contained in:
2025-09-14 10:09:06 +02:00
parent bd15a7b443
commit 5464d111d0

View File

@@ -192,7 +192,7 @@ vis.events.subscribe(vis.events.INIT, function()
search('fd -H --type f | fzf') search('fd -H --type f | fzf')
end, 'fzf: files with hidden files') end, 'fzf: files with hidden files')
vis:map(vis.modes.NORMAL, ' .', function() vis:map(vis.modes.NORMAL, ' df', function()
local path = vis.win.file.path local path = vis.win.file.path
if path then if path then
local dir = path:match('^.*/') local dir = path:match('^.*/')
@@ -203,7 +203,7 @@ vis.events.subscribe(vis.events.INIT, function()
end end
end, 'fzf in file directory') end, 'fzf in file directory')
vis:map(vis.modes.NORMAL, ' h.', function() vis:map(vis.modes.NORMAL, ' dh', function()
local path = vis.win.file.path local path = vis.win.file.path
if path then if path then
local dir = path:match('^.*/') local dir = path:match('^.*/')
@@ -214,6 +214,23 @@ vis.events.subscribe(vis.events.INIT, function()
end end
end, 'fzf in file directory with hidden files') end, 'fzf in file directory with hidden files')
vis:map(vis.modes.NORMAL, ' sh', function()
local shell = os.getenv('SHELL')
vis:command('!' .. shell)
end, 'run shell')
vis:map(vis.modes.NORMAL, ' ds', function()
local shell = os.getenv('SHELL')
local path = vis.win.file.path
if path then
local dir = path:match('^.*/')
local arg = escape_and_quoted(dir)
vis:command('!cd ' .. arg .. ' && ' .. shell)
else
vis:command('!' .. shell)
end
end, 'run shell in file directory')
vis:map(vis.modes.NORMAL, ' gf', function() vis:map(vis.modes.NORMAL, ' gf', function()
search('git ls-files | fzf') search('git ls-files | fzf')
end, 'fzf: git files') end, 'fzf: git files')
@@ -276,6 +293,14 @@ vis.events.subscribe(vis.events.INIT, function()
vis:map(vis.modes.NORMAL, ' me', function() vis:map(vis.modes.NORMAL, ' me', function()
vis:command('o ~/.config/vis/global-marks.txt') vis:command('o ~/.config/vis/global-marks.txt')
end, 'global marks: edit') end, 'global marks: edit')
vis:map(vis.modes.NORMAL, ' td', function()
vis:command('set theme lupan-dark')
end, 'change to dark theme')
vis:map(vis.modes.NORMAL, ' tl', function()
vis:command('set theme lupan-light')
end, 'change to light theme')
end) end)
vis.events.subscribe(vis.events.WIN_OPEN, function(win) vis.events.subscribe(vis.events.WIN_OPEN, function(win)