Sometimes Vim can slow down when you start to push it to being something more than just a text editor.
These are some of the optimisations I’ve read/seen compiled into a handy list :D
If you’ve got a noticeably slow Vim and don’t even know where to start, here’s a good guide.
Syntax highlighting can be really slow on long lines. Solution:
set synmaxcol=120 "Only highlight the first 120 columns.
No. Syntax highlighting is REALLY slow. Solution:
You’ll need to dig in a bit for this one.
Make a load of slow movements in vim and then
From there, try and whittle down the issue. Slowest patterns are at the top.
Match paren is slowing down my Vim. Solution:
"The default timeout is 500, lots of us have powerful machines, so set the timeout to a smaller value.
let g:matchparen_timeout = 20
let g:matchparen_insert_timeout = 20
Or disable it altogether
let loaded_matchparen = 1
Scrolling is sluggish. Solution
"cursor line is ridiculously slow for something seemingly simple. Remove it entirely if you have it enabled
"Set lazyredraw so we're not constantly redrawing the screen
Startup time is slow
vim --startuptime and fix the issues.
- Make sure any plugins you have are using the
autoload directory so they’re loaded only when needed.
- Make sure you’re clearing your autocmds with
parse_screen function is quite slow. Be weary of this when using this plugin.
fugitive#statusline is evaluated hundreds of times (I’m assuming to detect a branch change). Again, be mindful.
A lot of this was pieced from various Reddit and StackOverflow posts.
Here are the ones I could find: