changeset 53:18206d49677e

Merge pull request #18 from rathrio/link-pathogen-in-readme Added link to pathogen in readme
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 11 Apr 2015 07:40:20 -0700
parents fa250d179090 (diff) 586c3a86adac (current diff)
children 50d2a7cbf7c8
files
diffstat 4 files changed, 64 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/autoload/gutentags.vim	Wed Mar 18 15:05:32 2015 +0100
+++ b/autoload/gutentags.vim	Sat Apr 11 07:40:20 2015 -0700
@@ -99,6 +99,11 @@
     call gutentags#trace("Scanning buffer '" . bufname('%') . "' for gutentags setup...")
     try
         let b:gutentags_root = gutentags#get_project_root(expand('%:h'))
+        if filereadable(b:gutentags_root . '/.notags')
+            call gutentags#trace("'notags' file found... no gutentags support.")
+            return
+        endif
+
         let b:gutentags_files = {}
         for module in g:gutentags_modules
             call call("gutentags#".module."#init", [b:gutentags_root])
@@ -180,7 +185,7 @@
 endfunction
 
 " (Re)Generate the tags file for the current buffer's file.
-function! s:manual_update_tags(module, bang) abort
+function! s:manual_update_tags(bang) abort
     for module in g:gutentags_modules
         call s:update_tags(module, a:bang, 0)
     endfor
@@ -277,6 +282,14 @@
     endif
 endfunction
 
+function! gutentags#delete_lock_files() abort
+    if exists('b:gutentags_files')
+        for tagfile in values(b:gutentags_files)
+            silent call delete(tagfile.'.lock')
+        endfor
+    endif
+endfunction
+
 function! gutentags#toggletrace(...)
     let g:gutentags_trace = !g:gutentags_trace
     if a:0 > 0
--- a/autoload/gutentags/ctags.vim	Wed Mar 18 15:05:32 2015 +0100
+++ b/autoload/gutentags/ctags.vim	Sat Apr 11 07:40:20 2015 -0700
@@ -6,10 +6,6 @@
     let g:gutentags_executable = 'ctags'
 endif
 
-if !exists('g:gutentags_ctags_options_file')
-    let g:gutentags_ctags_options_file = ''
-endif
-
 if !exists('g:gutentags_tagfile')
     let g:gutentags_tagfile = 'tags'
 endif
@@ -61,8 +57,9 @@
         if g:gutentags_pause_after_update
             let l:cmd .= ' -c'
         endif
-        if len(g:gutentags_ctags_options_file)
-            let l:cmd .= ' -o "' . g:gutentags_ctags_options_file . '"'
+        let l:proj_options_file = a:proj_dir . '/.ctags'
+        if filereadable(l:proj_options_file)
+            let l:cmd .= ' -o "' . l:proj_options_file . '"'
         endif
         if g:gutentags_trace
             if has('win32')
--- a/doc/gutentags.txt	Wed Mar 18 15:05:32 2015 +0100
+++ b/doc/gutentags.txt	Sat Apr 11 07:40:20 2015 -0700
@@ -32,6 +32,7 @@
 2. Commands                 |gutentags-commands|
 3. Status Line              |gutentags-status-line|
 4. Global Settings          |gutentags-settings|
+5. Project Settings         |gutentags-project-settings|
 
 =============================================================================
 1. Introduction                                 *gutentags-intro*
@@ -102,6 +103,10 @@
 known project markers), Gutentags is disabled for that buffer, and the
 following commands and remarks don't apply.
 
+If you want to force-disable Gutentags for a given project even though it does
+match one of the items in |gutentags_project_root|, create a file named
+"`.notags`" at the root of the project.
+
 The tag file that Gutentags creates and manages will be named after
 |gutentags_tagfile|, relative to the project's root directory. When Gutentags
 finds a valid project root, it will prepend the tag file's path to 'tags',
@@ -134,7 +139,8 @@
                         current buffer.
 
 
