From 06817ea1cfe23be33bf79cd5b0b009fe80e377f0 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 17 Jun 2018 22:10:46 +1200 Subject: Hide option variables if default --- plugin/big_file_options.vim | 27 +++++++++++++-------------- 1 file 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 -- cgit v1.2.3