hananana hananana - 1 year ago 75
Bash Question

How put variables in :[range]r[ead] !{cmd}

let variable = expand("%:p")
r! myScript path/to/dir variable

I am writing vim-plugin. But there is a problem that can not be solved by all means.

Code I want to do is above code.

Of course, that code return error.

Is way to put variable of VimScripts in "r!"?

PlZ teach me.....

Answer Source

You can use execute command to include variable namesand registers with other commands.

    : execute('r! '.myscript.path.variablename)

The above command interprets the values of the variables and then executes the command.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download