If there is no variable in path, gf can open the file.
Added sfname+={,}
to .vimrc to support ${VARIABLE}.
:!echo ${VAR}/test/file
can correctly print full path with ${VAR} expanded.
But if run 'gf' on it, it gives error: E447: Can't find file "${VAR}/test/file" in path
How to fix this?
:h expand-env
and:h gf
, environmental variables are expanded in the form$HOME
. Can you use this form instead of${HOME}
? Otherwise you will need to probably use'includeexpr'
and a substitution (substitute('${HOME}/test/file', '\${\([^}]*\)}', '\=expand("$".submatch(1))', 'g')
) – Peter Rincker Aug 23 '18 at 20:04let $ROOT = '/full/path'
. Can't define it aslet $ROOT = '~/path'
. After $ROOT is defined and the expanded path is valid, I cangf
goto the file. – Fisher Aug 24 '18 at 10:14