-Some debugging/troubleshooting commands are also available.
+Some debugging/troubleshooting commands are also available if the
+|gutentags_define_advanced_commands| global setting is set to 1.
 
                                                 *:GutentagsToggleEnabled*
 :GutentagsToggleEnabled
@@ -170,6 +176,7 @@
                         Gutentags, or something otherwise wrong or unexpected
                         with your system. Please file a bug.
 
+
 =============================================================================
 3.  Status Line                                 *gutentags-status-line*
 
@@ -248,14 +255,6 @@
                         Patterns defined in 'wildignore' will also be given as
                         exclude patterns to the `ctags` executable.
 
-                                                *gutentags_ctags_options_file*
-g:gutentags_ctags_options_file
-                        The path to an options file that will be passed to
-                        the `ctags` executable with the `--options` option.
-                        In general you can put options in a `$HOME/.ctags`
-                        file, but this lets you specify a custom file
-                        specifically for Vim/Gutentags.
-
                                                 *gutentags_auto_set_tags*
 g:gutentags_auto_set_tags
                         If set to 1, Gutentags will automatically prepend
@@ -307,5 +306,30 @@
                         project. This is handy to keep tags files from
                         polluting many directories all across your computer.
 
+                                            *gutentags_define_advanced_commands*
+g:gutentags_define_advanced_commands
+                        Defines some advanced commands like
+                        |GutentagsToggleEnabled| and |GutentagsUnlock|.
+
+
+=============================================================================
+5. Project Settings                             *gutentags-project-settings*
+
+Gutentags can be customized to some extent on a per-project basis with the
+following files present in the project root directory:
+
+                                                *gutentags-.ctags*
+`.ctags`: if this file exists, Ctags will be told to load additional
+command-line parameters by reading it line by line (see the Ctags
+documentation for more information).
+
+Note that for complex reasons, Gutentags can't always run `ctags` from the
+project root, so if the `.ctags` file exists, its path will actually be passed
+through the `--options=` parameter.
+
+                                                *gutentags-.notags*
+`.notags`: if this file exists, Gutentags will be disabled completely for that
+project.
+
 
  vim:tw=78:et:ft=help:norl:
--- a/plugin/gutentags.vim	Wed Mar 18 15:05:32 2015 +0100
+++ b/plugin/gutentags.vim	Sat Apr 11 07:40:20 2015 -0700
@@ -4,6 +4,11 @@
 
 " Globals {{{
 
+if v:version < 700
+    echoerr "gutentags: this plugin requires vim >= 7.0."
+    finish
+endif
+
 if !exists('g:gutentags_debug')
     let g:gutentags_debug = 0
 endif
@@ -67,6 +72,10 @@
     let g:gutentags_cache_dir = fnamemodify(g:gutentags_cache_dir, ':s?[/\\]$??')
 endif
 
+if !exists('g:gutentags_define_advanced_commands')
+    let g:gutentags_define_advanced_commands = 0
+endif
+
 if g:gutentags_cache_dir != '' && !isdirectory(g:gutentags_cache_dir)
     call mkdir(g:gutentags_cache_dir, 'p')
 endif
@@ -93,15 +102,12 @@
 
 " Toggles and Miscellaneous Commands {{{
 
-function! s:delete_lock_files() abort
-    for tagfile in values(b:gutentags_files)
-        silent call delete(tagfile.'.lock')
-    endfor
-endfunction
+command! GutentagsUnlock :call gutentags#delete_lock_files()
 
-command! GutentagsToggleEnabled :let g:gutentags_enabled=!g:gutentags_enabled
-command! GutentagsToggleTrace   :call gutentags#trace()
-command! GutentagsUnlock        :call s:delete_lock_files()
+if g:gutentags_define_advanced_commands
+    command! GutentagsToggleEnabled :let g:gutentags_enabled=!g:gutentags_enabled
+    command! GutentagsToggleTrace   :call gutentags#trace()
+endif
 
 if g:gutentags_debug
     command! GutentagsToggleFake    :call gutentags#fake()