Live data from Hacker News

The fish shell is amazing

rmpr.xyz

241–250 of 302 posts

Re: The fish shell is amazing

#241
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

Ditch omz and use Prezto with the Powerlevel10k prompt (just change the theme in the zpreztorc file to 'powerlevel10k' and restart your terminal), follow the initial prompts for setup, with "instant prompt" enabled and you'll never go back.

Re: The fish shell is amazing

#242
post #126

Earlier quoted context omitted.

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.

I'm usually happy to put some effort into configuration upfront as a new user if it buys me the peace of mind that I won't be thrown under the bus later. OTOH, I recall some classmates being unaware that Vim supports syntax highlighting because the version that was installed on our lab computers didn't enable it by default (this was about five years ago), which also seems like a regrettable outcome.

Re: The fish shell is amazing

#244
post #217

Earlier quoted context omitted.

Have you just tried the following to run your bash one liners in fish? bash -c 'echo "hello"' Replacing echo "hello" with your script.

You could do that, but it would be pretty inconvenient in general, and more so when using quotes within the script. There would also be no autocomplete.

[deleted]

Re: The fish shell is amazing

#245

Earlier quoted context omitted.

> while Fish has some nice out-of-the-box features, they’re all achievable in Zsh with a few lines of plugins. The point of fish is that there is no configuration required. You don't have to learn to configure it, you don't have to be part of "the community" to learn which plugins to use, you'll be able to sit in front of any fish prompt and have it work as expected without having to move dotfiles around.

> The point of fish is that there is no configuration required. I think it would be more accurate to say that the point of fish is that there is no configuration allowed . If you don't like the out of the box configuration, I would say configuration is still required , but it's unfortunately not available . If you happen to like every single decision the developers made, then I admit having no configuration does mean…

I think this really shows the two schools of thought, and this is reflected in the attitude towards linux too.

A: Linux is amazing, I can configure everything the exact way I want.

B: Linux sucks, I need to mess around with configurations for hours before I get something usable.

A lot of us just want something that works out of the box with amazing defaults. Others want something that can be tuned to their exact preferences. However, configurability comes with it's own costs too.

Re: The fish shell is amazing

#246
post #17
post #16

As another commenter pointed out, while Fish has some nice out-of-the-box features, they’re all achievable in Zsh with a few lines of plugins. And did you know Zsh has a short for loop? Along with fantastic plugins like fzf-tab, I don’t see a reason to use anything else right now. Though, I’m keeping a very interested eye on Nu shell. They’re doing a lot of stuff right, and I expect it will become a very useful scrip…

Many of the features are also achievable with pure bash with ble.sh ( https://github.com/akinomyoga/ble.sh ).

I find it amusing when people are discussing all these new shells and features, yet everytime I see someone letting them know they can do these exact same things in bash, there's absolute silence. It's not the first time I see ble.sh being recommended here with no reactions from the community whatsoever. As for fish, I've used it for a few weeks. Not having POSIX compatibility and GNU readline shortcuts made work much, much harder.

Re: The fish shell is amazing

#247

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,…

Even less ergonomic shells like bash can work very well out of the box if you just train yourself to use them. If you train yourself to use bash without any plugins, you'll be strong on any machine without any config. I went through a "distro hopping" phase at some point with Linux and ended up settling on a system with very little custom config. It's close to the defaults so I can work very comfortably even in a ran…

What I do on Linux is keep bash with a minimal config, and then have zsh with oh-my-zsh and all the other goodies. I used bash for a long time, so I don't get too confused by context switching.

Re: The fish shell is amazing

#248
post #7

I used fish for a couple of years and really liked it. But I recently learned that I can configure ZSH to have all of the same auto-complete and plugins that I loved from fish. Now I have all of the creature comforts I like, with POSIX compliance I found that while fish has better syntax than bash for most things, the hassles with incompatibility or unexpected behavior brought me much more trouble than BASH's syntax…

I don't get why people expect POSIX compliance from fish. Your interactive shell and your scripting shell can be, should be, and often are, different. I use bash as my default user shell, fish as the default shell of my terminal emulator, and I write scripts for both POSIX sh (dash and busybox ash) and bash. I end up using three different shells with different purposes. Sure, I could use zsh both as an interactive an…

I am a fish shell user, but for me the biggest drawback is that a lot of tools rely on updating bashrc as part of installation and some of them don't have an equivalent `config.fish`.

Re: The fish shell is amazing

#249
post #217

Earlier quoted context omitted.

Have you just tried the following to run your bash one liners in fish? bash -c 'echo "hello"' Replacing echo "hello" with your script.

You could do that, but it would be pretty inconvenient in general, and more so when using quotes within the script. There would also be no autocomplete.

So I don't think this quite solves the issue you describe, which is that if your history was full of convenient Fish one-liners, you wouldn't be able to reuse them in your scripts, because for scripting you prefer Bash.

But:

1. I have CTRL+R bound to fuzzy reverse history search via fzf in my Fish config. It works great. It's fast, and it's way better than the built-in Bash reverse history search imo, even though it works basically the same way (it should feel very familiar). fzf itself comes with the keybindings, so you don't have to sort them out yourself; you can just source 'em: https://github.com/junegunn/fzf/blob/master/shell/key-bindin...

2. For one-off one liners you see in GitHub repos or something, if you really want tab completion and syntax highlighting and whatever, you can just use `exec` twice:

    ⋊> ~ echo $HELLO
    
    ⋊> ~ exec bash
    ~ $ export HELLO=hello
    ~ $ exec fish
    Welcome to fish, the friendly interactive shell
    ⋊> ~ echo $HELLO
    hello
3. If you want to import your handy one-liners from your existing `.bash_history`, you could try using babelfish to automatically translate them, then import them into your Fish history: https://github.com/bouk/babelfish

It may not work right for some of them, but it's worked on the scripts I've tried. You might also be able to bind a key that translates whatever command there is on the prompt into Fish. It seems to handle the basics well, including subshells with redirection/process substitution, e.g.:

    ~ $ cat  ~ cat (echo hi | psub)
    hi
    ⋊> ~ exit
    ~ $
Babelfish is pretty fast. Maybe you could create a Fish keybind that searches through your bash history, only it's translated to Fish via babelfish? Then at least you could keep your existing history in a way :D

Re: The fish shell is amazing

#250

Earlier quoted context omitted.

Then you have to learn two languages. And switch from one to another when you need to do some scripting. I don't write shell scripts a lot, I prefer to write python scripts (that are more maintainable and simple to write). But I write complex commands in the shell a lot, for example I may need to convert a bunch of images from one format to another, just use a for loop with imagemagik directly from the command line,…

> Then you have to learn two languages. Why would I need do to that? > But I write complex commands in the shell a lot ... It's not rare that I write commands that are more than 5 lines long. Ah, well, yeah, in that case, you might wanna stick to ZSH. I don't write complex commands on the shell. If it's more than 1 line long, I will make it a script. Multiple lines of commands with, or without, backward slash separat…

For what it’s worth, as another long line she’ll user, I actually do write those in some combination of the terminal and C-x C-e bringing up my nvim.
Post reply on HN