Philip
Philip

Reputation: 7293

Vim with R-plugin and LaTeX-Suite results in backslash in insert mode misbehaving

Here's what happens. I'm using Vim + LaTeX-Suite to edit TeX files in Vim. This could be in the Terminal or in MacVim.

I happily

Insert lots of $\LaTeX \commands$ etc. I love using the $\backslash$. 

TeX works great. No problem.

Then I go and open up a .R file in the same window (different tab). R-Plugin for Vim uses the <Leader> key (mapped to \ as per usual) to execute commands, e.g. I type \sa to send the selection to R and execute and move the window down. Life is nice.

Problem: even though while editing an R file, Vim is nice enough not to bug me in insert mode when I type \, for some reason when I switch back to the tab to edit the TeX file, then type \ in insert mode, it moves the cursor left of the \ and pauses as though waiting for the rest of the command, before then re-moving to the right of the \ and moving on as I type.

Below shows what happens just from typing \ in insert mode; obviously I could reproduce this by moving the cursor to the left with the arrow keys, but that's not how this happened--the cursor just moves left for a split second as though waiting for the R command to finish being input.

So: how can I stop the annoying behavior in the TeX file insert mode, without sacrificing other functionality? Note, (a) I don't expect mapping <Leader> to a different key to help since then that key will just have the same left-cursor-move problem in TeX; (b), I like the leader as \ anyway so I don't want to change it.

Upvotes: 4

Views: 430

Answers (1)

Aquino
Aquino

Reputation: 136

Put this line in your vimrc (requires Vim-R-plugin >= 0.9.9.2):

let g:vimrplugin_insert_mode_cmds = 0

If the problem persists, you can do the following in Normal mode to know what are the keyboard shortcuts in Insert mode:

:imap

Upvotes: 5

Related Questions