mirror of
https://github.com/junegunn/fzf.vim.git
synced 2025-12-06 20:54:28 +08:00
[Tags] Disable colored output when tags file is larger than 20M
This commit is contained in:
@@ -425,11 +425,19 @@ function! fzf#vim#tags(...)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let tagfile = tagfiles()[0]
|
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 proc = 'grep -v ''^!'' '
|
||||||
|
let copt = ''
|
||||||
|
else
|
||||||
|
let proc = 'perl -ne ''unless (/^!/) { s/^(.*?)\t(.*?)\t/\x1b[33m\1\x1b[m\t\x1b[34m\2\x1b[m\t/; print }'' '
|
||||||
|
let copt = '--ansi '
|
||||||
|
endif
|
||||||
call s:fzf({
|
call s:fzf({
|
||||||
\ 'source': 'cat '.shellescape(tagfile).
|
\ 'source': proc.shellescape(tagfile),
|
||||||
\ '| grep -v "^!" | perl -pe "s/^(.*?)\t(.*?)\t/\x1b[33m\1\x1b[m\t\x1b[34m\2\x1b[m\t/"',
|
|
||||||
\ 'dir': fnamemodify(tagfile, ':h'),
|
\ 'dir': fnamemodify(tagfile, ':h'),
|
||||||
\ 'options': '--ansi +m --tiebreak=begin --prompt "Tags> "'.s:expect(),
|
\ 'options': copt.'+m --tiebreak=begin --prompt "Tags> "'.s:expect(),
|
||||||
\ 'sink*': function('s:tags_sink')}, a:000)
|
\ 'sink*': function('s:tags_sink')}, a:000)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user