diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-07-07 16:36:05 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-07-07 16:36:05 +1200 |
commit | c81104a0b1f16d437fed0d1f0af4bbc8a22d56d5 (patch) | |
tree | e23687aa585d52189642985410fbc6c11a2b32b5 /plugin/big_file_options.vim | |
parent | Bump VERSION (diff) | |
download | vim-big-file-options-c81104a0b1f16d437fed0d1f0af4bbc8a22d56d5.tar.gz vim-big-file-options-c81104a0b1f16d437fed0d1f0af4bbc8a22d56d5.zip |
Allow setting options any time
Diffstat (limited to 'plugin/big_file_options.vim')
-rw-r--r-- | plugin/big_file_options.vim | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/plugin/big_file_options.vim b/plugin/big_file_options.vim index 067d15c..a64d648 100644 --- a/plugin/big_file_options.vim +++ b/plugin/big_file_options.vim @@ -13,26 +13,14 @@ if !has('autocmd') || v:version < 600 endif let g:loaded_big_file_options = 1 -" Default threshold is 10 MiB -let s:size = exists('g:big_file_size') - \ ? g:big_file_size - \ : 10 * 1024 * 1024 - -" Default to leaving syntax highlighting off -let s:syntax = exists('g:big_file_syntax') - \ ? g:big_file_syntax - \ : 0 - -" Cut 'synmaxcol' down to this or smaller for big files -let s:synmaxcol = exists('g:big_file_synmaxcol') - \ ? g:big_file_synmaxcol - \ : 256 - " Declare function for turning off slow options function! s:BigFileOptions() " Don't do anything if the buffer size is under the threshold - if line2byte(line('$') + 1) <= s:size + let l:size = exists('g:big_file_size') + \ ? g:big_file_size + \ : 10 * 1024 * 1024 + if line2byte(line('$') + 1) <= l:size return endif @@ -45,12 +33,18 @@ function! s:BigFileOptions() endif " Limit the number of columns of syntax highlighting - if exists('+synmaxcol') && &synmaxcol > s:synmaxcol - execute 'setlocal synmaxcol=' . s:synmaxcol + let l:synmaxcol = exists('g:big_file_synmaxcol') + \ ? g:big_file_synmaxcol + \ : 256 + if exists('+synmaxcol') && &synmaxcol > l:synmaxcol + execute 'setlocal synmaxcol=' . l:synmaxcol endif " Disable syntax highlighting if configured to do so - if !s:syntax + let l:syntax = exists('g:big_file_syntax') + \ ? g:big_file_syntax + \ : 0 + if !l:syntax setlocal syntax=OFF endif |