vim key mappings

The support for vim key bindings in RStudio is wonderful. However, many vim users remap to other keys (e.g., jk). This can be done at the command line in every session but that is burdensome, particularly if done for multiple modes. It there a way to make these key mappings permanent across sessions (e.g., like .vimrc for Rstudio)? Otherwise, its hard to imagine regularly using vim in RStudio when vim users are trained to automatically use different keys for in their other work.


How do you remap the vim key bindings for RStudio in the command line? I didn't know you could do that.

If you know how to do that ^, couldn't you also run a shell script and then it's just one command per session instead of n commands? Of course a .vimrc for RStudio would be preferable. I'm all in favor for your suggestion.

I love the vim key bindings for RStudio and wouldn't want to use RStudio without them but they also ever so often stop working and create funky results. I notice this happens more often when editing css files directly in RStudio. Then at some point the keys start producing completely random results, only workaround is to close the file and reopen it, sometimes even requiring the same for the project.

Key remapping can be done at vim’s command line. From normal mode type
to switch to command line mode. Then type
imap jk
to map jk to escape for insert mode. Similar remaps can be done for other modes.

By a shell script do you mean sourcing an r script or using the terminal? Any interest in putting together a quick demo for the above mapping to test this? :slight_smile: