[R] R (unix) command line editing for native speakers of vi

Steve Dutky sdutky at starpower.net
Fri Nov 19 20:43:36 CET 2004


As an inveterate user of vi, I was pleased to stumble on how 
to use it for editing R commands.  

When an interactive R session is launched under unix, the 
command line editor most likely defaults to emacs. Typing 
<esc>,<ctrl>+j will switch this to vi editing mode (see below 
for possible exceptions).

excerpted from readline(3) manpage:
vi-editing-mode (M-C-j)
  When in emacs editing mode, this causes a switch to        
vi editing mode.

emacs-editing-mode (C-e)
  When in vi editing mode, this causes  a  switch  to emacs 
editing mode.


An  emacs-style  notation  is  used  to denote keystrokes. 
Control keys are denoted by C-key, e.g.,C-n  means  Control-
N.  Similarly, meta keys are denoted by M-key, so M-x means 
Meta-X.  (On keyboards without a meta key, M-x means ESC  x,  
i.e.,  press the Escape key then the x key.  This makes ESC 
the meta prefix.  The combination M-C-x means ESC-Control-x,  
or press the Escape key then hold the Control key while 
pressing the x key.)

see also:
An Introduction to R Appendix C: The command-line editor.
http://cran.r-project.org/doc/manuals/R-intro.html#The%
20command-line%20editor

Steve Dutky (sdutky at terpalum.umd.edu)




More information about the R-help mailing list