> let foobar = "test2.f"
>
> Using
> echo foobar
> results in test2.f (OK)
> Now I want to open test2.f
> :e foobar
> opens a file foobar
> :e 'foobar'
> opens the file 'foobar'
> What is the syntax to open test2.f using the foobar variable.
You have to build the string and execute it:
:exec 'e ' . foobar
Alternatively, you can use the expression-register and type:
:e ^R=foobar<cr>
where "^R" is control+R and <cr> is hitting <Enter> which works
for any evaluation, so you can do crazy things like
:e ^R=32*8<cr>.txt
would edit "256.txt".
You can read more at
:help :exec
:help c_CTRL-R_=
-tim
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment