Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I wanted to try vi mode in bash but now I would like to change it back to normal.

How can I unset -o vi ?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

The only two line editing interfaces currently available in bash are vi mode and emacs mode, so all you need to do is set emacs mode again.

set -o emacs
share|improve this answer
    
It should be noted that this was me reading between the lines rather than answering the question directly. emacs is the default line editing mode in bash. Setting emacs mode disables vi mode as a side effect, but as mentioned by jlliagre below, you can actually disable them both. –  Chris Down Dec 25 '12 at 11:37

That depends on what you define "normal". If that's turning off line editing, the documented way to unset -o vi is to set +o vi

$ set -o vi
$ set -o|egrep -w "(vi|emacs)"
emacs           off
vi              on
$ set +o vi
$ set -o|egrep -w "(vi|emacs)"
emacs           off
vi              off

Chris has already answered if your normal mode is emacs.

share|improve this answer
    
turning off the mode(s) also takes away the shell history feature, now I cannot use up/down arrow keys to see command history :( –  rsjethani Dec 24 '12 at 21:39
1  
It doesn't take away the shell history feature. You can still view your history with the history command and run previous commands by prefixing their number with the ! character. –  jlliagre Dec 24 '12 at 22:53
    
yes 'history' n family commands still work but the up/down arrow keys which I use more frequently do not work. As soon as I turn any of the modes on keys start working...I don't understand? –  rsjethani Dec 25 '12 at 7:57
1  
The up/down arrows are only managed by the shell if line editing is enabled (i.e. one of emacs or vi mode is set). Otherwise, the arrows keys just send their escape sequence unprocessed. –  jlliagre Dec 25 '12 at 9:59
    
thanks jlliagre :) –  rsjethani Dec 25 '12 at 15:24

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.