Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question
    
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)? –  patrix Jan 2 '12 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... –  anonymous tekkie Jan 2 '12 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. –  patrix Jan 2 '12 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 –  anonymous tekkie Jan 2 '12 at 12:29
    
The -f test (does it exist and is it a file) should be -r (does it exist, is it a file and is it readable). Also, you can simplify the code a little to [ -r ~/.bashrc ] && . ~/.bashrc (it’s a matter of taste, but this style is used in /etc/profile, for example). –  Chris Page Jan 5 '12 at 8:27

2 Answers 2

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

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

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.