It turns out Fish aliases are quite slow, and often recommended against
config.fish. The following works around that by lazy-loading
them as functions while still allowing a single aliases file that can be shared
among other POSIX shells:
source $HOME/.aliases for alias in (grep -o "^alias \b\w+\b" $HOME/.aliases | cut -c 7-) funcsave $alias end
This can be run as-needed, or automatically with a terminal setup using tmux as described in this post. For example, I have this in my config file:
if status is-login if test -f $HOME/.aliases source $HOME/.aliases # Export aliases for lazy-loading in child shells. for alias in (grep -o "^alias \b\w+\b" $HOME/.aliases | cut -c 7-) funcsave $alias end end if test -f $HOME/.functions.fish source $HOME/.functions.fish # Export functions for lazy-loading in child shells. for func in (grep -o "function \b\w+\b" $HOME/.aliases.fish | cut -c 10-) funcsave $func end end end
My full fish config is available here.