changeset 182:2489b4b54d5c

Add `g:gutentags_generate_on_empty_buffer` setting.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 18 Apr 2017 21:43:59 -0700
parents 0b4ccd0deceb
children bd641fccdae4
files autoload/gutentags.vim doc/gutentags.txt plugin/gutentags.vim
diffstat 3 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/autoload/gutentags.vim	Thu Mar 23 17:38:14 2017 -0700
+++ b/autoload/gutentags.vim	Tue Apr 18 21:43:59 2017 -0700
@@ -210,7 +210,8 @@
     "  other such things)
     " Also don't do anything for the default `[No Name]` buffer you get
     " after starting Vim.
-    if &buftype != '' || bufname('%') == ''
+    if &buftype != '' || 
+          \(bufname('%') == '' && !g:gutentags_generate_on_empty_buffer)
         return
     endif
 
--- a/doc/gutentags.txt	Thu Mar 23 17:38:14 2017 -0700
+++ b/doc/gutentags.txt	Tue Apr 18 21:43:59 2017 -0700
@@ -381,6 +381,16 @@
                         |GutentagsUpdate| manually.
                         Defaults to 1.
 
+                                            *gutentags_generate_on_empty_buffer*
+g:gutentags_generate_on_empty_buffer
+                        If set to 1, Gutentags will start generating the tag
+                        file even if there's no buffer currently open, as long
+                        as the current working directory (as returned by
+                        |:cd|) is inside a known project.
+                        This is useful if you want Gutentags to generate the
+                        tag file right after opening Vim.
+                        Defaults to 0.
+
                                                 *gutentags_background_update*
 g:gutentags_background_update
                         Specifies whether the process that updates the tags
--- a/plugin/gutentags.vim	Thu Mar 23 17:38:14 2017 -0700
+++ b/plugin/gutentags.vim	Tue Apr 18 21:43:59 2017 -0700
@@ -50,6 +50,7 @@
 let g:gutentags_generate_on_new = get(g:, 'gutentags_generate_on_new', 1)
 let g:gutentags_generate_on_missing = get(g:, 'gutentags_generate_on_missing', 1)
 let g:gutentags_generate_on_write = get(g:, 'gutentags_generate_on_write', 1)
+let g:gutentags_generate_on_empty_buffer = get(g:, 'gutentags_generate_on_empty_buffer', 0)
 let g:gutentags_file_list_command = get(g:, 'gutentags_file_list_command', '')
 
 if !exists('g:gutentags_cache_dir')