Pratham Sharma
Posted on July 13, 2021
So when I first started linux and went into command line it looked a bit ugly (yeah the bash prompt is ugly initially :p). So well I tried customizing it a bit. Soon after I got bored with bash and I heard about this new guy zsh and then I switched to zsh. And zsh was more powerful than bash cause it had a better completion and a better vi mode. I used oh-my-zsh for most of the time and for themes I went with default one. Besides I also used syntax highlight plugins and autocompletion plugin too. It was all working pretty fine but then I had to move to a new machine and soon I forgot how to install these plugins in zsh. I mean I could have googled but I am quite lazy so I got oh-my-zsh and that was it.
Fast forward to this week I picked this new shell called fish. This blog will be a brief intro to fish from perspective of a zsh/posix shell user.
So fish is a non posix shell which means that your bash scripts don't work here (most of them). Although almost all the unix commands work in fish so you don't have to worry about a missing command for most of time.
Now Some good features that you get in fish by default are auto-completion , auto-suggestion, syntax highlighting and it all works out of box
So let's talk about making fish usable. For example like using aliases and where is the config file?. So generally the config file for fish is in .config/fish/config.fish
. You can open this file in any text editor u want.
Inside the file you can add all your configuration and functions like you do in zsh file. Ok what did I wanted to do ? Yeah alias. In fish shell there is nothing called alias rather it is called abbreviations. Abbreviations are almost similar to aliases. According fish's web site " Abbreviations are user-defined words that are replaced with longer phrases after they are entered. "
This means that abbreviations are somewhat similar to snippets. You type the initials and it automatically completes it. Which is wonderful because you get to see the command that you have abbreviated. To set abbreviations you can do abbr -a v nvim
in your config.fish
v is the abbreviation and nvim is the completion for it. Also there are minor syntax differences in fish from zsh/posix. Honestly I think that fish's syntax can be called more a bit modernish. Nonetheless you can look at the syntax here .
There are plugins-managers like ohmyzsh available for fish too. Some of them are :
And maybe more I don't know all of them. I personally use fisher because it's quite easy.
For prompt's you have :
- Tide I like tide cause it looks exactly similar to p10k and you can also configure it the same way from zsh. It's cool :p.
- You can use others like shellder, and starship too.
Note : for nvm users fish does not support nvm instead u get this or something like this.
You can see the way my shell looks.
It all get's completed with a spacebar :)
Yup so that's all about fish. I would really recommend fish to developers because of it's ease of use and setting up. If not using it forever atleast try giving fish a try.
Posted on July 13, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.