Skip to main content

Why I dropped fish in favour of Zsh

·367 words·2 mins· ·
Zsh Fish
Ariejan de Vroom
Author
Ariejan de Vroom
Jack of all Trades, Professional Software Craftsman
Table of Contents

Developers are religious about two things: their editor and their shell.

After getting multiple recommendations from friends and co-workers I gave fish a try. It lists several benefits over other shells, among other there’s autosuggetions, colour support and web based configuration.

Installing it on a Mac is easy with Homebrew, so I figured why not give it a fair try.

And yes, fish has its benefits. I used the web based configurator. Once. The only feature that really stood out to me was the autosuggestions and more notably the fact that fish will suggest commonly used commands based on the directory you’re currently in.

Still, the most annoying thing is that fish is not POSIX compatible. Although I’m not a purist that insists on POSIX compatibility, it imposed some practical limitations.

Environment variables
#

The first and most annoying thing is environment variables. I’m not talking about the globally set variables, but those you use to run a command once.

Normally I’d do something like this:

TIME_COP=2016-02-24 rake app:send_daily_notifications

Well, that doesn’t work in fish as it needs you to explicitly run the env command:

env TIME_COP=2016-02-24 rake app:send_daily_notifications

It’s a subtle difference, but if you’re used to the old syntax and have quite some documentation with snippets like this, it’s quite a nuisance.

&& vs &
#

Running a second command conditionally is a construct I use often:

./analyse_data.rb && rake app:send_daily_notifications

If ./analyse_data.rb fails (e..g it has a non-zero return value), then the supplied rake task will not be executed. Again, this is something I commonly use.

Fish on the other hand uses a single &, the && operation is invalid.

Incompatibility with Vim
#

You’ll need to give Vim some extra love and attention when you’re running fish. Namely, you’ll need to explicitly tell Vim to not use fish, but bash instead.

It’s a simple fix, but one that should not be necessary.

Back to Zsh
#

The issues I have with fish are minimal and due to my own personal preference. I think fish is a nice shell, but it just doesn’t fit me.

So, back to Zsh! But no more Oh-My-Zsh-crap, please! More on how I’ve setup Vim/Tmux/Zsh in a later post.

Related

Fixing a slow starting Terminal or iTerm2 on Mac OS X
·171 words·1 min
Bash Shell MacOSX Devops Terminal Terminal.app Iterm Iterm2 Zsh