diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2014-11-01 21:49:06 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2014-11-01 21:49:06 +1300 |
commit | 73e500e0629115fde11a6251b0cf91be7317ce1a (patch) | |
tree | abb8fbbaab1c70784abe4f61d9872b783ba793ed /vim/vimrc | |
parent | Better read d-null syntax (diff) | |
download | dotfiles-73e500e0629115fde11a6251b0cf91be7317ce1a.tar.gz dotfiles-73e500e0629115fde11a6251b0cf91be7317ce1a.zip |
Change Vim settings for large files
Including setting synmaxcol and turning off backups etc
Diffstat (limited to 'vim/vimrc')
-rw-r--r-- | vim/vimrc | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -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("<afile>") + \ | 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 |