[R] vi readline key bindings -- some work, some don't
Mark Ebbert
Mark.Ebbert at hci.utah.edu
Thu Jul 1 04:34:00 CEST 2010
Dear R Gurus,
I have spent some time in the R mail archive and only found one thread that mentions key binding (http://tolstoy.newcastle.edu.au/R/help/06/03/22481.html).
I use R (2.9.2) from the command line using OS X's (10.6.4) Terminal.app. I have spent a fair amount of time trying to understand the relationship between readline and other command line tools (e.g. bash, R, etc.). Following several tips I figured out how to set appropriate key bindings for common command line manipulations, especially when it comes to history searching. The problem is that while all of these key bindings behave properly in bash, they do not in R (at least not all of them). Here is a small list of those that work:
1. Ctrl-r (reverse search). Worked by default without modification
2. "\e[A": history-search-backward and "\e[B": history-search-forward -- I added these
3. The more typical vi keybindings (e.g. h,j,k,l, etc.). This changed when I "set editing mode vi"
What does not work:
1. Ctrl-s (forward search). Not sure why, the binding was there by default.
2. "\e[5~": beginning-of-history and "\e[6~": end-of-history -- This seems to work ok if I have my readline keymap set to "vi-command" or "vi-move", but not if I have it set to "vi-insert". However, the situation is reversed in bash (plus other key bindings break). This is really the most important one to me. When I'm searching through history, I'd like to be able to get the beginning and end easily.
Has anyone had success with this?
I also cannot find anything that details the difference between "vi-command," "vi-insert" and "vi-mode"
Most of what I'm accomplished has come from the following resources:
http://cnswww.cns.cwru.edu/php/chet/readline/readline.html
http://tech.inhelsinki.nl/gnu_developement_under_mac_os_x/
I appreciate any help.
ME
More information about the R-help
mailing list