【问题标题】:Vim autocomplete a struct in CVim 自动完成 C 中的结构
【发布时间】:2012-07-17 05:35:15
【问题描述】:

我正在尝试使用 Vim 自动完成功能。我在文件def.h 中有一个struct

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

并在对应的C文件中:

test_p t;
t->[autocomplete here]

我应该按什么来填充 x 或 y? CTRLPCTRLN 都没有给我来自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

【问题讨论】:

    标签: c vim autocomplete


    【解决方案1】:

    您正在寻找全方位的 (Ctrl-X Ctrl-O)。

    Ctrl-PCtrl-N 仅自动完成当前文件/缓冲区中的单词。我相信你想要在 vim 7 中引入智能感知(R)(全能)。请参阅 C++ code completion - 不确定是否有帮助。

    【讨论】:

      猜你喜欢
      • 2023-03-30
      • 2012-11-19
      • 1970-01-01
      • 2011-09-24
      • 2011-07-22
      • 2011-10-22
      • 2011-01-06
      • 1970-01-01
      • 2012-04-09
      相关资源
      最近更新 更多