vis: keys for yazi and fzf with hidden files; vis as default editor (also in yazi)
This commit is contained in:
@@ -8,8 +8,8 @@
|
||||
# for ssh logins, install and configure the libpam-umask package.
|
||||
#umask 022
|
||||
|
||||
export EDITOR=nvim
|
||||
export VISUAL=nvim
|
||||
export EDITOR=vis
|
||||
export VISUAL=vis
|
||||
|
||||
# if running bash
|
||||
if [ -n "$BASH_VERSION" ]; then
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -5,13 +5,13 @@ imv = [
|
||||
zathura = [
|
||||
{ run = 'zathura "$@"', orphan = true },
|
||||
]
|
||||
nvim_cd = [
|
||||
{ run = 'nvim -c "cd $@"', block = true }
|
||||
fzf_vis = [
|
||||
{ run = 'cd "$@" && fd --type f | fzf --bind "enter:become(vis {})"', block = true }
|
||||
]
|
||||
|
||||
[open]
|
||||
prepend_rules = [
|
||||
{ mime = "image/*", use = "imv" },
|
||||
{ mime = "application/pdf", use = "zathura" },
|
||||
{ mime = "inode/directory", use = "nvim_cd" }
|
||||
{ mime = "inode/directory", use = "fzf_vis" }
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user