Skip to content

Instantly share code, notes, and snippets.

@h-east
Created October 23, 2023 16:26
Show Gist options
  • Save h-east/5c304b578bd36a17dca84af7598fd921 to your computer and use it in GitHub Desktop.
Save h-east/5c304b578bd36a17dca84af7598fd921 to your computer and use it in GitHub Desktop.
vim-pkgsync-respect-git-managed-tag
diff --git a/plugin/pkgsync.vim b/plugin/pkgsync.vim
index baf68cb..3cde058 100644
--- a/plugin/pkgsync.vim
+++ b/plugin/pkgsync.vim
@@ -187,12 +187,24 @@ endfunction
function! s:helptags(params) abort
for param in a:params
- if isdirectory(param['plugin_dir'] .. '/doc')
+ if s:do_need_exec_helptags(param['plugin_dir'] .. '/doc')
execute printf('helptags %s', fnameescape(param['plugin_dir'] .. '/doc'))
endif
endfor
endfunction
+function! s:do_need_exec_helptags(docdir) abort
+ let exts = uniq(sort(map(globpath(a:docdir, '*.{txt,??x}', 1, 1), 'v:val[-3:]')))
+ for ext in exts
+ let tagname = 'tags' .. (ext == 'txt' ? '' : '-' .. ext[:1])
+ if !filereadable(a:docdir .. '/' .. tagname) ||
+ \ empty(system('cd ' .. shellescape(a:docdir) .. ' && git ls-files ' .. tagname))
+ return v:true
+ endif
+ endfor
+ return v:false
+endfunc
+
function s:system_onevent(d, job, data, event) abort
let a:d['lines'] += a:data
sleep 10m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment