diff --git a/.gitignore b/.gitignore index 926ccaa..67d6c1f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ doc/tags +*/__pycache__/ +*.pyc diff --git a/autoload/gen_tags.vim b/autoload/gen_tags.vim index 857dd1c..249a9ae 100644 --- a/autoload/gen_tags.vim +++ b/autoload/gen_tags.vim @@ -172,7 +172,7 @@ function! s:job_start(cmd, ...) abort let l:job.on_exit = a:1 endif - let l:job_id = jobstart(a:cmd, l:job) + let l:job_id = jobstart(join(a:cmd), l:job) elseif has('job') let l:job = { \ 'out_cb': function('s:job_stdout'), @@ -183,8 +183,12 @@ function! s:job_start(cmd, ...) abort if a:0 != 0 let l:job.exit_cb = a:1 endif - - let l:job_id = job_start(a:cmd, l:job) + if has('unix') + let l:cmd = ['/bin/sh', '-c', join(a:cmd)] + else + let l:cmd = ['cmd', '/c', join(a:cmd)] + endif + let l:job_id = job_start(l:cmd, l:job) else if has('unix') let l:cmd = a:cmd + ['&'] diff --git a/autoload/gen_tags/ctags.vim b/autoload/gen_tags/ctags.vim index 677012b..3cd39b7 100644 --- a/autoload/gen_tags/ctags.vim +++ b/autoload/gen_tags/ctags.vim @@ -77,12 +77,26 @@ function! s:ctags_gen(filename, dir) abort let l:cmd = s:ctags_cmd_pre() + if exists('g:gen_tags#find_tool') && g:gen_tags#find_tool != '' + let l:find_tool_cmd = [g:gen_tags#find_tool, expand((gen_tags#find_project_root()))] + let l:find_tool_opt = ['-L', '-'] + let l:cmd = l:find_tool_cmd + ['|'] + l:cmd + l:find_tool_opt + endif + if empty(a:filename) let l:file = l:dir . '/' . s:ctags_db - let l:cmd += ['-f', l:file, '-R', expand(gen_tags#find_project_root())] + let l:cmd += ['-f', l:file] + " Don't use recursive mode if find_tool exists + if !exists('g:gen_tags#find_tool') + let l:cmd += ['-R', expand(gen_tags#find_project_root())] + endif else let l:file = a:filename - let l:cmd += ['-f', l:file, '-R', expand(a:dir)] + let l:cmd += ['-f', l:file] + " Don't use recursive mode if find_tool exists + if !exists('g:gen_tags#find_tool') + let l:cmd += ['-R', expand(gen_tags#find_project_root())] + endif endif call gen_tags#system_async(l:cmd) diff --git a/autoload/gen_tags/gtags.vim b/autoload/gen_tags/gtags.vim index 75a7ebd..df79ced 100644 --- a/autoload/gen_tags/gtags.vim +++ b/autoload/gen_tags/gtags.vim @@ -49,6 +49,12 @@ function! s:gtags_db_gen() abort let l:cmd += gen_tags#opt_converter(g:gen_tags#gtags_opts) endif + if exists('g:gen_tags#find_tool') && g:gen_tags#find_tool != '' + let l:find_tool_cmd = [g:gen_tags#find_tool, expand((gen_tags#find_project_root()))] + let l:find_tool_opt = ['-f', '-'] + let l:cmd = l:find_tool_cmd + ['|'] + l:cmd + l:find_tool_opt + endif + function! s:gtags_db_gen_done(...) abort call gen_tags#statusline#clear()