Live data from Hacker News

The fish shell is amazing

rmpr.xyz

201–210 of 302 posts

Re: The fish shell is amazing

#201
post #137

Earlier quoted context omitted.

they're just functions so they end up in files in ~/.config/fish/functions/ $ alias foo bar $ function foo --wraps bar --description 'alias foo=bar' bar $argv end these two are basically equivalent. you'll need to $ funcsave foo to make it persist. this will write foo.fish into that functions folder. there's also abbreviations like $ abbr --add ll ls -lh which expand as you type. ll won't end up in your history becau…

Abbreviations are actually brilliant! So much better than aliases. Long live fish.

One of my favorite features. I counted then recently - over 100.

The killer feature over aliases is that a) you can edit them and b) you can define them instantaneously.

Did you type `git diff --cached` one time to many? Up arrow -> Ctrl+a -> "abbr gdc "

Bam. `gdc` now expands to that. It's there forever. And that's how you end up with 100+ abbreviations.

Re: The fish shell is amazing

#202
post #126

Earlier quoted context omitted.

zsh has this absolutely ridiculous case of feature shyness. It has tons of great features, which it goes to great lengths to hide from you for some indecipherable reason.

The reason is to preserve compatibility for everyone's configuration that they carefully built up over decades. It's quite hard to change things to enable some new thing without annoying many users. The last time that was tried was in the '90s and there are still zsh developers around who experienced the fallout. I value the fact that my shell doesn't change on me without warning like many GUI desktop environments. I…

Well, yeah, this is the problem. Throw new users under the bus in favour of old users.

Re: The fish shell is amazing

#203

Earlier quoted context omitted.

The best reason to choose fish over zsh is that everything works so well out of the box that you stop messing with it. I haven’t tweaked my shell config in 7 or 8 months now. This is a different mindset from the giant zsh configs, “plugin managers” and other junk that is wholly irrelevant to using the shell. You’d think that fish incorporating a lot of functionality that zsh has would manifest as bloating fish, but,…

> The best reason to choose fish over zsh is that everything works so well out of the box that you stop messing with it. This is such an incredibly odd perspective to me. I use zsh and have not touched my shell config in years . Messing with configurations to get things working to your liking is a one time thing. I don't even use plugins. On the other hand, if fish doesn't work to your liking out of the box, and for…

> On the other hand, if fish doesn't work to your liking out of the box, and for many people it does not, there's no "messing with it" that's possible.

What do you want to do that isn't possible? I also haven't messed with it in months if not more (fish in my case, not zsh) but years ago I messed with the prompt a lot to get it to my liking. (From a previous zsh config.) It was perfectly possible.

Re: The fish shell is amazing

#205
post #35

I started a new job recently, and I've been thinking about terminals and shells. I love a well configured modern env, but I can't be bothered spending the literal HOURS you need to setup everything... zsh, zsh plugins, fzf, fzf plugins, fd, dot bare, patched fonts, 24 bit terminal color, temrinal color theme, binutils color theme, powerline, diff-so-fancy... I get that the devil is in the details, but come on, can I…

This is why most people have a dotfiles repo in their GitHub.

Or in my case, my Dropbox.

Re: The fish shell is amazing

#206

Earlier quoted context omitted.

Just invoke your scripts with sh or bash

I basically always do that anyway. I never get around to working them executable so I just do bash foo.sh Which is actually easier to type than ./foo.sh

Especially as you can probably just type 'foo' followed by up arrow

Re: The fish shell is amazing

#207

Could someone explain more the video demo? It ran the python interpreter which disappeared, but I didn't quite catch the meaning of this.

It demonstrates the colour coding that fish gives to indicate if the command is valid (blue) or invalid (red). The video starts off with some other shell that doesn't do this and then runs the same commands again in fish.

Re: The fish shell is amazing

#208
post #107
post #74

Earlier quoted context omitted.

Ideally you do want them to be the same, so that the skill of using one reinforces the skill of using the other, and you can begin to shape scripts out of your shell history. Output redirection doesn't work right with Fish functions, which makes them unusable in certain kinds of scripts. Aside from that, though, Fish is perfectly pleasant for simple scripting. I use Fish for simple stuff and PowerShell for anything s…

Agreed. I liked fish last time I tried it (probably over a decade ago), but bash scripting is what I'm familiar with and it's just so convenient in day-to-day usage to be able to throw out one-liners for mundane things and then have them permanently searchable in my history.

Have you just tried the following to run your bash one liners in fish?

  bash -c 'echo "hello"'
Replacing echo "hello" with your script.

Re: The fish shell is amazing

#209

Earlier quoted context omitted.

There are lots of "old reliable shells" that are POSIX incompatible. (t)csh[1] is the first family that comes to mind. The EEE analogy is more applicable to GNU Bash anyways: it extended the POSIX sh baseline with a bunch of GNUisms that a lot of "POSIX" sh scripts now unintentionally use. [1]: https://en.wikipedia.org/wiki/C_shell

I do not think that there are many GNUisms in bash, even if indeed there are a few optional syntax variants that should be avoided for compatibility with other shells. In any case I am not aware of any GNUism that is actually useful in scripts, so taking care to not use any syntax variant specific to bash is not a problem. All the important bash features that are not POSIX are not GNUisms, but they are: 1. The 50% of…

To the best of my knowledge, Bash’s parameter expansion syntax[1] is entirely an original, non-POSIX GNUism. It’s extremely common and useful in scripting.

And that’s just one small example.

[1]: https://www.gnu.org/software/bash/manual/html_node/Shell-Par...

Re: The fish shell is amazing

#210
post #147

Earlier quoted context omitted.

The best reason to choose fish over zsh is that everything works so well out of the box that you stop messing with it. I haven’t tweaked my shell config in 7 or 8 months now. This is a different mindset from the giant zsh configs, “plugin managers” and other junk that is wholly irrelevant to using the shell. You’d think that fish incorporating a lot of functionality that zsh has would manifest as bloating fish, but,…

Another issue with zsh plugins is that they are incredibly slow. Oh-my-zsh makes every terminal feel like it’s running on another machine over ssh

You don't need that much plugins at all. The only plugin that I use is gitstatus, and zsh-syntax-highlight, and both of them are avoidable without loosing features.
Post reply on HN