Vim在C中自动完成一个结构

Jos*_*ros 8 c vim autocomplete

我正在尝试使用Vim自动完成功能.我有一个struct档案def.h:

typedef struct test{
        int x;
        int y;
}*test_p,test_t;
Run Code Online (Sandbox Code Playgroud)

并在相应的C文件中:

test_p t;
t->[autocomplete here]
Run Code Online (Sandbox Code Playgroud)

我应该用什么来填充x或y?从内部也CTRLP没有CTRLN给我变量test.

我已经习惯了ctags,当然我也包括在内def.h.这是我的标签文件中的内容:

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
Run Code Online (Sandbox Code Playgroud)

ste*_*anB 6

您正在寻找omni-complete(Ctrl-X Ctrl-O).

Ctrl-P或者Ctrl-N只从当前文件/缓冲区中自动完成单词.你想要在vim 7中引入的intelisense(R)(omnicomplete)我相信.请参阅C++代码完成 - 不确定是否有帮助.