From 73e500e0629115fde11a6251b0cf91be7317ce1a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 1 Nov 2014 21:49:06 +1300 Subject: Change Vim settings for large files Including setting synmaxcol and turning off backups etc --- vim/vimrc | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'vim/vimrc') diff --git a/vim/vimrc b/vim/vimrc index 5c25c498..ccef0548 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -64,13 +64,6 @@ if has('syntax') " the default is, and it usually cares about my background set background=dark silent! colorscheme sahara - - " Don't syntax highlight beyond 300 characters; mostly for efficiency - " reasons, but also useful for prodding me into breaking up unreadable - " long lines as well when writing code - if exists('&synmaxcol') - set synmaxcol=300 - endif endif " Command-line based features @@ -567,6 +560,20 @@ if has('autocmd') augroup END endif +" When opening a file greater than 10 megabytes in size, take some measures to +" keep things loading quickly +let g:bigfilesize = 10 * 1024 * 1024 +if has('autocmd') + augroup bigfilesize + autocmd! + autocmd BufReadPre * let f=expand("") + \ | if getfsize(f) > g:bigfilesize + \ | setlocal nobackup nowritebackup noswapfile noundofile + \ | if exists('&synmaxcol') | setlocal synmaxcol=10 | endif + \ | endif + augroup end +endif + " If a file named ~/.vimrc.local exists, source its configuration; this is " useful for defining filetype rules on systems which happen to have files of " a known type with atypical suffixes or locations -- cgit v1.2.3