[Tags] Fall back to --algo=v1 if tags file is too large (> 200MB)

This commit is contained in:
Junegunn Choi 2017-02-03 12:34:20 +09:00
parent f77b644797
commit 4329721384
No known key found for this signature in database
GPG key ID: 254BC280FEF9C627

View file

@ -773,9 +773,10 @@ function! fzf#vim#tags(query, ...)
let tagfile = tagfiles()[0]
" We don't want to apply --ansi option when tags file is large as it makes
" processing much slower.
if getfsize(tagfile) > 1024 * 1024 * 20
let tagsize = getfsize(tagfile)
if tagsize > 1024 * 1024 * 20
let proc = 'grep -av ''^\!'' '
let copt = ''
let copt = tagsize > 1024 * 1024 * 200 ? '--algo=v1 ' : ''
else
let proc = 'perl -ne ''unless (/^\!/) { s/^(.*?)\t(.*?)\t/'.s:yellow('\1', 'Function').'\t'.s:blue('\2', 'String').'\t/; print }'' '
let copt = '--ansi '