Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect git managed tags #773

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion plug.vim
Original file line number Diff line number Diff line change
Expand Up @@ -608,13 +608,24 @@ function! s:update(force, names)
call s:update_impl(1, a:force, a:names)
endfunction

function! s:do_need_exec_helptags(docdir)
let exts = s: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(a:docdir .'/'. tagname) || empty(s:system('cd ' . s:shellesc(a:docdir) . ' && git ls-files ' . tagname))
return 1
endif
endfor
return 0
endfunc

function! plug#helptags()
if !exists('g:plugs')
return s:err('plug#begin was not called')
endif
for spec in values(g:plugs)
let docd = join([s:rtp(spec), 'doc'], '/')
if isdirectory(docd)
if isdirectory(docd) && s:do_need_exec_helptags(docd)
silent! execute 'helptags' s:esc(docd)
endif
endfor
Expand Down Expand Up @@ -2113,6 +2124,23 @@ function! s:git_validate(spec, check_branch)
return [err, err =~# 'PlugClean']
endfunction

if exists('*uniq')
function! s:uniq(list) abort
return uniq(a:list)
endfunction
else
function! s:uniq(list) abort
let i = len(a:list) - 1
while 0 < i
if a:list[i] ==# a:list[i - 1]
call remove(a:list, i)
endif
let i -= 1
endwhile
return a:list
endfunction
endif

function! s:rm_rf(dir)
if isdirectory(a:dir)
call s:system((s:is_win ? 'rmdir /S /Q ' : 'rm -rf ') . s:shellesc(a:dir))
Expand Down