My favorite text editor beeing VIM made me add the follwing line to my ~/.bashrc

set -o vi

As expected, hitting escape lets me execute a vi command, BUT ONLY ONE ?!? For example if I do this:

escape, b, b

it jumps to the beginning of the word and then types "b" to the line instead of jumping another word back.

This happens on all my osx boxes (10.6 and 10.7) and non of the linuxes I use.

Anyone else experiencing this? Or is this expected?

  • Hmm, works as expected here, what other settings do you have defined? Maybe you can add the output of set -o to your question (or post it as a comment for somebody with editing rights to add)?
    – nohillside
    Commented Jan 2, 2012 at 11:09
  • Thanks for that, I created a ~/.bashrc with only set -o vi and it seems that terminal ignores it because set -o shows emacs on... investigating further, hints welcome... Commented Jan 2, 2012 at 12:16
  • Try to run bash --norc --noprofile and set vi mode manually. If this works the problem is in one of the init files.
    – nohillside
    Commented Jan 2, 2012 at 12:19
  • Yep, that fixed it. osx terminal is starting bash as login shell. created a ~/.profile with if [ -f ~/.bashrc ]; then . ~/.bashrc fi this way I only have to worry about the rc and can copy it between systems. Thanks for hints patrx Commented Jan 2, 2012 at 12:29
  • 1
    I'm having the exact same issue. I have my default shell set to zsh rather than bash and generally use iTerm rather than termal, but I removed my .profile and .zshrc files and tried in terminal as well and same issue? any other insights? Commented Oct 24, 2012 at 16:52

3 Answers 3


You can use C-xC-e to go into editor mode. This will use vim if your $EDITOR is set to vim. Also, if you switch to zsh there are options to have a psuedo-normal mode on the command line. See this blog post describing it: http://www.civet.ws/?p=165


If you're using set vi then C-xC-e will not open your editor as Conner suggested. Instead, use Escv.


This problem can come up when you have both ~/.bash_profile (or ~/.profile) and ~/.bashrc files with different settings. To determine if this is your issue, try typing these commands to start a "clean" bash prompt and set vi mode therein:

bash --norc --noprofile
set -o vi

If the vim keybindings don't vanish after one movement, then read on.

The fix for me was first to change ~/.bash_profile to only read:

[ -r ~/.bashrc ] && . ~/.bashrc

Then I put the set -o vi option in ~/.bashrc.

For me, it was no problem for .bash_profile to refer exclusively to .bashrc. Notably, command-line tools with automagic installers like [gvm|http://gvmtool.net/] and [rvm|http://rvm.io/] may manipulate your .bash_profile file, so you may need to set it back after an install or update of those.

You must log in to answer this question.

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