Skip to content
Open
Changes from 4 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 @@ -600,13 +600,24 @@ function! s:update(force, names)
call s:update_impl(1, a:force, a:names)
endfunction

function! s:is_exec_helptags(docdir)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function name is un-clear to be what should do.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about s:is_need_exec_helptags ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I'm not native speaker, I cannot answer best. But has_helptags(x) or helptags_exists(x) ?
cc @junegunn

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think do_need_exec_helptags() is best.
I'll change it after I came back today or tomorrow. 😙

Thank you mattn 👍

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:is_exec_helptags(docd)
silent! execute 'helptags' s:esc(docd)
endif
endfor
Expand Down Expand Up @@ -2100,6 +2111,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