I recently (2017) switch to fish shell as my interactive shell. There is a few reason for it:
- the defaults are really good and there is a little to configure to achieve what I was trying to do with zsh,
- the autosuggestion feature is quite cool (I even went to reproduce
- the syntax highlighting feature is also killer as it easier to see problems in the command-line before hitting enter,
it auto-generates completion from parsing man pages
$ fish_update_completions Parsing man pages and writing completions to /home/vincent/.local/share/fish/generated_completions/ 1793 / 1793 : zramctl.8.gz
At the begining, I used oh-my-fish as a simple way in.
Oh My Fish provides core infrastructure to allow you to install packages which extend or modify the look of your shell. It’s fast, extensible and easy to use.
oh-my-fish is pretty cool but I tend to use only a few plugin and I almost have more hand-written configuration files for fish than what oh-my-fish gives me. So I’m now using fish shell bare-naked with my own configurations.
According to the documentation, fish will load files from the following folder (in order):
- Configuration shipped with fish, which should not be edited, in
- System-wide configuration files, where administrators can include
initialization that should be run for all users on the system -
/etc/profilefor POSIX-style shells - in
Configuration snippets in files ending in
.fish, in the directories:
/usr/share/fish/vendor_conf.d(set at compile time; by default,
If there are multiple files with the same name in these directories, only the first will be executed. They are executed in order of their filename, sorted (like globs) in a natural order (i.e. “01” sorts before “2”).
- User initialization, usually in
~/.config/fish/config.fish(controlled by the
Fish will also automatically loads functions from the following folder (in order):
- A directory for end-users to keep their own functions, usually
~/.config/fish/functions(controlled by the
- A directory for systems administrators to install functions for all
users on the system, usually
- A directory for third-party software vendors to ship their own
functions for their software, usually
- The functions shipped with fish, usually installed in
An autoloaded function becomes available automatically to all running shells. If the function definition is changed, all running shells will automatically reload the altered version. Startup time and memory usage is improved, etc.
I’m also using nixos which have some specificities but we’ll see that later. One specificity though about my setup is the, I may want some fish function/helper to be available for all users on a server (when using nixos) or only a user (mainly, when using nixpkgs without nixos, on Mac OSX or another linux or on Windows with WSL).