# HG changeset patch # User Ludovic Chabant # Date 1448430446 28800 # Node ID 073e63cc045623a334ae8ea0dc4e301cd0efa560 # Parent afe1130472047be70ac370693c5539c50ae6b5d1 Add `gutentags_enabled_user_func` callback. diff -r afe113047204 -r 073e63cc0456 autoload/gutentags.vim --- a/autoload/gutentags.vim Tue Nov 17 21:11:20 2015 -0800 +++ b/autoload/gutentags.vim Tue Nov 24 21:47:26 2015 -0800 @@ -107,6 +107,14 @@ return endif + " Let the user specify custom ways to disable Gutentags. + if g:gutentags_enabled_user_func != '' && + \!call(g:gutentags_enabled_user_func, [expand('%:p')]) + call gutentags#trace("Ignoring '" . bufname('%') . "' because of " . + \"custom user function.") + return + endif + " Try and find what tags file we should manage. call gutentags#trace("Scanning buffer '" . bufname('%') . "' for gutentags setup...") try diff -r afe113047204 -r 073e63cc0456 doc/gutentags.txt --- a/doc/gutentags.txt Tue Nov 17 21:11:20 2015 -0800 +++ b/doc/gutentags.txt Tue Nov 24 21:47:26 2015 -0800 @@ -339,6 +339,15 @@ maybe not what you want if the symlink itself is part of the project. Defaults to 0. + + *gutentags_enabled_user_func* +g:gutentags_enabled_user_func + When set to a non-empty string, it is expected to be + the name of a function that will be called when a file + is open in a project. The function gets passed the + path of the file and if it returns 0, Gutentags won't + be enabled for that file. + Defaults to "". *gutentags_define_advanced_commands* g:gutentags_define_advanced_commands diff -r afe113047204 -r 073e63cc0456 plugin/gutentags.vim --- a/plugin/gutentags.vim Tue Nov 17 21:11:20 2015 -0800 +++ b/plugin/gutentags.vim Tue Nov 24 21:47:26 2015 -0800 @@ -41,6 +41,10 @@ let g:gutentags_enabled = 1 endif +if !exists('g:gutentags_enabled_user_func') + let g:gutentags_enabled_user_func = '' +endif + if !exists('g:gutentags_modules') let g:gutentags_modules = ['ctags'] endif