changeset 46:c0f56e4d52bd

Make a bunch of advanced commands opt-in only.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 09 Apr 2015 21:02:25 -0700
parents 64de69ca7195
children 7b419abf7fba
files autoload/gutentags.vim doc/gutentags.txt plugin/gutentags.vim
diffstat 3 files changed, 24 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/autoload/gutentags.vim	Mon Mar 16 07:04:03 2015 -0700
+++ b/autoload/gutentags.vim	Thu Apr 09 21:02:25 2015 -0700
@@ -277,6 +277,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/doc/gutentags.txt	Mon Mar 16 07:04:03 2015 -0700
+++ b/doc/gutentags.txt	Thu Apr 09 21:02:25 2015 -0700
@@ -134,7 +134,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
@@ -307,5 +308,10 @@
                         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|.
+
 
  vim:tw=78:et:ft=help:norl:
--- a/plugin/gutentags.vim	Mon Mar 16 07:04:03 2015 -0700
+++ b/plugin/gutentags.vim	Thu Apr 09 21:02:25 2015 -0700
@@ -67,6 +67,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 +97,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()