I’m a long time tcsh user, but all the cool kids seem to be using either bash or zsh nowadays (that is, completion patterns for git or stuff are available for bash and zsh, rarely for tcsh).
My problem is that both shells have behaviours regarding tab-completion of paths that drive me crazy, and I’m having much trouble finding how to change them to my liking.
Here’s a couple of examples of what I’m used to doing in tcsh that the others do differently:
/u<TAB>
completes to/usr/
- Then tab lists the contents of
/usr/
/usr/li<TAB>
completes to/usr/lib
and listslib/
andlibexec/
- Pressing tab a second time completes to
/usr/lib/
- Pressing tab a third time lists the contents of
/usr/lib/
In bash, no matter how many times I hit tab, it will never go past /usr/lib
, requiring me to type the slash, which I don’t want to do.
In zsh, /usr/li<TAB>
first completes to /usr/lib
, then another tab lists lib/
and libexec/
, a third time tab completes to /usr/lib/
, and all subsequent tabs cycle between /usr/lib/
and /usr/libexec/
. I have no idea how to get past this point. I just want to go from /usr/li
to /usr/lib
, then /usr/lib/
, then list its contents.
Same goes for python. In tcsh, I type pyt<TAB>
, it completes to python
and lists python
, python2.5
, python2.6
, etc, then a second tab settles for python and add the space. In bash it requires me to type the space and in zsh it cycles endlessly like in the first example.
Any help in taming these shells would be greatly appreciated. I don’t really want to spend time tweaking the other aspects of these shells until I solve the problem above.
man bash
/completion
rec_exact
option suggested below for zsh: it does exactly what I want, but I don't remember it popping up in my searches, and even if it did, I'm not sure I'd have understood that it was what I was looking for.