Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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 zsh 4.3.10 installed on a RHEL 6.4 box. I'm not sure why this happens, but when I but Tab to autocomplete things, it also adds a tab character.

For example:

rocket@rhelbox www % vim    vim
external command
vim vimdiff vimtutor

So, when I type VIMTab, after the Tab it adds a tab to my console, then finishes the autocomplete action. The command works fine, it's just annoying. I cannot backspace to remove it either. I don't know what's causing this.

Here's my .zshrc:

# Initialize Autocompletion and Autocorrection
autoload -U compinit promptinit
#prompt redhat
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'
zstyle ':completion::complete:*' use-cache 1
setopt correctall

# Custom PS1
autoload -U colors && colors
# http://www.understudy.net/custom.html#Z_color
#PS1="%n@%m %c %% "
PS1="${fg_purple}%n@%m %{$fg[yellow]%}%c %% %{$reset_color%}"

# cd is automagically added
setopt autocd

# Save History
setopt hist_ignore_all_dups

# Keybindings
bindkey "^[OH" beginning-of-line
bindkey "^[OF" end-of-line
bindkey '^?' backward-delete-char
bindkey "\e[3~" delete-char

# Aliases
alias ls="ls --color=auto"

# Set (SVN) Editor to vim
export SVN_EDITOR=vim
export EDITOR=vim
share|improve this question
up vote 7 down vote accepted

This is likely caused by your setting of the prompt confusing zsh about where the cursor is in the terminal. You've included terminal control characters in your prompt without letting zsh know that those won't actually show up on the terminal.

This needs to be done by surrounding those portions of the prompt with %{ and %}. This has already been done when setting the color to yellow and when resetting the color, but has not been done where you set the color to purple at the beginning.

share|improve this answer
That was it! Adding %{ and %} around ${fg_purple} fixed this problem. Thanks so much. To be honest, I copied and pasted the PS1 part from a website, and it seemed to work on other machines, so I never thought about it. I wondered what %{ and %} did, but never looked it up. Thanks again! :-) – Rocket Hazmat Jul 31 '13 at 15:02

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.