如何告诉Vim编辑器关于我的包含文件路径,以便当我按CTRL + N它可以自动完成函数名称?Vim关键字完成
例如,我有一个像下面的C程序:
#include<stdio.h>
int main()
{
sca // here I press control+N, it does not complete to scanf
}
如何告诉Vim编辑器关于我的包含文件路径,以便当我按CTRL + N它可以自动完成函数名称?Vim关键字完成
例如,我有一个像下面的C程序:
#include<stdio.h>
int main()
{
sca // here I press control+N, it does not complete to scanf
}
在你.vimrc
,路径添加到您的.vimrc
:
set path+=/usr/include/**
set path+=/my_include_dir/include
set path+=/my_include_dir/srclib/apr/**
set path+=/my_other_include_dir/srclib/apr-util/**
** means all sub-directories.
* means all contained directories
. means all files in the directory of the found file
+= means prepend to existing path (iirc)
可以检查的路径,以及通过打开文件然后输入
:checkpath
这会给你一个列表会包含缺少的文件。注:它似乎不处理预处理器指令,所以你会得到一些误报。输入
:checkpath!
将提供找到和丢失的包含文件的完整列表。
此外,重要的是要注意有很多完成功能。
^x ^o = "omnicomplete"
^x ^i = "included-files completion"
^x ^f = "path completion"
^x ^l = "Complete this line using one that looks the same"
看到
:help ins-completion
更多。
如果文件位于标准位置,Vim可能也会知道路径。 < C-n >使用'完整'选项和标记i
扫描包含文件。要添加i
为“完成”:
set complete+=i
你也可以得到你想要完成的符号,你可以使用一个标签文件:
set complete+=t
我在使用vim视窗 – chappar 2008-11-21 09:41:08