Difference between revisions of "How to set Vifm current directory after leaving sub-shell"
Jump to navigation
Jump to search
(Created page with "The idea is to pass the Vifm server name to the subshell, and then add a shell exit hook that would use Vifm remote command to change the folder of the parent Vifm instance....") |
(No difference)
|
Revision as of 23:52, 18 April 2018
The idea is to pass the Vifm server name to the subshell, and then add a shell exit hook that would use Vifm remote command to change the folder of the parent Vifm instance.
Passing Vifm server name to the subsell
This could be done via environment variables. Set the following in vifmrc
:
let $VIFM_SERVER_NAME = v:servername
Changing the folder in parent Vifm
The command to do it is
vifm --server-name "$VIFM_SERVER_NAME" --remote +"cd \"$PWD\""
Note: please do not use "... --remote
"$PWD"
" - this will always change the folder of the left panel.
Now, the exit handler is shell dependant:
- For zsh, the following function could be added to
.zshrc
:
zshexit() {
if [[ -n $VIFM_SERVER_NAME ]] {
vifm --server-name "$VIFM_SERVER_NAME" --remote +"cd \"$PWD\""
}
}