views:

365

answers:

1

Hi

i'm trying to use vim autocomplete in that example:

i got struct in file def.h:

typedef struct test{
        int x;
        int y;
}*test_p,test_t;

and now, if i got, in my C file:

test_p t;
t->(what i should press to fill it with x or y? both ctrl-P and ctrl-N does not give me variables inside test struct)

i've already used ctags and of course i've included def.h, here is what is in my tags file:

test    def.h   /^typedef struct test{$/;"      s
test_p  def.h   /^}*test_p,test_t;$/;"  t       typeref:struct:test
test_t  def.h   /^}*test_p,test_t;$/;"  t       typeref:struct:test
x       def.h   /^      int x;$/;"      m       struct:test
y       def.h   /^      int y;$/;"      m       struct:test

thx for any help Josip Bros

+1  A: 

You are looking for omni-complete (Ctrl-X Ctrl-O).

Ctrl-P or Ctrl-N only autocomplete words from current files/buffers. You want intelisense (R) (omnicomplete) introduced in vim 7 I believe. See C++ code completion - not sure if that helps.

stefanB