Respect git managed tags

This commit is contained in:
h_east 2018-06-28 20:49:24 +09:00
parent e0ca037a4f
commit 2ac5f2d86b

View File

@ -600,13 +600,28 @@ function! s:update(force, names)
call s:update_impl(1, a:force, a:names) call s:update_impl(1, a:force, a:names)
endfunction endfunction
function! s:is_exec_helptags(docdir)
execute 'lcd' a:docdir
let result = v:false
let exts = uniq(sort(map(s:glob(a:docdir, '*.{txt,??x}'), 'v:val[-3:]')))
for ext in exts
let tagname = 'tags' . (ext == 'txt' ? '' : '-' . ext[:1])
if !filereadable(tagname) || empty(s:system('git ls-files ' . tagname))
let result = v:true
break
endif
endfor
lcd -
return result
endfunc
function! plug#helptags() function! plug#helptags()
if !exists('g:plugs') if !exists('g:plugs')
return s:err('plug#begin was not called') return s:err('plug#begin was not called')
endif endif
for spec in values(g:plugs) for spec in values(g:plugs)
let docd = join([s:rtp(spec), 'doc'], '/') let docd = join([s:rtp(spec), 'doc'], '/')
if isdirectory(docd) if isdirectory(docd) && s:is_exec_helptags(docd)
silent! execute 'helptags' s:esc(docd) silent! execute 'helptags' s:esc(docd)
endif endif
endfor endfor