When punching away at the keyboard on the octave command line, I sometimes find that the various readline shortcuts stop working, e.g. C-a and C-e just insert ^A and ^E.

It took me a while to realize that this is because I've accidentally switched to vi-editing-mode, and indeed there's is a toggle-editing-mode (C-M-j) documented in an old version of the octave manual.

My question is, how do I return to emacs-mode? I can't find any shortcut listed anywhere.


After much web-searching and manipulation of ~/.inputrc, I accidentally found that C-e in vi-command mode actually does the trick and executes emacs-editing-mode. This is discussed in this posting, but with regards to bash, they must be related somehow, but I can't find how by looking in the octave sources.

Knowing what to look for also allowed me to find, one way to change this binding through ~/.inputrc:

$if mode=emacs
  set keymap vi

  "\e\C-j":   emacs-editing-mode
  "\C-x\C-r": re-read-init-file

  set keymap emacs

Anyway, seems I should be reading readline.info and perhaps also history.info.


Added C-M-j as a vi binding to switch back to emacs, in addition to the default C-e. Also added a vi-binding to re-read ~/.inputrc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.