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 can handle large files pretty well. I just edited a 3.4GB file, deleting lines, etc. Three things to keep in mind: Press Ctrl-C: Vim tries to read in the whole file initially, to do things like syntax highlighting and number of lines in file, etc.
Add the text, “syntax on” anywhere in the file to enable syntax highlighting permanently for vim editor. Save and close the file by typing ':x'. For disabling the feature, just re-open . vimrc file, change the text “syntax on” to “syntax off” and save the file.
Most filetypes (like python) in Vim come with a syntax that defines highlight groups (see them via :highlight ). A colorscheme then provides combinations of foreground / background color and/or formatting like bold and italic, for terminals, color terminals, and/or GVIM.
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
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