Follow

Fish shell

I switched my shell from Zsh to Fish yesterday. In this post I go through how to get started with Fish, take you through my config, and provide you with links to useful plugins and tools.

Enjoy! :)

ar.al/2021/07/25/fish-shell/

@aral thanks for the recommendation and guide. I switched too.

@aral Really great post, I’ll be checking out some of these tools to add to my fish config at work.

@aral
Thanks for sharing this. after reading your post i realised i didnt go much further than git prompt and aliases in oh my zsh as well, there is so much more

@aral Btw, zsh can also do autosuggestions, at least with the help of a plugin: https://github.com/zsh-users/zsh-autosuggestions

As well as syntax highlighting: https://github.com/zsh-users/zsh-syntax-highlighting

Among these two plugins and Oh My Zsh, I seem to be too lazy to actually switch to fish. :blobfoxcomfysmirk: (But if I was starting out today, I’d probably go with the tool with the saner defaults.)

@kristof
I think its better to use those plugins and stay with zsh. Afaik, the fish shell is not POSIX compliant, meaning shell scripts written in sh/bash don't work on fish.

Bash adds a lot of functionality to sh and makes it more user friendly, zsh does the same thing to bash and makes it even more easier. But fish shell adds a lot of functionality while removing some others, breaking compatibility. This is not a small problem, especially if you write/run shell scripts.

@aral

@futureisfoss @aral Practically speaking, most shell scripts are written for bash, so I just end up treating shell scripts as a different language than my actual shell, anyways. (The differences are severe enough that I need ShellCheck shouting at me if I haven’t written shell scripts for a while to remind me of proper conventions.)

@kristof
I also use shellcheck, its a nice tool for finding errors in your scripts.
@aral

@futureisfoss @kristof Bash scripts will work perfectly well under Fish if they contain the right shebang. So it really doesn’t matter that my interactive shell is POSIX complaint or not :)

@aral
Ok, that makes it much better. The only con is that if you wanna learn shell scripting, it might confuse you because fish syntax is quite different from normal POSIX compliant shells.
@kristof

@futureisfoss @kristof Yeah, but again, no more than, say, learning Python or JavaScript (Node.js) would. Tack a shebang on either of those and your “shell script” is ready to go too :)

(And, to be fair, given the clusterfuck that is Bash syntax, I think people are probably better off not learning that first/ever. I try to avoid it whenever I can.)

@aral you mention ` # Make rm a little safer (have it prompt once when deleting
# more than three files or when deleting recursively).`

Have you not already learned yourself to automatically do the right keystrokes everytime?

@aral hi, do you know a way to show npm version in the fish's prompt ?
Like in spaceship :

@aral Thank you for this enthusiastic introduction to Fish shell.❤️

I think, I'm hungry now. 🐟

Sign in to participate in the conversation
Aral’s Mastodon

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!