changeset 118:2838af9ff980

Add `g:gutentags_exclude_project_root`.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 05 Apr 2016 21:58:15 -0700
parents df3b0ca48013
children 5776acb079cf
files autoload/gutentags.vim doc/gutentags.txt plugin/gutentags.vim
diffstat 3 files changed, 26 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/autoload/gutentags.vim	Fri Mar 25 20:41:38 2016 -0700
+++ b/autoload/gutentags.vim	Tue Apr 05 21:58:15 2016 -0700
@@ -100,6 +100,15 @@
                                 \1)
                     call gutentags#throw("Marker found at root, aborting.")
                 endif
+                for ign in g:gutentags_exclude_project_root
+                    if l:proj_dir == ign
+                        call gutentags#trace(
+                                    \"Ignoring project root '" . l:proj_dir .
+                                    \"' because it is in the list of ignored" .
+                                    \" projects.")
+                        call gutentags#throw("Ignore project: " . l:proj_dir)
+                    endif
+                endfor
                 return l:proj_dir
             endif
         endfor
@@ -180,7 +189,7 @@
             call call("gutentags#".module."#init", [b:gutentags_root])
         endfor
     catch /^gutentags\:/
-        call gutentags#trace("Can't figure out what tag file to use... no gutentags support.")
+        call gutentags#trace("No gutentags support for this buffer.")
         return
     endtry
 
--- a/doc/gutentags.txt	Fri Mar 25 20:41:38 2016 -0700
+++ b/doc/gutentags.txt	Tue Apr 05 21:58:15 2016 -0700
@@ -243,6 +243,18 @@
                         the user-defined ones: ['.git', '.hg', '.bzr',
                         '_darcs'].
 
+                                                *gutentags_exclude_project_root*
+g:gutentags_exclude_project_root
+                        A list of project roots to generally ignore. If a file
+                        is opened inside one of those projects, Gutentags
+                        won't be activated. This is similar to placing
+                        a `.notags` file in the root of those projects, but
+                        can be useful when you don't want to, or can't, place
+                        such a file there.
+                        Defaults to ['/usr/local'], which is the folder where
+                        Homebrew is known to create a Git directory by default
+                        on MacOS.
+
                                                 *gutentags_exclude*
 g:gutentags_exclude
                         A list of file patterns to pass to the
--- a/plugin/gutentags.vim	Fri Mar 25 20:41:38 2016 -0700
+++ b/plugin/gutentags.vim	Tue Apr 05 21:58:15 2016 -0700
@@ -64,6 +64,10 @@
     let g:gutentags_exclude = []
 endif
 
+if !exists('g:gutentags_exclude_project_root')
+    let g:gutentags_exclude_project_root = ['/usr/local']
+endif
+
 if !exists('g:gutentags_resolve_symlinks')
     let g:gutentags_resolve_symlinks = 0
 endif