Live data from Hacker News

Fish shell 3.0

github.com

101–110 of 227 posts

Re: Fish shell 3.0

#101
post #95

Earlier quoted context omitted.

There must be a disconnect here, manually entering a single quote, then pasting my URL, then adding the closing quote is precisely what I wish to avoid. Here is a demonstration about what I'm talking about: https://i.imgur.com/d64lwaB.mp4 > "We don't attempt to detect URLs because that can go wrong, and because we don't know your intention." That much I've gathered from seeing this issue raised with fish people in th…

> How often do users of the fish shell paste a string that starts with 'http' and contains a '?' that is meant to be a wildcard? Okay. Now you can do it for http. What about ftp? Or "file://"? Do we detect _all_ kinds of URLs? And even if we do, and we don't miss some or see something as a URL that isn't, what about _other_ kinds of things? What about shellscript? E.g. if I want to just execute a bash one-liner from…

> Okay. Now you can do it for http. What about ftp? Or "file://"? Do we detect _all_ kinds of URLs?

Some is better than none, that's the lesson learned from OMZ's implementation of this feature. It doesn't cover every single scenario, but it covers enough to make people's lives easier in the common cases. That is the sort of bold decision making that the fish developers should be doing.

    `bash -c '`
    sftp://${SFTP_USER}:${SFTP_PASSWORD}@example.com/directory/filename
Both of these get pasted unchanged in zsh. I suggest you try it out. But more to your point, this would get improperly escaped:

    http://${SFTP_USER}:${SFTP_PASSWORD}@example.com/directory/filename
And you know what? That's fine. Because whether you choose to auto-escape or not, something will break. The question you and the fish developers should be asking is which is more likely? Auto-escaping works the vast majority of the time and only fails some of the time. And when it fail in the rare case, the UX is no worse than when it fails in the common case.

>"If you paste it insde single-quotes, it'll be escaped."

First of all, that's not what I see. Maybe you're talking about bracketed paste mode or something that's invisible to the user, but when I paste a URL containing wildcards into single quotes in fish, I don't see any escaping taking place. I assume single quotes are the "verbatim quotes", e.g. `ls '*.txt'` doesn't show you all txt files because that wildcard isn't expanded inside those single quotes. With that in mind, it's not clear to me why a string pasted into single quotes should be escaped, it doesn't need escaping and I don't see any escaping being done when I try it out myself.

There's nothing magic about making `mpv 'https://www.youtube.com/watch?v=LBoF1e5YDdQ'` work. Dumb old bash accepts that too.

Re: Fish shell 3.0

#102

My favorite feature of fish is `abbr`, e.g. `fish abbr --add g git`. Then you type `g` followed by space and it just expands it to `g` and you then get all the autocomplete goodness and don't have to futz with adding autocomplete support to an alias, because it is the real command. It also helps for presentations because instead of some obscurely named alias, you can type an abbreviation and it just expands it out fo…

zsh also does correct autocompletion for aliases, if you enable the counterintuitively-named 'no_complete_aliases' option

Re: Fish shell 3.0

#103
post #50

Earlier quoted context omitted.

Though I've really grown toward the 'everything as a function' pattern that Fish is trying to do, this is definitely a step back in the right direction. I might even wish for `$()` to be supported as well to allow even better copy pastable oneliners from Bash.

Your quoting is a bit confusing, as "`cmd...`" and "$(cmd...)" are similar,, while backtick-dollar-paranthesis is just asking for trouble... ;) I take it fish didn't / doesn't support either?

Sorry for the confusion, I'm to used to `` as code style for markdown, forgot HN doesn't support it. I'm glad Fish doesn't support the backtick syntax :). Like others mention it just drops the dollar from a 'regular' parenthesis expansion.

Re: Fish shell 3.0

#104
post #95

Earlier quoted context omitted.

> How often do users of the fish shell paste a string that starts with 'http' and contains a '?' that is meant to be a wildcard? Okay. Now you can do it for http. What about ftp? Or "file://"? Do we detect _all_ kinds of URLs? And even if we do, and we don't miss some or see something as a URL that isn't, what about _other_ kinds of things? What about shellscript? E.g. if I want to just execute a bash one-liner from…

> Okay. Now you can do it for http. What about ftp? Or "file://"? Do we detect _all_ kinds of URLs? Some is better than none, that's the lesson learned from OMZ's implementation of this feature. It doesn't cover every single scenario, but it covers enough to make people's lives easier in the common cases. That is the sort of bold decision making that the fish developers should be doing. `bash -c '` sftp://${SFTP_USER…

>Some is better than none, that's the lesson learned from OMZ's implementation of this feature.

I disagree. I'd rather have predictability here.

>when I paste a URL containing wildcards into single quotes in fish, I don't see any escaping taking place.

That's because you've not pasted anything that needs escaping. In single-quotes, only single-quotes and backslashes are special, and they are escaped.

