#StackBounty: #zsh #oh-my-zsh zsh tab complete . to ./

Bounty: 100

Not a duplicate:
I’m not looking for a way to complete directory names or execute scripts from a fixed directory. The issue I’m trying to solve is to get completion for the current directory without pressing /


I want zsh to tab-complete . to ./ like bash.

With bash I’m used to press .TABTAB to see all files in the current working directory since it first completes to ./ and then shows all content in that directory. Reason for my desire to avoid / at all cost is that / is way harder on my german keyboard than TAB since it’s either with 2 fingers with shift or far away on numpad and I’d rather switch back to bash than type a /. What I’d like to achieve, in other words what bash does:

$ .               <TAB>
$ ./              <TAB>
foo.sh   somedir/
$ ./              <F><TAB>
$ ./foo.sh        <ENTER>

Using zsh / oh-my-zsh when I hit .TAB I get . (dot space) which is not useful at all for me.

  • Using zstyle ':completion:*' special-dirs true with setopt auto_cd (which is oh-my-zsh default) gives me the even less useful option for ../ on top, so I turned that off already. I’m happy with completion of cd.
  • There is no . on $PATH and it should stay that way. Though I wouldn’t mind completion of e.g. f<TAB> to ./foo.sh for example.

How can I teach zsh to complete . to ./ or even better to local directory content right away? Or is there another way to work with local script files in an efficient way that does not involve /?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.