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

1 Answer 1


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.

  • 1
    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! :-)
    – gen_Eric
    Jul 31, 2013 at 15:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .