Welcome to Vifm Q&A, where you can ask questions about Vifm usage. Registration is optional, anonymous posts are moderated. GitHub or Google logins are enabled.
0 votes
in vifm by
edited by

zoxide is a cd replacement similar to autojump, z, and fasd. Its README includes links to plugins for a couple of popular command-line file managers, except for Vifm.

Having used fzf for simple navigation in Vifm for a while (thanks to suggestions found on the issue tracker on GitHub and the Vifm Wiki), I've managed to write a working command that opens an fzf prompt for selecting an item from zoxide's database and then cd into it:

command! zoxide :set noquickview | :execute 'cd' fnameescape(system('zoxide query -l "%a" | fzf --height 20 2>/dev/tty')) '%IU' | redraw

What I'm looking for next is automatically add the current directory to zoxide. I'm thinking of something like running zoxide add %d as an autocommand, but I have no idea where to even start, or if it's possible at all without writing a new plugin. (I've noticed that Vifm v0.12 has experimental lua support, although my programming skills are rather limited.)

Edit: Minor change to the zoxide command.

1 Answer

+1 vote
by
selected by
 
Best answer

There is :autocmd, so this should work:

autocmd DirEnter * !zoxide add %d %i
If you would like to make a bug report or feature request consider using GitHub, SourceForge or e-mail. Posting such things here is acceptable, but this is not a perfect place for them.
...