Have Intellisense search current directory

From Vim Tips Wiki

Jump to: navigation, search
Tip 835 Printable Monobook Previous Next

created 2004 · complexity intermediate · author Anand Hariharan · version 6.0


This tip is relevant to those who use the "Intellisense" functionality for vim (http://insenvim.sourceforge.net) for C++. This requires, as a part of its setup, that the paths for all the included header files in a C++ file be present in the $INCLUDE variable. This is fine so long as all your header files are in one (invariant) location (say the MSVC's include directory). However, if your C++ file includes header files in locations relative to the current file, updating the INCLUDE environment variable is not an option.

For example, if your header files are in the same directory as your source file, simply add the following line to the cpp_vis.vim file that is delivered to the vimfiles\ftplugin location:

let $INCLUDE = expand("%:p:h") . ";" . $INCLUDE

To include other relative paths, simply tweak the argument to expand(). See :help filename-modifiers.

[edit] Comments

Personal tools