如何告诉Vim编辑器我的包含文件路径,以便在按CTRL+ 时它可以自动完成功能名称N?
例如,我有一个如下的C程序:
#includeint main() { sca // here I press control+N, it does not complete to scanf }
Rob Wells.. 19
在你的.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!
将提供已找到和缺失的包含文件的完整列表.
在你的.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
更多.