vifm: Add zoxide integration

If zoxide is found on the system, vifm will automatically add any paths
traversed into the zoxide database.
It will also have a new internal command 'zoxide' with which you can
open a menu to search all zoxide-known paths - it is also added as a
mapping to <space>z.
This commit is contained in:
Marty Oehme 2025-01-04 10:45:06 +01:00
parent 77348e09c7
commit dc067c860d
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A

View file

@ -325,6 +325,14 @@ nnoremap ,T :!vifm-thumbnailer -r -t %u %c<cr>
" batch rename or delete files in current dir
nnoremap ,r :!vidir<cr>
if executable('zoxide')
" integrate zoxide search and add any vifm-visited paths automatically
" adapted from https://q2a.vifm.info/949/how-can-i-integrate-zoxide-into-vifm
command! zoxide :set noquickview | :execute 'cd' fnameescape(system('zoxide query --interactive "%a" 2>/dev/tty')) '%IU' | redraw
nnoremap <space>z :zoxide<cr>
autocmd DirEnter * !zoxide add %d %i
endif
" allows preview to work for normal view and single pane view
noremap <silent> w : if layoutis('only')
\| if &lines + 50 < &columns | vsplit | else | split | endif