I'm editing a simple PHP file with a class which has a few methods, if $bar
is an instance of this class and I type
$bar->
ctrlxctrlo
I get a popup with a lot of methods (builtin ones) in addition to those of my class and present in the ctags list. How can avoid showing all those external methods and just keep the ones defined in my class?
I'm sure you've seen the VIM documentation (:help ft-c-omni
) for this:
When using CTRL-X CTRL-O after a name without any "." or "->" it is completed from the tags file directly. This works for any identifier, also function names. If you want to complete a local variable name, which does not appear in the tags file, use CTRL-P instead.
When using CTRL-X CTRL-O after something that has "." or "->" Vim will attempt to recognize the type of the variable and figure out what members it has. This means only members valid for the variable will be listed.
When a member name already was complete, CTRL-X CTRL-O will add a "." or "->" for composite types.
If I read that correctly, the built-in functionality will, at best, only allow you to use CTRL-P and match the local variables names thus bypassing the TAGS file altogether.
What you really want is a TAGS file that is specific to the translation unit that you're currently working on (header/cpp file). Here are the steps that I would perform if I were trying to solve this problem:
CTRL-X CTRL-O
omni-completion. If necessary, revert to the original TAGS.Also, it seems to me like you would want to be able to call the script for #1 directly from VIM since you would be frequently changing the current translation unit as you code.
I hope that gets you started in the right direction, and I'd be happy to see / help you with an implementation =).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With