From c861a054c5614376ef7f2791648bbf9f6afd426d Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 5 Nov 2017 00:37:01 +1300 Subject: Use BufReadPost hook for big_file_options.vim Using BufReadPre meant that it was too early to set the 'syntax' option locally for the buffer. This fixes that, and also works correctly for cases where the buffer does not necessarily correspond to a file on disk. --- vim/plugin/big_file_options.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'vim/plugin/big_file_options.vim') diff --git a/vim/plugin/big_file_options.vim b/vim/plugin/big_file_options.vim index 3d239048..bbbedc96 100644 --- a/vim/plugin/big_file_options.vim +++ b/vim/plugin/big_file_options.vim @@ -30,8 +30,8 @@ endif " Declare function for turning off slow options function! s:BigFileOptions() - " Don't do anything if the file is under the threshold - if getfsize(expand('')) <= g:big_file_size + " Don't do anything if the buffer size is under the threshold + if line2byte(line('$') + 1) <= g:big_file_size return endif @@ -57,9 +57,9 @@ function! s:BigFileOptions() endfunction " Define autocmd for calling to check filesize -augroup big_file_options_bufreadpre +augroup big_file_options_bufreadpost autocmd! - autocmd BufReadPre + autocmd BufReadPost \ * \ call s:BigFileOptions() augroup end -- cgit v1.2.3