Townk / vim-autoclose

This plugin for Vim enable an auto-close chars feature for you. For instance if you type an '(', ``autoclose`` will automatically insert a ')' and put the cursor between than.
http://townk.github.com/vim-autoclose/
503 stars 66 forks source link

Delay in change mode #34

Closed gilsondev closed 12 years ago

gilsondev commented 12 years ago

When you exit the insert mode to normal mode, it has a delay.

Townk commented 12 years ago

Sorry, I can't reproduce this. I tried on terminal and GUI and on both I can exit insert mode without delay.

My computer is a 2009 Macbook Pro laptop with a Core 2 Duo 2.53. For the current computer standards I have a "slow" machine.

Did you tried this with a vanilla Vim with only Autoclose installed?

Townk commented 12 years ago

I think I found the problem but unfortunately there is no easy solution.

The delay happens only on terminal when you have the g:AutoClosePreserveDotReg set to 1.

When user wants to preserve the Dot registry (so you can press '.' and have your autoclose also inserted as last action) we have to map some special keys to save user's movement into a local buffer. One of those keys is the key. If you check your imaps for (:imap ) you'll see that we have lots of mapping.

So when you press vim waits some time before delivering the press to the correct map.

The workaround for this is to not preserve the dot registry adding the following line on your .vimrc:

let g:AutoClosePreserveDotReg = 0

This will avoid the delays on the keys. Now you have to check which of the two features is more important to you: the dot registry or the fast .

gilsondev commented 12 years ago

Thank you ;)