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.

I have seen in blogs on Linux machines you can edit the current bash shell command in VI (or whatever the EDITOR is set to) by pressing ctrl-x,ctrl-e.

This doesn't seem to work on 10.8. Any ideas on how to edit the current bash command in the default editor?

share|improve this question
    
This should work in 10.8 (at least it does for me). Did you try to unset FCEDIT and EDITOR? –  patrix Apr 11 '13 at 18:23
    
The documentation for C-xC-e is here -- what's in your VISUAL variable? –  glenn jackman Apr 11 '13 at 21:29
    
it is not about 10.8. I am on 10.8 and it works fine with me. I did not change anything in my .bash_profile to enable this. –  Vincent Apr 12 '13 at 2:37

1 Answer 1

up vote 3 down vote accepted

You want set -o vi (add it to your ~/.bashrc). Then, to edit the current line, just hit Esc to enter command mode.

See http://www.gnu.org/software/bash/manual/bashref.html#Readline-vi-Mode

To edit the current command in a full-screen editor, set your VISUAL environment variable to vim (I assume you want vim), then in command mode in the current comment, hit v.

share|improve this answer
    
pressing the "v" was the secret sauce I was missing. thanks. –  Scott Walter Apr 27 '13 at 0:32

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.