Live data from Hacker News

Zsh Tricks to Blow Your Mind

twilio.com

11–20 of 218 posts

Re: Zsh Tricks to Blow Your Mind

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

Re: Zsh Tricks to Blow Your Mind

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

Re: Zsh Tricks to Blow Your Mind

#14
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.

> 5. `qalc` from libqalculate: https://github.com/Qalculate/libqalculate

Or, you know, any REPL available.

Re: Zsh Tricks to Blow Your Mind

#16
post #3

https://github.com/natethinks/jog/ I'm not sure why this isn't a part of zsh already, but if you want to see the last few commands you ran in the current directory, that little utility will do that for you. Great for reminding yourself what you did last time you were in a directory.

Wow jog is tiny:

    grep -a "${PWD}   " ~/.zsh_history_ext | cat | cut -f1 -d"|" | tail

Re: Zsh Tricks to Blow Your Mind

#17
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.

> 5. `qalc` from libqalculate: https://github.com/Qalculate/libqalculate Or, you know, any REPL available.

Or a simple `=() { bc -l Just a little shortcut but REPLs like Python's take a while to spin up, so it's pretty convenient.

Re: Zsh Tricks to Blow Your Mind

#18

None of these blew my mind. If you like terminal productivity I recommend: fzf, Facebook path picker (aka fpp), fd, ripgrep, lf, tig. Some honorable mentions: tokei, hyperfine, lazydocker, ctop, ncspot.

Solid selection. I'd also add nnn as the fastest tool to navigate directories I've ever seen.

Re: Zsh Tricks to Blow Your Mind

#20
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.

Bash supports at least a subset of emacs motion keys.

7. C-a C-k C-y # to park a command

Post reply on HN