Live data from Hacker News

Zsh Tricks to Blow Your Mind

twilio.com

111–120 of 218 posts

Re: Zsh Tricks to Blow Your Mind

#112
What's the problem with everyone abusing hyperboles like that? No, my mind hasn't been blown by teh fact you can create a directory and enter it, and if I care enough I can reimplement this one and all others in Bash too and keep compatibility with all the machines I work on.

Re: Zsh Tricks to Blow Your Mind

#113
post #12
post #7

would like to chime in a faster theme written in rust: https://starship.rs/

Last time I checked it was slower than https://github.com/romkatv/powerlevel10k , because it doesn't decouple the rendering of the prompt from the background processes collecting status information. Ergo no instant prompt. Also, some other cool tricks w.r.t. prompt vs. backscroll. Has that changed?

Happy fish+starship user here. Recently all modules where refactored to load lazily: https://github.com/starship/starship/issues/2111 A PR adding full async support is close to being merged, which should fix lag issues for good: https://github.com/starship/starship/pull/2223

Re: Zsh Tricks to Blow Your Mind

#114

If you’re on 10.15 (Catalina) there’s no need to install zsh, it is the default shell. If you’ve upgraded and are still using bash, just do ‘chsh -s /bin/zsh’ to set the default to zsh.

What I would like is a blog post about making zsh less different than bash. I'll get to the mind-blowing tricks eventually, but for now I want the old tab completion and word stops back. Maybe I should just chsh back to bash, but the macOS copy of bash is really old now.

Re: Zsh Tricks to Blow Your Mind

#115
post #11

A lot of these can be easily done in Bash, too! 1. `mkcdir () { mkdir -- "$1" && cd -- "$1"; }` 2a. `bind '"\e[A":history-search-backward'; bind '"\e[B":history-search-forward'` 2b. Default behavior for Bash. 3. `shopt -s autocd` 4. `mmv`, `perl-rename` 5. `qalc` from libqalculate: https://github.com/Qalculate/libqalculate 8. Default behavior for Bash. 9. Default behavior for Bash.

> 4. `mmv`, `perl-rename`

I didn't have this on my system. I like the article because this was a command I've needed many times without realizing it.

Re: Zsh Tricks to Blow Your Mind

#116

> If you've typed or pasted a long command and decide you need to edit it before running, ctrl-x-e opens it in an editor Jeez, this is great!

This works in bash too. To see all keyboard shortcuts in bash, type "bind -P". There are lots of neat things in there.

Re: Zsh Tricks to Blow Your Mind

#118
post #66

I'm more amazed how that page is unreadable, starting from typography up to color scheme.

the kerning in the screenshots is "hilarious"

looks like a version of Comic Sans, possibly http://www.comicneue.com/

or as recently discussed Comic Mono: https://news.ycombinator.com/item?id=25520510 https://dtinth.github.io/comic-mono-font/

Re: Zsh Tricks to Blow Your Mind

#119
post #11

A lot of these can be easily done in Bash, too! 1. `mkcdir () { mkdir -- "$1" && cd -- "$1"; }` 2a. `bind '"\e[A":history-search-backward'; bind '"\e[B":history-search-forward'` 2b. Default behavior for Bash. 3. `shopt -s autocd` 4. `mmv`, `perl-rename` 5. `qalc` from libqalculate: https://github.com/Qalculate/libqalculate 8. Default behavior for Bash. 9. Default behavior for Bash.

This is always my complaint about posts like this. I read them looking for the killer feature to make me consider switching from bash and it's always stuff bash does natively or with a one line alias.

It's because these posts are late.

Do you know why "bash does [these things] natively"? Because zsh had them 20 years ago when bash was barebones and people were envious and over time bash started copying these features over. Sometimes poorly.

And for the "one line alias", in a bunch of cases it's with additional commands, which are not always available, the most famous example being rename.

Which rename? The binutils one (I think) or the Perl one (which has more features)?

Does your distro even package both?

Things can be a lot more complex than they seem.

Post reply on HN