6 ms·
A killer feature not listed here is global aliases. These are aliases that can be anywhere in a line. The most use I get out of this is from having alias -g
by kstock 12y ago
A killer feature not listed here is global aliases. These are aliases that can be anywhere in a line. The most use I get out of this is from having
alias -g L=' | less '
which allows me to simply append "L" to a line to pipe the output to less.
ls L
The pattern of short all-caps global aliases for ' | command 's make building/editing pipelines really easy/fast.
alias -g C=' | wc -l '
alias -g A=' | ack-grep '
alias -g S=' | sort '
alias -g JQL=' | jq -C | less'
ls **/*png L
ls **/*png A -v regex C
curl $site JQL
putting
bindkey '^g' _expand_alias
in your zshrc allows you to expand aliases with <C-g>
You can find more global aliases and tips at:
http://grml.org/zsh/zsh-lovers.html http://grml.org/zsh/zsh-lovers.html
- IgorPartola 12y agoSo what do you do when you want to ls a file called "L"?
- kstock 12y agoI put L in 'single quotes' or I \escape it touch 'L' ls 'L' ls \L
- pmoriarty 12y agoDo not use global aliases. They are dangerous. It's too easy to accidentally use them without realizing it, with unpredictable consequences. Much better is to use abbreviations which expand to the full command they abbreviate after you hit the space bar.[1] This way you can see exactly what's going to be done before you hit ENTER. It does cost one extra keystroke, but the safety is worth it. [1] - http://zshwiki.org/home/examples/zleiab http://zshwiki.org/home/examples/zleiab
- talideon 12y ago./L