I am using includeexpr
and substitute()
in a ftplugin to remove a portion of an include string for gf
functionality (in twig template files, for the curious), but I get an error instead.
Twig includes look like this:
{% include "@mynamespace/footer/footer.twig" %}
I already have my path
setup to include the twig template directory, and I want to remove the @mynamespace/
piece to properly map to the filesystem.
I used this expression, adapted from the helpdocs example for Java.
setlocal includeexpr=substitute(v:fname,'@mynamespace/','','')
However, when I try to gf
an include, I get this error:
E447: Can't find file "mynamespace/footer/footer.twig" in path
I would have expected substitute()
to remove the @mynamespace/
piece. I looked at the documentation, and couldn't see anything I was doing wrong. I tried messing around with different invocations, using \
to escape the @
or /
, but always got the same error.
Any help would be greatly appreciated. Thanks in advance.