diff options
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | doc/big_file_options.txt | 14 | ||||
-rw-r--r-- | plugin/big_file_options.vim | 34 |
4 files changed, 27 insertions, 27 deletions
@@ -3,13 +3,13 @@ big\_file\_options.vim This plugin adds an `autocmd` hook to check the file size of an incoming buffer, and if it's over a certain threshold, disables certain options in order -to make the file a bit easier to edit. It makes the buffer read-only, and +to make the file a bit easier to edit. It makes the buffer read-only, and disables filetypes, swap files, undo files, and syntax highlighting. License ------- -Copyright (c) [Tom Ryder][1]. Distributed under the same terms as Vim itself. +Copyright (c) [Tom Ryder][1]. Distributed under the same terms as Vim itself. See `:help license`. [1]: https://sanctum.geek.nz/ @@ -1 +1 @@ -1.0.0 +1.1.0 diff --git a/doc/big_file_options.txt b/doc/big_file_options.txt index 532d2d0..0603dc0 100644 --- a/doc/big_file_options.txt +++ b/doc/big_file_options.txt @@ -3,22 +3,22 @@ DESCRIPTION *big_file_options* This plugin adds an |autocmd| hook to check the file size of an incoming -buffer, and if it's over a certain threshold, disables certain options in order -to make the file a bit easier to edit. It makes the buffer read-only, and -disables filetypes, swap files, undo files, and syntax highlighting. +buffer, and if it's over a certain threshold, disables certain options in +order to make the file a bit easier to edit. It makes the buffer read-only, +and disables filetypes, swap files, undo files, and syntax highlighting. It's similar to the much older and more sophisticated LargeFile plugin by Charles Campbell, which is based on VimTip #611: <http://vim.wikia.com/wiki/Faster_loading_of_large_files> If you want more options and bells and whistles, you should definitely use -that instead. I'm intentionally keeping this very small and simple; it should +that instead. I'm intentionally keeping this very small and simple; it should be install-and-forget. REQUIREMENTS *big_file_options-requirements* -This plugin is only available if 'compatible' is not set. It also requires the -|+autocmd| feature. +This plugin is only available if 'compatible' is not set. It also requires +the |+autocmd| feature. OPTIONS *big_file_options-options* @@ -40,7 +40,7 @@ to disable syntax highlighting completely on large files; this defaults to on. *g:big_file_options_synmaxcol* Set `g:big_file_options_synmaxcol` to the number of columns for which syntax highlighting should be done on big files, assuming |g:big_file_options_syntax| -is enabled. This defaults to 256, and only works if you have the |+synmaxcol| +is enabled. This defaults to 256, and only works if you have the |+synmaxcol| feature. AUTHOR *big_file_options-author* 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 |