I'd start by investigating the following:
- do you have some large register-value stored in your .viminfo?
(would slow startup, but shouldn't slow use once you've started)
- exceptionally long lines with certain syntax files (you'd see
the symptoms on certain file-types but not others; you mention 4k
lines, but not the max line-length or file-size)
- mappings that are waiting for pending keystrokes to discern
them from each other (check if changing 'timeoutlen' alters
performance)
- some particular search (whether a stored pattern in your
default search register, or a :match command) that is highly
inefficient (control+C might help if you're stuck in a delay;
clearing the various search/:match settings should improve this)
- you might have some CursorHold or CursorHoldI event that is
doing time-consuming things
- you might be something at high frequencies (check the values of
'updatecount' and 'updatetime')
- you might be writing to an exceptionally slow device
(swap-files, backup files, etc; written to a floppy or a network
drive with high latency or a hard-drive that is about to die)
You can always bisect your vimrc to track down the offending
line(s). Including your vimrc might also help folks track down
any issues.
-tim
get ideas from "LargeFile" plugin on www.vim.org
You already have a working and a bad .vimrc?
but first of all: Learn how to track down errors. You do so by
a) finding a case which works
b) compraing the case which does not by the one which does step by step.
in your case I'd start with empty .vimrc. If it does goto the middle of
your .vimrc and add a "finish".
bad? continue putting the first half into two pieces by adding finish
good? remove "finish" and put the second half of the .vimrc into pieces.
Vim ignores everything after "finish"
This technic is called bisecting.
Then you'll find the cause fast.
If you find that line causing the trouble is "plugin on" then move
plugin/*.vim files somewhere else (temporarely) or use vim-addon-manager
which is particularly good at starting vim with different plugin
combinations easily.
Marc Weber
When i open a file with 4000line code, the response of vim becomes quit slow. At the mean time i input a word, vim costs 40% cpu. After switching to another vimrc, it works fine again.