Even if you paste script that itself contains single-quotes, it'll work.

Re: Fish shell 3.0

#105
post #45

Earlier quoted context omitted.

Yet the thought of a shell with a web interface made me shudder at first. Like those electron based terminal emulators.

It's a python script, using python's http.server. If you're not executing `fish_config` explicitly, nothing is running.

Nice use of the Python http module. Never looked into the function before tbh (didn't expect the server to be running in the shell though). But just did using `funced` (which I just discovered in the changelog, nice feature as well).

Re: Fish shell 3.0

#106
post #19

So weird. Last night I ran a bunch of updates and spent some time cleaning up and configuring my laptop. Preparing for the New Year. I tried to upgrade Fish and saw that it hadn't had an update since this time last year. I ended up looking through the release logs and just reading the Fish docs a bit. I never do this. Now, this morning, this is on Hacker News.

It's not weird, it's a cognitive bias: Frequency illusion (or Baader–Meinhof effect): The illusion in which a word, a name, or other thing that has recently come to one's attention suddenly seems to appear with improbable frequency shortly afterwards. https://en.wikipedia.org/wiki/List_of_cognitive_biases

Yeah, I was thinking that too but I look at Hacker News daily and at least once a week a coworker bugs me about using Fish. So it's not like the idea or thought is new to me. In particular this one was weird because I was not only thinking about Fish but checking specifically for an upgrade which I've never cared much about before.

Re: Fish shell 3.0

#107
post #104

Earlier quoted context omitted.

> Okay. Now you can do it for http. What about ftp? Or "file://"? Do we detect _all_ kinds of URLs? Some is better than none, that's the lesson learned from OMZ's implementation of this feature. It doesn't cover every single scenario, but it covers enough to make people's lives easier in the common cases. That is the sort of bold decision making that the fish developers should be doing. `bash -c '` sftp://${SFTP_USER…

>Some is better than none, that's the lesson learned from OMZ's implementation of this feature. I disagree. I'd rather have predictability here. >when I paste a URL containing wildcards into single quotes in fish, I don't see any escaping taking place. That's because you've not pasted anything that needs escaping. In single-quotes, only single-quotes and backslashes are special, and they are escaped. Even if you past…

The truly unpredictable UX is when a noob tries to paste a youtube url into their shell and gets a bewildering error message about a wildcard (and the error message carrot doesn't even point at the guilty wildcard!) That is very far from the behavior the user was predicting, unless they've been around the shell block a few times already (in which case they could probably make due in a shittier shell anyway. Is fish optimizing for 'user friendly' or 'user friendly for experiences users'?)

Re: Fish shell 3.0

#108
post #54

The one thing I miss most in fish is subshells, because I love writing things like ( (cd $dir && ./run_prog && cd PKG && ./do_stuff) & ), to run a series of things in the background. Is there any way to do something similar in fish?

I also do that, often with loops. for ((i=0;i out-$i.log 2>&1 ) & done Can be anything from image processing, video transcoding, file decompression, file system analysis - anything I think may complete faster with some concurrency.

That's a nicer notation than me! I thought you needed a ; before the 'done', and & ; won't parse.

Re: Fish shell 3.0

#109
post #104

Earlier quoted context omitted.

>Some is better than none, that's the lesson learned from OMZ's implementation of this feature. I disagree. I'd rather have predictability here. >when I paste a URL containing wildcards into single quotes in fish, I don't see any escaping taking place. That's because you've not pasted anything that needs escaping. In single-quotes, only single-quotes and backslashes are special, and they are escaped. Even if you past…

The truly unpredictable UX is when a noob tries to paste a youtube url into their shell and gets a bewildering error message about a wildcard (and the error message carrot doesn't even point at the guilty wildcard!) That is very far from the behavior the user was predicting, unless they've been around the shell block a few times already (in which case they could probably make due in a shittier shell anyway. Is fish o…

>The truly unpredictable UX is when a noob tries to paste

Yes, and you've not solved that.

You've only solved that one special edge-case where they're pasting "a youtube url".

This only pushes the confusing bit further along, and adds some more cruft on top!

Quoting is a fact in shells. The way these languages work is through loads of string interpolation, so you kinda need to learn that. And I'd prefer to make the rules there simple than add special cases for URLs.

Re: Fish shell 3.0

#110

My favorite feature of fish is `abbr`, e.g. `fish abbr --add g git`. Then you type `g` followed by space and it just expands it to `g` and you then get all the autocomplete goodness and don't have to futz with adding autocomplete support to an alias, because it is the real command. It also helps for presentations because instead of some obscurely named alias, you can type an abbreviation and it just expands it out fo…

You can also type fish_config to launch the fish config web app in your browser. From there you can add, edit and remove abbreviations from the “abbreviations” tab directly.

I find this a really user-friendly way of managing abbreviations I've created.

Post reply on HN