Sometimes I use the R console in the operating system terminal (i.e., by typing "R" in a Linux or MacOS terminal, or "R.exe" in DOS, etc.).
In that console, keyboard shortcuts that work in the RStudio console and RStudio editor no longer work. That, of course, is to be expected.
But what do I have to do to some keyboard shortcuts to work? For example, if I just wanted "ALT + -" to enter in " <- " just like it does in RStudio, what are my options?
In case it makes a difference, I am particularly interested in getting this working in a Linux terminal (I usually use Kitty) where my shell is zsh.
This sounds like a zsh question, so you might want to post it on Stack Exchange's Unix/Linux site, too:
My guess is you'll have to add the appropriate code to your .zshrc file, which controls the default behavior of zsh, but I'm not sure what they would be.
If the only or best solution is to a key mapping in .zshrc, then it would be something like
bindkey -s '\e-' ' <- '
where the \e stands for ALT, so \e- means ALT+-.
I suppose my question should have been more specific then. I should have asked more specifically whether this keymapping can be done in some R startup files, or whether it needs to be done in your shell startup files, or elsewhere.
I'm not aware of any way to modify key bindings within R itself, but maybe others are. However, from my own attempts to modify key bindings, my impression is that key bindings are interpreted by the active window, which can either use or override OS-level key bindings. So that if invoked in a terminal, R would rely on the terminal's key bindings since it's not responsible for the window. Maybe R GUI would allow it, if that were an acceptable alternative?