Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 1 down vote accepted

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
$endif

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

Edit

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.

share|improve this answer

You must log in to answer this question.

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