I'm trying to configure zsh to closely fit how bash behaves before I fully switch, and one behavior I'm trying to modify in zsh is when it inserts a Tab character.

I see how it could be helpful for writing functions interactively, but I prefer bash's behavior of listing the directory contents. Ideally, I would like to cycle through the directories using a menu, but my main priority is to list directories like Bash after one or two Tab presses instead of inserting a Tab.

I did try to look this up, but everything I found only pertained to disabling Tab Completion entirely.

EDIT: I mistakenly thought bash's default completion on empty input was to list the directory when I posted this, I feel like it may have caused some confusion with what I was asking.

My main objective is to prevent zsh from inserting a Tab when there is only whitespace.

  • 1
    Take a look at some of the configuration options on Arch Linux's zsh docs.
    – ladaghini
    Oct 21, 2013 at 18:26
  • I used that configure Zsh initially. It looks like the tab behavior itself might be related to "zstyle ':completion:*'" under "Command Completion", but I can't figure out what I exactly need, or if this is the correct way about it.
    – user22531
    Oct 21, 2013 at 18:35
  • You're not using oh-my-zsh or anything are you? The default behavior of tab completion is to expand a list of files matching the path, just as bash does.
    – phemmer
    Oct 21, 2013 at 18:45
  • Nope, I'm not using oh-my-zsh. I think I should have just focused on one thing in my question instead of addressing what I'm going for overall. In bash, if there are no potential completions, nothing happens, but in zsh, a tab character is inserted. I just want to disable zsh's tab character insert when there are no completions.
    – user22531
    Oct 21, 2013 at 18:53
  • 1
    The only circumstance in which pressing Tab inserts a tab is on a line containing only whitespace, at least in my configuration and in the default configuration. Since this is different for you, please post your .zshrc. Do you also want to complete all commands on an empty line? Oct 21, 2013 at 22:52

1 Answer 1


Setting the insert-tab tag to false will prevent a tab from being inserted when there are no characters to the left of the cursor.

zstyle ':completion:*' insert-tab false

You must log in to answer this question.