Ask Different is a question and answer site for power users of Apple hardware and software. 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'm having this werid and really annoying issue in bash vi-mode.

Env: Mac 10.9.2, iTerm 2 1.0 or, $TERM={screen-256color|xterm-256color|xterm|vt}

Repro steps:

  1. Run some long commands (like 'some_long_commands_long_long')
  2. Press Esc and then press k.

The issue is:

  1. I do see "some_long_commands_long_long" on my command line. But the cursor is not located at the beginning, instead it's on the 12nd char, see screenshot enter image description here

  2. If I press A to append some other text, the cursor will go beyond the command, which means the REAL command is start from where the cursor is located at the first place, the rendering is wrong.

    enter image description here

I searched on google but ended up with nothing..... Anyone has a better idea about this? Thanks a lot...

share|improve this question
up vote 1 down vote accepted

After debugging for quite a while I finally figured it out. It's an issue caused by PS1. Basically I forgot to wrap my colored ">" with "\[" and "\]".

share|improve this answer

Based on comments in Stackoverflow, IMHO the problem is in a tmux/iTerm/settings combination, not in the bash itself. you should try solve the problem step-by-step:

  1. start native with a clean ~/.profile and ~/.tmuxrc
  2. try set -o vi without tmux
  3. if it is works, (should) - switch to iTerm and check again (should works)
  4. start tmux in and in iTerm and compare... both should works.
  5. step-by-step enable your .tmuxrc config...
share|improve this answer
Thanks! After debugging quite a while I finally figoure it out. It an issue caused by PS1. Basically I forgot to wrap my colored ">" with "[" and "]" in my PS1...Thanks again for all the help! – Jiesi Luo Mar 5 '14 at 23:55

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.