Reputation: 16184
How can I source a vim script whose filename is contained in a variable?
Just like :source
, except that the parameter isn't a string literal, but a variable name.
Upvotes: 4
Views: 2419
Reputation: 21507
You can always use :execute
to build a command dynamically:
:execute 'source '.fnameescape(myvar)
Upvotes: 10