I've been using Fish instead and it's much much simpler than configuring ZSH to my liking. It's already good out of the box, without having to carry around any kind of configuration. The only stuff I usually do is to setup `powerline-go` as prompt, and voilà, that's pretty much it.
Zsh Tricks to Blow Your Mind
51–60 of 218 posts
Re: Zsh Tricks to Blow Your Mind
#52My favorite alias, which is not really a zsh exclusive thing, is combining cd && ls : cl() { cd "$@" && ls; } It's wonderfully simple and saves me so much time by giving me an instant refresher of what's in the directory I just changed to.
Re: Zsh Tricks to Blow Your Mind
#53Earlier quoted context omitted.
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.
If the dizzying assortment of shell parameter expansion features (see man zshexpn), isn't enough to convince you, then the cause is lost.
The features need to be able to do useful things better somehow, and that's where articles demoing such applications come in.
"Better" also doesn't necessarily mean "more concise," otherwise APL would be one of the best programming languages. A language with a smaller number of accessible, comprehensible, memorable features can prove more useful in practice than one with a "dizzying assortment" that's hard to remember, difficult to read, etc.
Re: Zsh Tricks to Blow Your Mind
#54I've been using Fish instead and it's much much simpler than configuring ZSH to my liking. It's already good out of the box, without having to carry around any kind of configuration. The only stuff I usually do is to setup `powerline-go` as prompt, and voilà, that's pretty much it.
The main drawback for fish is that is not compatible with bash scripting. If you need help with something specific, you can throw out almost all help available online.
Re: Zsh Tricks to Blow Your Mind
#55Re: Zsh Tricks to Blow Your Mind
#56A 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 a shortcut which basically prefixes the current line with '#' comment character and then simulates hitting Enter (pushing the commented-out line into history buffer).
Re: Zsh Tricks to Blow Your Mind
#57I've been using Fish instead and it's much much simpler than configuring ZSH to my liking. It's already good out of the box, without having to carry around any kind of configuration. The only stuff I usually do is to setup `powerline-go` as prompt, and voilà, that's pretty much it.
Re: Zsh Tricks to Blow Your Mind
#58My company is fond of putting source code under very deep directory structures, so I quite like Z: https://github.com/agkozak/zsh-z Not ZSH specific, but it's also handy to load project-specific environment variables automatically on entering directories: https://direnv.net/ .
Re: Zsh Tricks to Blow Your Mind
#59A 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.
auto_pushd
Replaces internally cd with pushd (plus a few more: to ignore dups, be silent about it).Global aliases (interpolated anywhere in the commandline)
alias -g G='| grep -i'
cat file G something
Replace on the fly long directory names with short paths /some/long/path $ export X=`pwd`
~X $
All the tweaks to ignore dups in the history, when saving/searching.