From 31e01612f3b9eef79e6a71d4708b85505f50e255 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Thu, 19 Jan 2023 21:46:36 +0100 Subject: [PATCH] tagbar: do not load, if file size is too large closes: #2578 --- autoload/airline/extensions/tagbar.vim | 4 ++++ doc/airline.txt | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/autoload/airline/extensions/tagbar.vim b/autoload/airline/extensions/tagbar.vim index 7e6b9df8..368fffc3 100644 --- a/autoload/airline/extensions/tagbar.vim +++ b/autoload/airline/extensions/tagbar.vim @@ -40,6 +40,10 @@ function! airline#extensions#tagbar#currenttag() unlet! a let s:init=1 endif + let cursize = getfsize(fnamemodify(bufname('%'), ':p')) + if cursize > 0 && cursize > get(g:, 'airline#extensions#tagbar#max_filesize', 1024 * 1024) + return '' + endif let flags = get(g:, 'airline#extensions#tagbar#flags', '') " function tagbar#currenttag does not exist, if filetype is not enabled if s:airline_tagbar_last_lookup_time != localtime() && exists("*tagbar#currenttag") diff --git a/doc/airline.txt b/doc/airline.txt index f0068fe6..8cb21ecb 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -1468,6 +1468,10 @@ tagbar let g:airline#extensions#tagbar#searchmethod = 'nearest-stl' (default) let g:airline#extensions#tagbar#searchmethod = 'nearest' let g:airline#extensions#tagbar#searchmethod = 'scoped-stl' + +* configure max filesize, after which to skip loading the extension + If the file is larger, tags won't be displayed for performance reasons > + let g:airline#extensions#tagbar#max_filesize = 1024*1024 (default) < ------------------------------------- *airline-taglist* taglist