import { op } from "https://deno.land/x/ddc_vim@v4.0.2/deps.ts";
const { includeexpr } = op;
Expression to be used to transform the string found with the 'include' option to a file name. Mostly useful to change "." to "/" for Java:
:setlocal includeexpr=substitute(v:fname,'\\.','/','g')
The "v:fname" variable will be set to the file name that was detected.
Note the double backslash: the :set
command first halves them, then
one remains it the value, where "." matches a dot literally. For
simple character replacements tr()
avoids the need for escaping:
:setlocal includeexpr=tr(v:fname,'.','/')
Also used for the gf
command if an unmodified file name can't be
found. Allows doing "gf" on the name after an 'include' statement.
Also used for <cfile>
.
If the expression starts with s: or <SID>
, then it is replaced with
the script ID (local-function
). Example:
setlocal includeexpr=s:MyIncludeExpr()
setlocal includeexpr=<SID>SomeIncludeExpr()
Otherwise, the expression is evaluated in the context of the script where the option was set, thus script-local items are available.
It is more efficient if the value is just a function call without
arguments, see expr-option-function
.
The expression will be evaluated in the sandbox
when set from a
modeline, see sandbox-option
.
This option cannot be set in a modeline when 'modelineexpr' is off.
It is not allowed to change text or jump to another window while
evaluating 'includeexpr' textlock
.
(default "")
not available when compiled without the +find_in_path
or +eval
features