*scratch*

It is not a diary the most people have rather a *scratch* Emacs buffer. It keeps notes about everything related to Linux, Open Source, UNIX, MacOSX and software engineering.

Friday, May 20, 2005

 

indispensable ZSH

Wiki
FAQ
The User Guide by Peter Stephenson
.source
prompt example
Shellllllssssss ...
dope's zsh-lover page
zsh-lovers
Zsh Workshop

!$ # last argument
!$:h # last argument, strip one level

cd !?ls #get command and parameters of a previous ls command
cd !?ls?:* #get (just) parameters of a previous ls command

!:0 # is the previous command name
!^, !:2, !:3, ..., !$ # are the arguments
!* # is all the arguments
!# # get command + arguments but last one
!-2, !-3, ... # are earlier commands
!-2^, !-2:2, !-2$, !-2*

cd !$:h # remove file name
cat !!:t # only file name
$ for i in **/*.gif; convert $i $i:r.jpg # Convert images (foo.gif => foo.jpg)

print ^x* # list all but x*
print (x*~x3|x5) # list files x* except x3 and x5
print *.c(:r) # strip suffix
print *(m0) # files modified today
print *(n:t) # order by name strip directory
print **/*(On:t) # recursive reverse order by name, strip director

file =ls # execute file command against /usr/bin/ls or /bin/ls in $PATH

autoload zmv # zcp
zmv '* *' '$f:gs/ /_' # Replace spaces in filenames with a underline
zmv -W '*.sh' '*.pl' # Change the suffix from *.sh to *.pl
zmv '(*).txt' '$1.log' # replace all foo.txt to foo.log
zmv '(*)' '${(L)1}' # lowercase
zmv '(*)' '${(U)1}' # uppercase

M-q push-line # remember the line in the stack

print -z # print the line to command line directly for editing

Archives

December 2004   January 2005   February 2005   March 2005   May 2005   July 2005   October 2005   January 2006   March 2006   May 2006   July 2006   December 2006   January 2007   February 2007   May 2007   July 2007   November 2007   January 2008   February 2008   July 2008   August 2008   September 2008   November 2008   April 2009  

This page is powered by Blogger. Isn't yours?