The fish shell
A few years ago, I used fish as my main shell. For whatever reason, I switched to Zsh—likely because of its weird, not POSIX-compliant syntax. There were just too many things different, and I preferred the Bash syntax.
This switch was not easy, however. There were many things missing, and I spent hours adding them back in Zsh using plugins. I tried out Oh My Zsh, but found it too bloated. In the end, I ended up with an acceptable configuration.
Years later, I'm regretting that decision, just like I did with GitHub and GitLab. I'm not going to get into all the reasons, but just take prevd
and nextd
as an example.
There were some caveats, such as using aliases with sudo. With Bash and Zsh, you could add a simple alias sudo="sudo "
. With fish, I needed a complicated function that I'm not even sure works 100% of the time:
function sudo
set sudo_args_with_value (LANG=C command sudo --help | string match -gr '^\s*(-\w),\s*(--\w[\w-]*)=')
set sudo_args
while set -q argv[1]
switch "$argv[1]"
case --
set -a sudo_args $argv[1]
set -e argv[1]
break
case $sudo_args_with_value
set -a sudo_args $argv[1]
set -e argv[1]
case '-*'
case '*'
break
end
set -a sudo_args $argv[1]
set -e argv[1]
end
if functions -q -- $argv[1]
set -- argv fish -C "$(functions --no-details -- $argv[1])" -c '$argv' -- $argv
end
command sudo $sudo_args $argv
end
You need to make sure that this function only runs in interactive sessions, or you're going to run into a lot of trouble (sudo btrfs
being one of them).
I'm still finding out if there are any more drawbacks, but I think overall it's a good decision to switch.