vis: keys for yazi and fzf with hidden files; vis as default editor (also in yazi)

This commit is contained in:
2025-09-10 09:06:01 +02:00
parent 28fbb75b47
commit 6757fc6aec
3 changed files with 40 additions and 6 deletions

View File

@@ -150,10 +150,18 @@ vis.events.subscribe(vis.events.INIT, function()
search(fzf_reload(ripgrep))
end, 'fzf: rg')
vis:map(vis.modes.NORMAL, ' hg', function()
search(fzf_reload(ripgrep .. ' -.'))
end, 'fzf: rg with hidden files')
vis:map(vis.modes.NORMAL, ' ff', function()
search('fd --type f | fzf')
end, 'fzf: files')
vis:map(vis.modes.NORMAL, ' fh', function()
search('fd -H --type f | fzf')
end, 'fzf: files with hidden files')
vis:map(vis.modes.NORMAL, ' .', function()
local path = vis.win.file.path
if path then
@@ -163,7 +171,18 @@ vis.events.subscribe(vis.events.INIT, function()
else
search('fd --type f | fzf')
end
end, 'fzf: current dir files')
end, 'fzf in file directory')
vis:map(vis.modes.NORMAL, ' h.', function()
local path = vis.win.file.path
if path then
local dir = path:match('^.*/')
local arg = escape_and_quoted(dir)
search('fd -H --type f "" ' .. arg .. ' | fzf')
else
search('fd -H --type f | fzf')
end
end, 'fzf in file directory with hidden files')
vis:map(vis.modes.NORMAL, ' gf', function()
search('git ls-files | fzf')
@@ -202,6 +221,21 @@ vis.events.subscribe(vis.events.INIT, function()
vis:command('cd ' .. path)
end)
end, 'fzf change directory')
vis:map(vis.modes.NORMAL, ' yy', function()
vis:command('!yazi')
end, 'yazi')
vis:map(vis.modes.NORMAL, ' y.', function()
local path = vis.win.file.path
if path then
local dir = path:match('^.*/')
local arg = escape_and_quoted(dir)
vis:command('!cd ' .. arg .. ' && yazi')
else
vis:command('!yazi')
end
end, 'yazi in file directory')
end)
vis.events.subscribe(vis.events.WIN_OPEN, function(win)