Huge files take forever to load and work with in vim, due to syntax-highlighting.
I'm looking for a way to limit size of highlighted files, such that files larger than (say) 10MB will be colorless.
Huge files take forever to load and work with in vim, due to syntax-highlighting.
I'm looking for a way to limit size of highlighted files, such that files larger than (say) 10MB will be colorless.
vim -u NONE <filename>
This will skip all initializations from configuration files.
Use uppercase U when running gvim.
"-i NONE" does only exclude viminfo from being loaded. If you defined syntax hilighting in there, that would help too.
Add to your .vimrc:
autocmd BufReadPre * if getfsize(expand("%")) > 10000000 | syntax off | endif
Note that this disables syntax highlighting in ALL buffers; syntax is a global vim thing and cannot be restricted to a single buffer.
Adding the following line to _vimrc does the trick, with a bonus: it handles gzipped files, too (which is a common case with huge files):
autocmd BufWinEnter * if line2byte(line("$") + 1) > 1000000 | syntax clear | endif