When I'm using Vim 7.3 to edit a large PHP file (2000 lines), if I switch from insert mode to normal mode there is a delay of about 1-2 seconds.
It is quite frustrating when I need to make some quick edits.
On smaller files (300 lines) there is no delay. The reverse (normal mode to insert mode) there is also no delay.
The issue is related to syntax highlighting, because if I turn syntax highlighting off, the problem goes away.
:syntax off
Some things I have tried to no avail:
Note, other than this insert-to-normal mode switching issue, nothing else about the syntax highlighting appears slow for me when editing large files. I.e. typing text in insert mode performs fine, completion works fine, etc.
This makes me think that it is something that can be fixed.
I have tested this in gVim and console vim (under cygwin) on Windows XP.
Does anyone know what could be the issue?
Or is anyone else able to reproduce this problem? I have googled, but can't see anyone else with this same issue which is weird.
UPDATE: I think it may be related only to PHP syntax highlighting. I just tried coffeescript and javascript files with 2000+ lines and did not have any issues with them.
I haven't seen the issue you're describing, but the InsertLeave
event would be one place to start looking. Check your color scheme (and any other plugins) to see if there's an InsertLeave
autocommand. On my own system the 'lettuce.vim' colorscheme file has a handful of those; it's conceivable they're expensive, or possibly even triggering some kind of recursive processing (just thinking out loud).
Edit You can check to see what autocommands are associated with a given event by doing :au {EventName}
, e.g. :au InsertLeave
.
Try this setting in your .vimrc file.
set ttimeoutlen=0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With