There are basically, two forms of modelines. Let me copy in the most important parts here together with an example:
There are two forms of modelines. The first form:
The second form (this is compatible with some versions of Vi):
/* vim: set ai tw=75: */
Since you have been using the
:set command, this means you are trying to create the latter form. There are two things to note here: First, you cannot use whitespace in the option value, otherwise Vim will parse those as separate options. The second is, you need to add a trailing
: to indicate where the modeline ends.
This means, in your case, the complete line with the modeline should look like this:
// vim: set path+=../include:
Here is a simple tip, I use when creating a modeline. After reloading the file (
:e), you can check the value of the options from the modeline by using
:verbose set path?. Vim will output something like:
Last set from modeline line 8
:. This should work from my limited testing:
// vim: set path+=../include:You can always check the result (after loading the file) using
:verbose set path?