vifm: Extend fzf mapping functionality

Extended functionality to work in current directory with lower-case
letters and from home directory using upper-case. So, <leader>f
will search files in current dir, <leader>F in home dir.
Same for <leader>d/D and <leader>w/W.

HACK Also made it use fd instead of find by default for the speedup.
This should probably only be done after detecting if fd is even installed
on the system but I do not have time for this right now.
This commit is contained in:
Marty Oehme 2023-12-04 08:39:19 +01:00
parent 9bd4a80be8
commit 5941f6f77a
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
2 changed files with 12 additions and 4 deletions

View file

@ -168,17 +168,22 @@ command! mkcd :mkdir %a | cd %a
command! syncme :cd %D command! syncme :cd %D
command! fzfhome : set noquickview command! fzfhome : set noquickview
\| let $FZF_PICK = term('locate $HOME | fzf 2>/dev/tty') \| let $FZF_PICK = term('fd . $HOME | fzf 2>/dev/tty')
\| if $FZF_PICK != '' \| if $FZF_PICK != ''
\| execute 'goto' fnameescape($FZF_PICK) \| execute 'goto' fnameescape($FZF_PICK)
\| endif \| endif
command! fzf : set noquickview command! fzf : set noquickview
\| let $FZF_PICK = term('find | fzf 2>/dev/tty') \| let $FZF_PICK = term('fd | fzf 2>/dev/tty')
\| if $FZF_PICK != '' \| if $FZF_PICK != ''
\| execute 'goto' fnameescape($FZF_PICK) \| execute 'goto' fnameescape($FZF_PICK)
\| endif \| endif
command! fzfcdhome : set noquickview
\| let $FZF_PICK = term('fd -td . $HOME | fzf 2>/dev/tty')
\| if $FZF_PICK != ''
\| execute 'cd' fnameescape($FZF_PICK)
\| endif
command! fzfcd : set noquickview command! fzfcd : set noquickview
\| let $FZF_PICK = term('find -type d | fzf 2>/dev/tty') \| let $FZF_PICK = term('fd -td | fzf 2>/dev/tty')
\| if $FZF_PICK != '' \| if $FZF_PICK != ''
\| execute 'cd' fnameescape($FZF_PICK) \| execute 'cd' fnameescape($FZF_PICK)
\| endif \| endif
@ -300,8 +305,10 @@ noremap ,pc :!pdftk %f cat output output.pdf
" fzf movements " fzf movements
nnoremap <space>f :fzf<cr> nnoremap <space>f :fzf<cr>
nnoremap <space>F :fzfhome<cr>
nnoremap <space>c :fzfcd<cr> nnoremap <space>c :fzfcd<cr>
nnoremap <space>F :grep<space> nnoremap <space>C :fzfcdhome<cr>
nnoremap <space>w :grep<space>
" preview thumbnails of current folder " preview thumbnails of current folder
" select thumbnails with m/M in nsxiv " select thumbnails with m/M in nsxiv

View file

@ -65,6 +65,7 @@ local keys = {
}), }),
}, },
{ key = "f", mods = "LEADER", action = act.QuickSelect }, { key = "f", mods = "LEADER", action = act.QuickSelect },
-- open web link
{ {
key = "F", key = "F",
mods = "LEADER", mods = "LEADER",