Why I Use Fish Shell

by Kevin Leutzinger on Jan 22, 2021

Fish - The Friendly Interactive Shell


# Check installed packages vs requirements.txt inside a Python project
# Works inside a virtualenv as well
diff (python -m pip freeze | psub) requirements.txt

# parse manpages installed on the system
# and create completion files in the fish configuration directory.

fish vs zsh

Many people who are fed up with bash switch to zsh. To me, zsh is just a band-aid still stuck in the confines known as POSIX-compliance. Some people stick with zsh over fish because they need access to the ctrl+r functionality of zsh, also known as history-incremental-search-backward. Many recommend using the up-arrow key to search backwards through history, but it's not quite as powerful as the zsh ctrl+r. You can't add on to the typing of it generally or see Fish has this as a plugin! It's got some other goodies, too. Grab it here: fzf fish plugin. Install With fisher. You'll probably want to set the environment variable set -U FZF_LEGACY_KEYBINDINGS 0 in your config.fish to get these newer nicer keybinds. More info in the readme on github.

Keybindings     | Description                                     |
--------------- | ----------------------------------------------- |
Ctrl-o          | Find a file.                                    |
Ctrl-r          | Search through command history.                 |
Alt-c           | cd into sub-directories (recursively searched). |
Alt-Shift-c     | cd into sub-directories, including hidden ones. |
Alt-o           | Open a file/dir using default editor ($EDITOR)  |
Alt-Shift-o     | Open a file/dir using xdg-open or open command  |

Hitting ctlr-r now give you a nice little fzf-sytle menu for your old commands. I'd say it's even more powerful than zsh's ctrl+r.
ctl-r in fish
Here I hit ctrl+r and typed in fish. I can see all previous commands that have fish as a substring, and I'm able to select one my arrow keys, or by double clicking with the mouse. I can refine the search if I keep typing. It's very intuitive if you play around with it.

« Previous | Why I Use Fish Shell | Next »