diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 26c6a9d..1138204 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -1158,14 +1158,16 @@ function! s:ProcessFile(fname, ftype) abort return endif - " If the file size limit it set, then check the linecount to see if + " If the file size limit it set, then check the file size to see if " this file should be ignored or not. if g:tagbar_file_size_limit > 0 - let linecount = line('$') + let linecount = getfsize(expand('%')) if linecount > g:tagbar_file_size_limit && !exists('b:tagbar_force_update') - call tagbar#debug#log('[ProcessFile] File size too large (' . linecount . ' lines) - limit set to ' . g:tagbar_file_size_limit) + call tagbar#debug#log('[ProcessFile] File size too large (' . linecount . + \ ' bytes) - limit set to ' . g:tagbar_file_size_limit) if !exists('b:tagbar_file_exceeds_limit') - echom 'File size too large (' . linecount . ' lines) - Not processing file (see help for g:tagbar_file_size_limit).' + echom 'File size too large (' . linecount . + \ ' bytes) - Not processing file (see help for g:tagbar_file_size_limit).' let b:tagbar_file_exceeds_limit = 1 endif return diff --git a/doc/tagbar.txt b/doc/tagbar.txt index b4bc11b..524ffc8 100644 --- a/doc/tagbar.txt +++ b/doc/tagbar.txt @@ -891,7 +891,7 @@ g:tagbar_file_size_limit~ Default: 0 By default, all files are processed by tagbar. Setting this value to non-zero -will disable processing for any file with a line count greater than +will disable processing for any file with a byte count greater than |g:tagbar_file_size_limit|. A message will be displayed once for a given buffer if the limit is exceeded. The file can be forcefully updated with the |tagbar#ForceUpdate()| function. If the value is set to 0, then the file will