When I log into the server, I can execute a user defined command, runfw
from fish_user_key_bindings.fish
file it runs fine. But when I try to execute
ssh user@myipaddress "cd ~/mydir; runfw"
It replies unknown command "runfw
. Of course I can source the key bindings in command like this:
ssh user@myipaddress "cd ~/mydir; source ~/.config/fish/functions/fish_user_key_bindings.fish; runfw"
The runfw
works, but other issues occur. So the question is, how can I remotely execute a command with fully loaded fish environment for the user
?
When not running interactively, fish does not execute fish_user_key_bindings
, which causes that file to not be sourced.
When you then try to run that function, it hasn't already been defined (by loading sourcing fish_user_key_bindings.fish), so fish tries sourcing "runfw.fish", which doesn't exist. So it can't find the function.
So either source fish_user_key_bindings manually, or put that function into its dedicated file called "runfw.fish".