Everything you know from bash still applies, but zsh does a bunch of other useful things. I know that I use only a small subset of them, but these are especially useful for me:
- Extended globbing: For example, matches only regular files, not directories, whereas
*(.)matches directories whose names start witha*z(/)and end witha. There are a bunch of other things, such aszas described by Ole Tange.** - Inline glob expansion: For example, type and then hit tab. The glob
rm *.pdfwill expand inline into the list of .pdf files, which means you can change the result of the expansion, perhaps by removing from the command the name of one particular file you don’t want to*.pdf.rm - Interactive path expansion: Type and hit tab. If there is only one existing path each of whose components starts with the specified letters (that is, if only one path matches
cd /u/l/b), then it expands in place. If there are two, say/u*/l*/b*and/usr/local/bin, then it expands to/usr/libexec/bootlog.dand places the cursor after the/usr/l/b. Typel, hit tab again, and you geto./usr/local/bin - Nice prompt configuration options: For example, my prompt is currently displayed as . I prefer to see a suffix of my current working directory rather than have a really long prompt, so I have zsh abbreviate that portion of my prompt at a maximum length.
tov@zyzzx:/..cts/research/alms/talk
The ones not already listed here are :
Advantages that I appreciate:
- Auto-correct on known commands
- Auto-complete : This is different from the default bash autocomplete
e.g
You typekilland press <tab>. Instead of a list of files in current directory, you'll see all your processes with their pids.- Remote auto-completion :
So I can view remote file listings :
Now if I press <tab>, I can view the remote directory listing on the remote server- Expand variables
~/ $PATH <tab>
you get =>
~/ /usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/mri dul/.rvm/bin
- Use Alt-/ (forward slash) to move through argument history
- Shared command history between all running shells.
This is something some people appreciate and some others wouldn't like. But I find it useful for myself.
Advantages that I appreciate:
- Much easier prompt definitions. Particularly dynamic/multine prompts.
- Right Prompt? Yes, thank you!
- Awesome set (more comprehensive than BASH) of Auto Completions are much faster and smarter (e.g. case insensitive completion, smart defaults)
- Path Expansion is pure win. (cd /v/w [tab] == cd /var/www)
- Path Replacement is pretty cool also.
- Spelling Correction (setopt correct) is mighty awesome for me.
- oh-my-zsh - Large, community driven framework for all sorts of bells and whistles.
- The Zsh Line Editor... just google it
- Key Bindings? Yes, thank you!
- Globbing
Comments
Post a Comment