Comments (8)
Why do you want Gutentags to generate tags only for a few repos? Is it because most of the repos are too big, or don't contain code, or something?
from vim-gutentags.
from vim-gutentags.
Can you try this quick patch?
diff --git a/autoload/gutentags.vim b/autoload/gutentags.vim
--- a/autoload/gutentags.vim
+++ b/autoload/gutentags.vim
@@ -107,6 +107,12 @@
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'))
+ return
+ endif
+
" Try and find what tags file we should manage.
call gutentags#trace("Scanning buffer '" . bufname('%') . "' for gutentags setup...")
try
diff --git a/plugin/gutentags.vim b/plugin/gutentags.vim
--- a/plugin/gutentags.vim
+++ b/plugin/gutentags.vim
@@ -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
It lets you specify the name of a function in g:gutentags_enabled_user_func
. This function will get called with the path to each new buffer, and if it returns 0 (or some other false value), Gutentags will be disable for that buffer. You could make that function compare the given path to a list of white-listed repos, or check for the existence of a tags
file, or something.
from vim-gutentags.
I tried with a simple func:
func! GutenTagsGenCheck(file)
"call gutentags#trace(gutentags#get_project_root(a:file))
return 0
endfunc
let g:gutentags_enabled_user_func = 'GutenTagsGenCheck'
And I've got an error:
Error detected while processing function gutentags#setup_gutentags:
line 14:
E714: List required
Thanks
from vim-gutentags.
Woops sorry, typo in the code calling your custom function. Put square brackets around the second parameter:
\!call(g:gutentags_enabled_user_func, [expand('%:p')])
from vim-gutentags.
Now it worked fine as I expected.
func! MyGutentagsFunc(file) let tag_file = gutentags#get_project_root(a:file).'/tags' return filereadable(tag_file) endfunc let g:gutentags_enabled_user_func = 'MyGutentagsFunc'
Thanks!
from vim-gutentags.
With old MyGutentagsFunc(), I saw an error message when I run 'vim' without filename.
Error detected while processing function gutentags#setup_gutentags[14]..MyGutent agsFunc[1]..gutentags#get_project_root[17]..gutentags#throw: line 2: E605: Exception not caught: gutentags: Can't figure out what tag file to use for :
So that, I changed it like below. Does it correct? Is there any other way?
func! MyGutentagsFunc(file) try let tag_file = gutentags#get_project_root(a:file).'/tags' return filereadable(tag_file) catch return 0 endtry endfunc
from vim-gutentags.
Ok I submitted the patch (see a844f08).
A try...catch
is probably a good idea, but when I run vim
with no arguments the callback doesn't get called for me (because the default buffer is not a writable file). Maybe you have Vim setup to open something by default?
from vim-gutentags.
Related Issues (20)
- ERROR: Invalid value for argument cmd and update_gtags.sh is not executable HOT 4
- E117: Unknown function: gutentags#on_vim_leave
- Tags stop working for specific file (path disappears from tags option) after manually setting tags once in that file
- Cannot generate the GTAGS at windows platform HOT 5
- Does it support different ctags file chosen dynamically? HOT 2
- Error code 122 & 139 HOT 7
- please support the usage of `vim -t symbol` HOT 9
- use gtags failed HOT 2
- update_gtags.sh lost execution permission
- How do I use different tag files for different directories of a same workspace HOT 1
- Is there a way to force gutentags to generate only one tag file?
- Keep tags values when opening the quickfix
- nvim 0.9 remove cscope how to HOT 1
- Guttentags does not support any file? HOT 1
- Option to generate tags for open windows or buffers only? HOT 3
- the use of .guttags file HOT 1
- Whitelisting instead of blacklisting HOT 2
- Bug in update_scopedb.cmd file prevents creation of cscope.out.files correctly HOT 1
- Very large tags file generated ( > 10GB) HOT 2
- Plugin don't work if full filename contains open "[" _and_ close "]" square brackets
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-gutentags.