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

I'm on Debian 11 with vifm version 0.10.1

The relevant lines in my ~/.vifm/vifmrc are:

" do a `git add` on the current file                                            
command! gitadd git-add %f

" open file in new screen session when vifm is opened in gnu screen             

and the first command references a script at ~/.vifm/scripts/git-add:

echo "git add $@" > /tmp/x
git add "$@"

If I comment out screen! then when I select a file in vifm and type :gitadd and hit enter it works and performs the git add. But when I run vifm with the screen! command present then this :gitadd does nothing.

I need the functionality of both of these things. Do I need to add something to the command! to make this work, or is this a bug?

1 Answer

0 votes

You need to use %n macro in the command to avoid use of terminal multiplexer for running it. Or move git-add script somewhere in the $PATH for tmux/screen, or add ~/.vifm/scripts to the $PATH.

The issue is that running a command in a new window doesn't inherit current $PATH. It can actually be set, but only for all new windows as well (at least I think this was the case last time I checked).