问题
Sometimes while on the R console I accidentally type an unknown keyboard short cut that changes the editing mode from emacs to vi.
Does anyone know what is usually this combination of keys to change from one to the other?
I am on a Fedora 16 machine
I checked the info on this question but using meta+v or meta+e doesn't change anything.
UPDATE: The keystrokes shown the answer below work ONLY WITHIN R!
回答1:
R uses the GNU readline library for keyboard editing modes. I think the answer is therefore meta-ctrl-j
, based on these links: http://cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC22 ,
http://www.algorithm-forge.com/techblog/2009/09/shortcuts-in-r-under-unix-from-the-readline-library/ ...
(I'm running Ubuntu 10.04 under VMWare on MacOS 10.6, so I actually have to hit theAlt-fn-j
key combination to switch modes. I've never done it by accident!)
edit: as pointed out by the OP, Ctrl-e
goes back from emacs to vi mode. http://unixhelp.ed.ac.uk/CGI/man-cgi?readline+3 does say
"C-E" emacs-editing-mode
but this was pretty hard to dig up!
来源:https://stackoverflow.com/questions/13399874/vi-mode-to-emacs-mode-while-on-r