learning a new shell: zsh
So I’ve decided to start learning a new shell. I see so much talk about zsh and finally, I’m going to attempt to learn to use it. I installed it and started using it and a few things are immediately different.
Command completion is different, but slightly annoying. I like how completion doesn’t scroll the terminal, it is paged AND appears below the command being completed. (I didn’t like that at first, but now I think its actually quite ingenius) That being said, I which movement around the completion was more vi-like. I want to use my home row movement keys “h j k l” and not move my hand all the way down to the arrow keys. Talk about inefficient. Any zsh’ers out there know how to change that? I’m sure there is a way, but I really haven’t had the time to go through a lot of documentation on it.
I’ve started to realize my only attachment to bash is familiarity and not features. I’ve used bash for more than 5 years now and while I use it extensively, I really believe that zsh most likely has done it better than bash. A few things hint me this way just by using it for a few moments.
Btw, what’s with zsh assuming when I type something like:
bin
It cd’s me into my bin directory. That’s all well and good, but when it comes to ‘help’, it just cd’s me into my help/ directory… Is there no bash help equivilent in zsh? I guess I’d just find that rather odd as I am assuming there are plenty of shell built-in commands and help just seems natural. Or maybe bash has tainted my “natural” sense.
Anyways, I’m on this new kick of trying to blog reguarly, so I really just needed an excuse to blog. Let me know where to start with zsh!
October 6, 2009 at 10:51 am
I can’t recall to have seen something similar to bash’s “help” command … For zsh: man zsh* is your friend
But at least you can stop the the automatic cd-ing, if you put “setopt noautocd” into your .zshrc
Concerning your completion question: The completion system is quite complex and can be configured in many many ways. To have the vi-bindings in the completion menu, you need to have the following in your .zshrc
zmodload -i zsh/complist
bindkey -M menuselect ‘h’ backward-char
bindkey -M menuselect ‘j’ down-line-or-history
bindkey -M menuselect ‘k’ up-line-or-history
bindkey -M menuselect ‘l’ forward-char
There are tons of different .zshrc’s out there … I’ll just post the link to my one too
-> http://bazaar.launchpad.net/~necoro/%2Bjunk/zsh/annotate/head%3A/zshrc
October 6, 2009 at 11:58 am
‘I can’t recall to have seen something similar to bash’s “help” command …’
@Necoro, at least in Debian you have a nice ‘man bash’.
What distro are you using?
October 6, 2009 at 1:06 pm
I’ve been pushing zsh with a Bof and Open space at OLF/PyOhio recently.
I don’t usually scroll through completion so not sure on that one. I view completion as a list and then type the next little bit I need to get tab to finish the job.
I’ve setup a sample list of cool things zsh does well and sample zsh config to get people started here:
http://github.com/mitechie/zshrc
October 6, 2009 at 1:56 pm
@Debianero:
I meant, that I do not know of a parallel of bash’s ‘help’ in zsh.
October 6, 2009 at 10:01 pm
Also you can use
bindkey -v
to mimic vi behavior.
October 7, 2009 at 10:57 am
There is run-help:
http://zsh.sunsite.dk/Doc/Release/User-Contributions.html#SEC267