I recently installed vim-latex plugin in gvim 7.4. I followed the documentation to set it up. Everything is working. But I have a problem. When I type in key expansion combination, the combination keys are also left with the expanded result. For example, pressing `^ should expands to \Hat{<++>}<++>. But it instead expands to


this is true for all. some examples


How can I solved this problem so that the key combination gets omitted when expansion happens?

  • From what I read here, vim-latex often seems to create more problems then it solves. There are numerous other plugins which perform all sorts of things, but for snippets I suggest looking at snipmate, and a suitable snippet file for TeX can be found here. They are also very easy to adapt to your needs.
    – Psirus
    Commented Dec 18, 2013 at 8:41

2 Answers 2


The following change to line 290 of the ~/.vim/plugin/imaps.vim file did the trick for me:


return a:char . "\<c-g>u\<bs>" . bs . IMAP_PutTextWithMovement(rhs, phs, phe)


return bs . "\<c-g>u\<bs>" . IMAP_PutTextWithMovement(rhs, phs, phe)

I have never before tempered with vim-script, so it might be, that this solution only works with my particular compilation of vim.

Also, I have not yet testet all of the mappings done via vim-latex IMAP and it could be, that the a:char is important for some of them.


Just add set backspace=start to the .vimrc will solve this problem. Because <bs> cannot delete the character before the undo point when backspace is not set.

In the file ~/.vim/plugin/imaps.vim, in the end of the function s:LookupCharacter there is some code like this:

let bs = substitute(s:MultiByteStrpart(lhs, 1), ".", "\<bs>", "g")
" \<c-g>u inserts an undo point
return a:char . "\<c-g>u\<bs>" . bs . IMAP_PutTextWithMovement(rhs, phs, phe)

The last line return what you have entered, and then creat an undo point use \<c-g>u, and then use several <bs> to delete the characters you have entered. However, when backspace is not set, <bs> cannot delete the character entered before the undo point.

The var bs is several backspace used to delete what you have entered.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .