-
Notifications
You must be signed in to change notification settings - Fork 171
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
Use tags
file as primary marker / allow to limit markers
#74
Comments
Using tags file as the primary marker makes a ton of sense. 👍 In fact, it could be used to eliminate the "project root" crap (yes, it's crap) completely. |
Yeah. So looking for a We could make the project root lookup optional altogether, only if https://github.com/dbakker/vim-projectroot is installed, which provides a good interface already ( |
With g:gutentags_use_generated_file_marker (TODO: document) it will look for e.g. `tags` first to find the "project" root. Ref: ludovicchabant#74
@blueyed Seems fine to me. To eliminate "project root" completely, a different approach is needed, which gutentags isn't going to adopt:
In general, Vim's "working directory" concept should be the authority on the "project root". The various attempts to automatically detect project roots is a waste of time IMO, because sometimes it makes the wrong decision, which means the user must spend time configuring blacklists anyway. This could be avoided by simply making tags generation opt-in (once per project) as described above, then auto-rebuilding when gutentags has too many options, functions, and commands. It could be greatly simplified using the above approach. |
@justinmk @ludovicchabant |
My turnaround for checking out bugs and PRs is usually in measured in weeks so you'll have to be patient, especially since there's a lot to process here. Regarding the "project root crap" thing:
Last, re-using an existing |
Thanks for elaborating on this - I can see your points.
Then we could also add support for https://github.com/dbakker/vim-projectroot probably, if |
Supporting Note however that if you use root markers like, say, |
This works for me: diff --git a/autoload/gutentags.vim b/autoload/gutentags.vim
index 4c859b2..8237e04 100644
--- a/autoload/gutentags.vim
+++ b/autoload/gutentags.vim
@@ -157,7 +157,11 @@ function! gutentags#setup_gutentags() abort
if g:gutentags_resolve_symlinks
let l:buf_dir = fnamemodify(resolve(expand('%:p', 1)), ':p:h')
endif
- let b:gutentags_root = gutentags#get_project_root(l:buf_dir)
+ if exists("g:gutentags_set_project_root") && g:gutentags_set_project_root != ''
+ let b:gutentags_root = g:gutentags_set_project_root
+ else
+ let b:gutentags_root = gutentags#get_project_root(l:buf_dir)
+ endif
if filereadable(b:gutentags_root . '/.notags')
call gutentags#trace("'notags' file found... no gutentags support.")
return ... and in my let g:gutentags_set_project_root = FindRootDirectory() That's using vim-rooter, but the same could be accomplished with let g:gutentags_set_project_root = ProjectRootGuess() |
Well, you can change my "measured in weeks" comment to "measured in months" :) If we were to make it possible to not use |
I added support for custom root lookups with df8756a. For those of you who want to use To @justinmk's comment about Gutentags having too many options/commands/functions, I'm not sure how to address that though. Gutentags has exactly 2 commands ( |
When in some Git submodule, I would rather use the existing
tags
file from the main repo (up in the directory) tree, than create a new tags file for this project.A naive approach for this is the following, but will cause many more disk accesses.
Therefore a separate option (enabled by default) might make sense.
Also, having a fixed list of markers really causes unnecessary disk accesses, even if you only want to use
['tags', '.git']
! (see #75)What do you think?
The text was updated successfully, but these errors were encountered: