Fish is a shell, more specific, it’s the “friendly interactive shell”.
It is a non-POSIX compliant shell that focuses on user-friendliness, usability, ease of use, easy scriptability of the shell (not necessarily as extensive as Nushell).
It is particularly known for its superb autocompletion, command suggestions and tab completion.
Not only that, but it also features a unique concept, where you can, for example, set environment variables globally, which means they persist longer than the shell session.
In reality, fish simply populates a file with all these settings, which is, however, separate to the fish config.
This is particularly useful for me, as I manage my dotfiles using Chezmoi, so any change to the config file is considered a conflict or change by chezmoi.
I, however, don’t necessarily need these specific variables to be present on other machines.
In other words, it Just Works™, at least when it comes to the features specified above, without the need for an elaborate setup like with ZSH, for example.
And although I ship my custom config with my Dotfiles, requiring Additional Tools, fish is highly usable out of the box, with sane defaults and easy configuration.
Folllow the guide in the README for configuration of the AI provider within the ~/.config/fish-ai.ini. This is not supplied with my Dotfiles, as it contains a plaintext API key / personal access token!
You can also use the fish_ai_put_api_key command to put your API key on a keyring, so you don’t have to write it in plain text to the config file! You need to have a config already present, though.
Could maybe someday be replaced with Tabby or tabby-agent? Maybe at least for the model.
You should use it in conjunction with Sponge, as fixing an error sends command history!
Keybinds
Simply press Ctrl + P to change comments (preceding #) into commands or commands into an explanation.
If the previous command threw an error, pressing the keybind will try to fix the issue.
Abbreviation Tips
fish-abbreviation-tips is a really useful tool to get into the habit of using your and your plugin’s abbreviations.
Because, if you don’t use them, you might as well get rid of them.
fisher install gazorby/fish-abbreviation-tips
Login Shell
If you follow a System AdministrationGuide, I normally set the login shell to bash when creating the custom user, so you might wonder why I don’t directly set it to fish.
Well, fish isn’t POSIX-compliant, and neither does it want to be. Therefore, running fish as a login shell might not be the absolute best experience you’ll ever have.
Instead, I include a code snippet at the bottom of my ~/.bashrc, below the interactive check [[ $- == *i* ]], which will let fish take over any interactive shell, while scripts, etc. that expect a POSIX compliant shell can have their way.