hananana hananana - 8 months ago 32
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.....


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.