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

Please, is there a way how to integrate vifm with z (https://github.com/jethrokuan/z) in a way that directories changed into using cd command are being appended to .local/share/z/data?

If I run :command! cd .. I get "Can't redefine builtin command".

1 Answer

+1 vote
selected by
Best answer

You can execute an arbitrary command on directory change like this:

autocmd DirEnter * !your command

I'm not sure how to add current directory for z explicitly. __z_add might be it.


thank you, it worked.


By the way, you probably want to use %i macro, so screen doesn't flicker.


I just saw this topic and thought how wonderful it would be if I could use this module too in my fav VIFM!


I installed the module mentioned above and it works great in Powershell 7, but I don't know how to integrate VIFM and Z.

I didn't understand the answer you wrote above to Jose. Can you please Xaizek explain as simple as you can what I need to add in the VIFMRC file and how after that to type the Z command and where.

I'm sorry, I'm not a programmer, so it's a little harder for me to understand these more advanced settings...


I know essentially nothing about Powershell, but you can try adding one of these to your vifmrc (the first one should work if you have changed 'shell' option, otherwise try the second one):

autocmd DirEntry * !Save-CdCommandHistory
autocmd DirEntry * !powershell -c Save-CdCommandHistory

You can experiment by running these interactively in command-line first (:!...) and then write command that worked to vifmrc.