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

I am new to vifm, and wonder if I can reuse my alias settings in Zsh of the following flavor. It helps to keep things in one place if vifm can somehow call alias in Zsh, or reuse a local dot-file where these alias are specified.

alias project1='cd /absolute/path/to/Project1'

Please advise if I will be better off rewriting the alias by specifying them as user-defined commands, like the following. The only down side is that I now have two "alias" files to manage.

command! project1 :cd /absolute/path/to/Project1'

(Glad that vifm allows for a lower case user-assigned function. If this were Vim, I'd need to keep remembering to capitalize the first character.)

1 Answer

0 votes
selected by
Best answer

Vifm can't do that. It would need to understand configuration files of shells or have them integrated somehow.

For things like that you could probably make a sed command that generates alias analogues in Vifm syntax and use it to generate something like zsh-aliases.vifm file, which you then :source in your vifmrc. It's still not a perfect integration, but at least mostly automated.

By the way, development version of Vifm has beginnings of Lua plugins and it should already be possible to write one that parses .zshrc and create user-commands out of aliases on startup. So if this is ready one day, this could be a way to go about it.


Thanks a lot for confirming what is doable and what is not (yet). As you suggested, I plan to set up a parser that format the alias project1="cd xxx" lines into command! project1 cd xxx, and keep it in a separate file.

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.