Live data from Hacker News

The fish shell is amazing

rmpr.xyz

91–100 of 302 posts

Re: The fish shell is amazing

#91

Shells and scripting languages are different things. I don't care how good of a scripting language Powershell is, it's painful to use as a shell. I don't care that fish can't run sh scripts, I've never used it on a machine that didn't have sh. Can we stop judging oranges for their lack of crunch?

It's pretty common to copy-paste POSIX sh one-liners, or `source` a simple script. fish makes this annoying to do.

Re: The fish shell is amazing

#92
post #11

Fish is good, but most shells pale in comparison to powershell unfortunately.

PowerShell is definitely way more capable a scripting language, but it pales in comparison to Fish when it comes to speed, ease, and pleasantness of interactive use.

There's a new generation of shells on the rise which look up to both Fish and PowerShell as models of different virtues they want to embody. A lot of them are already usable, and some day a few of them will be killer apps for developers and sysadmins

Re: The fish shell is amazing

#93
Strongly agreed here, it really just works. Sure you can get the same with zsh but the hours of my life I've spent tweaking and tuning zsh I'd happily give back because fish is good enough.

When we built our CLI for Crunchy Bridge it was a couple lines to add tab completion to the CLI when running in Fish (https://blog.crunchydata.com/blog/introducing-the-crunchy-br...), love that when building such tooling giving a better end user experience was so simple.

Re: The fish shell is amazing

#94

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…

That's exactly why I use fish.

The default setup is pretty much perfect for what I want. My only additions are fzf for history search, a bunch of aliases and Starship for informative status lines.

Re: The fish shell is amazing

#95

It is typical HN that everyone is talking about Zsh and how it isn't so bad. And you know what, I used it for a while long time ago, and it is great. I even had config I could transport to another machine when I need. All that can't be compared with fish out of the box, which is why I am using fish, it will be 10 or so years now. When I say use, I mean that, I just use it, I don't spend time learning it's obscure fea…

where does one put an alias ?

i have a collection of them in my .zshrc that i would love to use.

Re: The fish shell is amazing

#96
post #60

Earlier quoted context omitted.

Zsh has become an indispensable power tool for me. I am interested in other shells (especially PowerShell), but Zsh is now embedded deep in my brain, next to Vim and Python, and I doubt I will ever seriously migrate away. That said: what do you like about Nu shell specifically?

> what do you like about Nu shell specifically? A whole bunch of things: 1. abandonment of POSIX shell syntax. We can do better. I'm happy with Zsh being POSIX-compatible, and that will always be there. 2. a focus on structured data. Nu basically has hierarchical dataframes built-in, along with lots of facilities for their manipulation. There have been a few other attempts at this but the benefits are obvious. Rather…

I'll put it this way: Nu shell seems perfectly supportive of my philosophy that a shell is basically a REPL for a computer, and they're taking the ergonomics of an interactive REPL along with the programming language that powers that REPL seriously.

The thing is, there's currently NOTHING GOOD for "shell scripting". Shell sucks (yes it does), so for anything more than very short things I'd rather write Python. But Python sucks for shell-like things, parallelization, it has slow startup, and you also can't do things like put environment variables into your session or change the working directory, so you often wind up writing shims (eg. Broot's br alias - https://dystroy.org/broot/install-br/).

Yes I've looked at Xonsh but maybe the additional syntax is offputting to me. Like, I wouldn't use it as a shell over Zsh (how's Xonsh's fzf support? I don't know, but I know everything's going to support Zsh), and I dunno if I want to use its syntax extensions over just Python. Though It's always on my list of things to re-explore, and maybe it'll click one day. But it being based in Python makes it feel slow (I wrote my prompt in Zig to get it to be fast...)

This is relevant to mention: I wrote a small Python library (https://github.com/kbd/aush) that's basically a DSL for subprocesses, so it tries to make it more convenient to do shell-like things. I find it preferable to shell or Python alone most of the time. Here's an example of its use in my script that creates a new Python project: https://github.com/kbd/setup/blob/master/HOME/bin/create-pyt...

I haven't figured out a convenient way to implement shell piping well with Python's pipe operator, or pass through interactive output directly (so things that "update" the display, like poetry and npm don't behave the same as they do interactively) so it's still .9 status, but it works really well for what it is, and you can always write "regular Python" along with it.

Anyway, Nu seems to be an attempt to put a "real" programming language REPL in my shell, from people who have serious language experience, so I'm hopeful it'll be great.

Re: The fish shell is amazing

#97
post #73
post #62

> Smart tab completion not only for the commands but for the arguments as well, and it apparently does that by parsing man pages. And it does this every time you spawn a shell. So if you have set your login shell to fish, then every time you launch a shell it loads all the fish plugins like this one, and that slows it down. And you can’t turn it off, or couldn’t the last time I checked around a year ago. Insult to in…

>And it does this every time you spawn a shell. It does not. The completion generation is on first start and whenever you run `fish_update_completions`. (note that the importance of man parsing is often quite overstated, it only gets you so far, all the advanced completion stuff is hand-written) Source: I'm a fish dev.

On NixOS, we generate the completions on behalf of users at install time, so they never have to see a slow startup at all. Fish makes it easy to do! Thanks :D

Re: The fish shell is amazing

#98
post #62

> Smart tab completion not only for the commands but for the arguments as well, and it apparently does that by parsing man pages. And it does this every time you spawn a shell. So if you have set your login shell to fish, then every time you launch a shell it loads all the fish plugins like this one, and that slows it down. And you can’t turn it off, or couldn’t the last time I checked around a year ago. Insult to in…

> So if you have set your login shell to fish, then every time you launch a shell it loads all the fish plugins like this one, and that slows it down

Fish completions and functions are lazy-loaded, so this doesn't happen unless you write your config to force it to happen.

Fish also provides you with functions you can use to check whether a shell instance is a login shell, is interactive, or is just being invoked as (part of a) script. If you do have some heavy-duty stuff you want to run on startup for your login shell or your interactive shells, you can do that selectively and keep Fish startup for other purposes fast.

Re: The fish shell is amazing

#99

> You can configure your shell using a web interface! Just run fish_config As much as I like the fish shell, I really consider this an anti-feature. A TUI application to configure the shell would make much more sense. The terminal emulator is your platform, not the Web.

The web configurator is a practical feature. I just tried it and it seems to work pretty well.

But you're in luck; looks like the next version will have everything also configurable via text: https://github.com/fish-shell/fish-shell/issues/3625

Re: The fish shell is amazing

#100
post #55
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…

Interestingly I moved from such a zsh setup to fish a couple of years back. Zsh with add-ons was noticeably slow compared to fish and syncing the config to all the devices I used.

ZSH plus oh-my-zsh cd’ing into a git repo with large LFS files will hang your shell even on very fast NVME storage.
Post reply on HN