开发者

Vim autocomplete a struct in C

开发者 https://www.devze.com 2022-12-12 02:24 出处:网络
I\'m trying to use Vim autocomplete. I\'ve got a struct in file def.h: typedef struct test{ int x; int y;

I'm trying to use Vim autocomplete. I've got a struct in file def.h:

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

And in the corresponding C file:

test_p t;
t->[autocomplete here]

What i should press to fill it with x or y? Neither CTRLP nor CTRLN give me variables from inside test.

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       开发者_如何学Pythonstruct:test
y       def.h   /^      int y;$/;"      m       struct:test


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消