gf runs fine with absolute or relative path.
Is it possible to open a file with variable in the path?

For example, in a tcl file:

set FILE_ROOT /user/abc
read_file ${FILE_ROOT}/some/path/abc.txt

How to open ${FILE_ROOT}/some/path/abc.txt inside vim?

  • With :exe -- I'm quite sure it has been answered more than once. – Luc Hermitte Mar 21 '18 at 11:54
  • @LucHermitte You mean manually add g:filepath variable and :exe "0read" g:filePath? Wondering if there is a more easy way. – Fisher Mar 21 '18 at 12:03
  • Yep. You can also use backtick+equal depending on your version of vim -- sorry I haven't found how to type it in the comments. – Luc Hermitte Mar 21 '18 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.