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
by
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.

by

thank you, it worked.

by

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

by

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

https://www.powershellgallery.com/packages/z/1.1.13
https://github.com/badmotorfinger/z

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...

by

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.

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.
...