aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-05-09 10:14:49 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-05-09 10:14:49 +1200
commit9a3c3a571d02ae6dcb1fba03847fd8e947b9c233 (patch)
tree04fffd29cf2386a62e3e920923cd1d61e012fe4b /plugin
parentSwitch to two-spacing (diff)
downloadvim-big-file-options-9a3c3a571d02ae6dcb1fba03847fd8e947b9c233.tar.gz
vim-big-file-options-9a3c3a571d02ae6dcb1fba03847fd8e947b9c233.zip
Remove unneeded variable scoping
Diffstat (limited to 'plugin')
-rw-r--r--plugin/big_file_options.vim34
1 files changed, 17 insertions, 17 deletions
diff --git a/plugin/big_file_options.vim b/plugin/big_file_options.vim
index a2df77b..bc69e44 100644
--- a/plugin/big_file_options.vim
+++ b/plugin/big_file_options.vim
@@ -5,33 +5,33 @@
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
"
-if exists('g:loaded_big_file_options') || &compatible
+if exists('loaded_big_file_options') || &compatible
finish
endif
if !has('autocmd') || v:version < 600
finish
endif
-let g:loaded_big_file_options = 1
+let loaded_big_file_options = 1
" Wrapper function to get the configured size limit, default to 10 MiB
function! s:Limit()
- let l:limit = exists('g:big_file_options_limit')
+ let limit = exists('g:big_file_options_limit')
\ ? g:big_file_options_limit
\ : 10 * 1024 * 1024
- return l:limit
+ return limit
endfunction
" If we can use filesize to detect the big file early, we should
function! s:CheckPre(filename)
" Try and get filesize, bail out if we can't
- let l:size = getfsize(a:filename)
- if l:size == -1
+ let size = getfsize(a:filename)
+ if size == -1
return
endif
" Set the buffer's big flag to whether the file is verifiably outsize
- let b:big_file_options_big = l:size == -2 || l:size > s:Limit()
+ let b:big_file_options_big = size == -2 || size > s:Limit()
" If we found it's a big file, call the early options set
if b:big_file_options_big
@@ -49,14 +49,14 @@ function! s:CheckPost()
if !exists('b:big_file_options_big')
" Test buffer size, bail if that doesn't work either
- let l:size = line2byte(line('$') + 1)
- if l:size == -1
+ let size = line2byte(line('$') + 1)
+ if size == -1
return
endif
" Flag the buffer's oversize status, if it's positive, we'll catch up and
" run the early options set now
- let b:big_file_options_big = l:size > s:Limit()
+ let b:big_file_options_big = size > s:Limit()
if b:big_file_options_big
call s:SetPre()
endif
@@ -82,10 +82,10 @@ function! s:SetPre()
endif
" Decide whether to set readonly options
- let l:readonly = exists('g:big_file_options_readonly')
+ let readonly = exists('g:big_file_options_readonly')
\ ? g:big_file_options_readonly
\ : 1
- if l:readonly
+ if readonly
setlocal buftype=nowrite
setlocal nomodifiable
setlocal readonly
@@ -103,20 +103,20 @@ function! s:SetPost()
if has('syntax')
" Disable syntax highlighting if configured
- let l:syntax = exists('g:big_file_options_syntax')
+ let syntax = exists('g:big_file_options_syntax')
\ ? g:big_file_options_syntax
\ : 0
- if !l:syntax
+ if !syntax
setlocal syntax=OFF
endif
" Force maximum syntax columns down if configured
if exists('+synmaxcol')
- let l:synmaxcol = exists('g:big_file_options_synmaxcol')
+ let synmaxcol = exists('g:big_file_options_synmaxcol')
\ ? g:big_file_options_synmaxcol
\ : 256
- if exists('+synmaxcol') && &synmaxcol > l:synmaxcol
- let &l:synmaxcol = l:synmaxcol
+ if exists('+synmaxcol') && &synmaxcol > synmaxcol
+ let &l:synmaxcol = synmaxcol
endif
endif