jsfaint / gen_tags.vim

Async plugin for vim and neovim to ease the use of ctags/gtags
https://vim.sourceforge.io/scripts/script.php?script_id=5499
MIT License
312 stars 42 forks source link

Introduce g:gen_gtags#gtags_bin and g:gen_gtags#gtags_opts #45

Closed jetm closed 6 years ago

jetm commented 6 years ago

g:gen_gtags#gtags_bin allows to use a different gtags binary file.

g:gen_gtags#gtags_opts allows to insert gtags options before the path to database.

jsfaint commented 6 years ago

Thanks for the PR. There is another command global used in gtags support which is also belong to GNU global too.

Please add support for it too:smile:

jetm commented 6 years ago

@jsfaint Updated the PR.

jsfaint commented 6 years ago

image I tried the patch, it looks the g:gen_gtags#gtags_opts cause some issue when generate the gtags

After some modify

let l:cmd = [g:gen_tags#gtags_bin, g:gen_tags#gtags_opts, l:db_dir]

to

let l:cmd = [g:gen_tags#gtags_bin, l:db_dir, g:gen_tags#gtags_opts]

It works well. It looks gtags will treat '' empty parameter as directory.

Another question, what value of g:gen_tags#gtags_opts will you use?

Thanks

jetm commented 6 years ago

Thank you for the catch. Submitted your suggestion. A the beginning I didn't test it because the gtags help says gtags [-f file][dbpath]. I used the same order.

The initial problem I faced was how to tell to gtags that filter by files. I develop on a large codebase. A filter reduces the tag file from 6 GB to 1.6 GB and also take less time. The option I pass is this one:

let s:tags_files = expand('$HOME/tmp/tags.files')
let g:gen_tags#ctags_opts = "-L" . s:tags_files
let g:gen_tags#gtags_opts = "-f" . s:tags_files

I use the equivalent for ctags. I generate manually, using a script, the tags.files file. Another feature could be to generate that file from Vim.

jsfaint commented 6 years ago

Got it! Thanks for the explanation. Merged!

If you finished the filter feature, can you make another PR? There are another issue #44 , request this feature too. Thank you! 👍

jetm commented 6 years ago

Thanks for the merge! Right now to filter by files in ctags and gtags I have a hack that is not ready for a PR. Let me see between all the things I need to do, I can polish it and make a PR. Thanks!