Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an issue with zsh (or oh-my-zsh):

When I want to run a script in current directory, I do ./ In bash I could do .<TAB> and it would give me ./ where I could continue typing the script name ./sc<TAB> which would end up with ./

Now the problem is that when I do .<TAB> in zsh, I get a list of alternatives where none of them are ./.

The reason I'm not just typing ./ is that it's quite cumbersome on a Norwegian keyboard layout: . then SHIFT+7. Makes me feel inefficient :)

I've tried with zstyle ':completion:*' special-dirs true and some options like

setopt autolist
unsetopt menucomplete `

But nothing seems to work for me.

I'm quite new to this, so I'd really appreciate any help solving this!

share|improve this question
I know this annoying SHIFT+7 too well... some time ago I mapped one of these useless windows keys ;) to /. Since then it's real fun to type //////////. Perhaps that's an option for you, too. – mpy Apr 2 '14 at 17:13
up vote 1 down vote accepted

I don't know how to tweak the completion system, so that it expands . always to ./. But here is a workaround for the special case you have described, i.e. at the beginning of the command line:

expand-or-complete-special-dot() {
  if [[ $BUFFER == "." ]]; then
  zle expand-or-complete
zle -N expand-or-complete-special-dot
bindkey "^I" expand-or-complete-special-dot

This is a wrapper for the normal expand-or-complete function which is (by default) bound to TAB.

share|improve this answer
Brilliant! This is exactly the behaviour I want :) – Paaske Apr 4 '14 at 9:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.