Wednesday, October 20, 2010

Tags and Completion

I have a simple goal:

Configure ins-completion and :tag such that, if I want, only tags in the current file and included files will be considered.

For example, suppose I am working in a giant legacy Python codebase that's tens of thousands of lines long, where the "User" class is defined 20 times.  I have "from common.model import User" at the top of my file.

If I run :tag User, or even :ts User, I should ONLY see the one tag defined in the common.model package.

One way of doing this would be creating a tag file for every single file, and having an :autocommand that sets the 'tag' option every time I enter a buffer.  But I really, really, really don't want to litter my codebase with tag files, and I feel like this would be a fragile, potentially slow solution.

I would love to do this by somehow "filtering" the tags in my global tag file (created with ctags -R --lang=python), but I haven't found a way to do it yet.

I'm aware that ^x^o ('omnifunc') can do this for completion; Aaron Griffin's pythoncomplete.vim is pretty great at it!  But I feel like there's some kind of duplication of effort here.  ^x^] (compl-tag) is SO close to doing it right--if only it could filter tags based on 'include' and 'includeexpr'!

Is this a solved problem?

Thanks!

 - Max

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: