Invoke 'less' smartly
One of the nice little things about Git is that if the output of a command is long, then it is displayed in less. If output of a command is short, it is just displayed (there is no interactive Git involved). One can make Mercurial suck less by emulating this behavoiur with Pager extension.
Would be it nice to have this automatic less for everything, not just hg and git? Add this one line to your .zshrc:
AL() { $* 2>&1 | less -FSRX }
Now you can call commands like AL ls /tmp/mydir
and enjoy having pager only when you need it. -R
option makes less not mess up colour escapes.
Have easy access to newest download
I set chrome to automatically download everything to ~/downloads folder. I often want to do something with newest downloaded file (like open it or move somewhere else).
alias -g @@NDL='~/downloads/*(.om[1])'
You can use anything that is unlikely to collide with anything else instead of @@NDL
(which stands for Newest DownLoad). Now you can use it like:
acroread @@NDL mv @@NDL .
Parenthesis after glob is qualifier. Dot stands for file, om
Ordered by Modification. One is there because om[0] always matches current directory.
No comments:
Post a Comment