Per https://cran.r-project.org/doc/manuals/r-release/R-intro.html#The-command_002dline-editor, for the R command line, the Readline init file defaults to ~/.inputrc
. Is there a way to specify another location for this file?
From the Bash manual:
Any user can customize programs that use Readline by putting commands in an inputrc file, conventionally in his home directory. The name of this file is taken from the value of the shell variable
INPUTRC
. If that variable is unset, the default is~/.inputrc
. If that file does not exist or cannot be read, the ultimate default is/etc/inputrc
.
When a program which uses the Readline library starts up, the init file is read, and the key bindings are set.
So anything equivalent to the following should work, provided that you are using Bash, that you have Readline installed, and that R was configured to find and use Readline:
$ export INPUTRC=path/to/init && R
If you just want R-specific customizations, then you can use an $if
directive in ~/.inputrc
to condition on application. An example from the R-intro
manual:
$if R
"\C-xd": "q('no')\n"
$endif
You probably already know that, since your question contains the same link. I'm mentioning it mainly for anyone else who comes across this.