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


Could you please advise on how to configure vicmd to open text file with nvim on new terminal window while using configuration settings from .bashrc.

I can open a text file on a new terminal window and it works as expected, but does not use settings from .bashrc (eg. custom colors, etc). Code sample bellow:

set vicmd='urxvtc -e nvim' &

I can also get nvim to lauch on a new terminal window, loading the correct .bashrc settings, however neovim creates a new blank file, does not load the currently selected file in Vifm. Code sample bellow:

set vicmd='urxvtc -e bash -i -c "nvim"' &

I looked for an answer on google and on this forum and have not managed to solve the problem.

The relevant information I found is that when launching a new terminal window, eg. urxvtc -e "command", it launches the new terminal in non interactive mode, so it does not use settings in .bashrc. To force the newly launched window to use .bashrc we have to use the argument bash -i -c "command". I tried this as per code sample above, but its not working.

This is my first post, so apologies if I any forum rules where broken.

Regards and thanks.

1 Answer

0 votes
edited by
Best answer


Vifm adds arguments and you need to bundle them with nvim command. I'd advice making a script and specifying it in 'vicmd'. Say, you do

set vicmd=vicmd &

and create $VIFM/scripts/vicmd containing


# when Vim is supposed to be foreground, don't open a separate terminal
for arg; do
    if [ x"$arg" = x"-f" ]; then
        exec nvim "$@"

command=$(printf '%q ' nvim "$@")
exec urxvtc -e bash -i -c "$command"

(Haven't tried if this actually works.)



Thank you very much for the support, the solution above works. And thank you for the excelent file manager :)




Upon testing this solution for a few days, I realized that now batch rename stopped working, when I select multiple files and press Shift+A, Vifm opens a new empty Nvim window that doesn't cointain the file names.

When I set the vicmd as per code below, batch renaming works as expected.:

set vicmd=nvim

Could you please advise on how to retain the functionality provided in the answer above and have functional batch renaming.

Regards and thanks



I've added a loop that shouldn't call urxvtc for foreground editing. The problem is due to urxvtc not waiting for the terminal to be closed, so Vifm doesn't get result of editing.


Thank you very much for the support and prompt reply. Just tried it and it works.