import { op } from "https://deno.land/x/ddc_vim@v3.9.1/deps.ts";
const { path } = op;
This is a list of directories which will be searched when using the
gf
, [f, ]f, ^Wf, :find
, :sfind
, :tabfind
and other commands,
provided that the file being searched for has a relative path (not
starting with "/", "./" or "../"). The directories in the 'path'
option may be relative or absolute.
-
- Use commas to separate directory names:
-
set path=.,/usr/local/include,/usr/include
-
Spaces can also be used to separate directory names (for backwards compatibility with version 3.0). To have a space in a directory name, precede it with an extra backslash, and escape the space:
:set path=.,/dir/with\\\ space
-
To include a comma in a directory name precede it with an extra backslash:
:set path=.,/dir/with\\,comma
-
To search relative to the directory of the current file, use:
:set path=.
-
To search in the current directory use an empty string between two commas:
:set path=,,
-
A directory name may end in a ':' or '/'.
-
Environment variables are expanded
:set_env
. -
When using
netrw.vim
URLs can be used. For example, adding "http://www.vim.org" will make ":find index.html" work. -
Search upwards and downwards in a directory tree using "*", "**" and ";". See
file-searching
for info and syntax. -
- Careful with '' characters, type two to get one in the option:
-
set path=.,c:\include
- Or just use '/' instead:
-
set path=.,c:/include
Don't forget "." or files won't even be found in the same directory as
the file!
The maximum length is limited. How much depends on the system, mostly
it is something like 256 or 1024 characters.
You can check if all the include files are found, using the value of
'path', see :checkpath
.
The use of :set+=
and :set-=
is preferred when adding or removing
directories from the list. This avoids problems when a future version
uses another default. To remove the current directory use:
:set path-=
To add the current directory use:
:set path+=
To use an environment variable, you probably need to replace the separator. Here is an example to append $INCL, in which directory names are separated with a semi-colon:
:let &path = &path .. "," .. substitute($INCL, ';', ',', 'g')
Replace the ';' with a ':' or whatever separator is used. Note that this doesn't work when $INCL contains a comma or white space.
(default on Unix: ".,/usr/include,," other systems: ".,,")