diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-06-17 22:10:46 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-06-17 22:10:46 +1200 |
commit | 06817ea1cfe23be33bf79cd5b0b009fe80e377f0 (patch) | |
tree | d0b37a0e53f7c35566c6711c79e482269766faa8 | |
parent | Add version guard (diff) | |
download | vim-big-file-options-06817ea1cfe23be33bf79cd5b0b009fe80e377f0.tar.gz vim-big-file-options-06817ea1cfe23be33bf79cd5b0b009fe80e377f0.zip |
Hide option variables if default
-rw-r--r-- | plugin/big_file_options.vim | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/plugin/big_file_options.vim b/plugin/big_file_options.vim index e102f01..5c92e8a 100644 --- a/plugin/big_file_options.vim +++ b/plugin/big_file_options.vim @@ -14,25 +14,25 @@ endif let g:loaded_big_file_options = 1 " Default threshold is 10 MiB -if !exists('g:big_file_size') - let g:big_file_size = 10 * 1024 * 1024 -endif +let s:size = exists('g:big_file_size') + \ ? g:big_file_size + \ : 10 * 1024 * 1024 " Default to leaving syntax highlighting off -if !exists('g:big_file_syntax') - let g:big_file_syntax = 0 -endif +let s:syntax = exists('g:big_file_syntax') + \ ? g:big_file_syntax + \ : 0 " Cut 'synmaxcol' down to this or smaller for big files -if !exists('g:big_file_synmaxcol') - let g:big_file_synmaxcol = 256 -endif +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) <= g:big_file_size + if line2byte(line('$') + 1) <= s:size return endif @@ -45,13 +45,12 @@ function! s:BigFileOptions() endif " Limit the number of columns of syntax highlighting - if exists('+synmaxcol') - \ && &synmaxcol > g:big_file_synmaxcol - execute 'setlocal synmaxcol=' . g:big_file_synmaxcol + if exists('+synmaxcol') && &synmaxcol > s:synmaxcol + execute 'setlocal synmaxcol=' . s:synmaxcol endif " Disable syntax highlighting if configured to do so - if !g:big_file_syntax + if !s:syntax setlocal syntax=OFF endif |