Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm editing a lot of tex files using vim, and therefore I use the \ character a lot. Yet, when inserting a \ in insert mode, vim pauses the cursor on the same spot for one second, unlike with any other character.

Of course I don't have to physically wait for one whole second, I can just keep on typing, yet the text is only inserted after this second.

I found that I can create similar behavior by mapping e.g.:

inoremap ;; <esc>:
inoremap jj <esc>

etc. It seems as if vim is expecting another character to follow, so it can evaluate the map.

Unsetting \ as the mapleader doesn't alleviate the problem though, which is what I expected.

Also, I don't know if this is related, but using <esc> in insert mode doesn't work instantly (again because vim expects something to come after).

Is there a vim setting that let's me put the paste time to 0, yet I still want to be allowed to use my mappings ;;, jj and <esc>.

I know about timeout yet this doesn't help. If I do timeoutlen=0 none of the multi-key mappings would be useable.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

You've identified the problem: \ is being used as the first character of an imap. To find out where it is being set you can execute

:verbose imap \

I don't have any solution other than to eliminate the mapping or unmap it when you're editing TeX files. You can do that by putting a line like this in a file named ~/.vim/after/ftplugin/tex.vim on Unix or ~\vimfiles\after\ftplugin\tex.vim on Windows:

silent! iunmap \x

where you would replace x by the corresponding part of the offending mapping.

I use LaTeX a little, have the Vim-LaTeX-Suite installed, and do not see that behavior, so at least it's not a problem with that suite.

share|improve this answer

It looks like you have an insert mode mapping starting with "\", possibly set by a plugin you have recently installed. To find if you do, and what file created the mapping(s), run this command:

:verbose imap \
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.