2

If I issue the Ex command

:!xv file.png  

all is well, and xv starts and displays the file.

But if file.png is in a register or variable, which is necessary as I wish to do this in a script, the command fails because vim does not substitute the content of the register or variable for its name. xv then gives a file not found error, e.g. "Can't open /file/path/@m"
The motion versions of the ! command, e.g. :W!xv, also fail because the text is piped to xv, rather than received as a positional parameter

Is it possible pass the content of variable or register to an external command?

1 Answer 1

3

The exec command performs register substitutions, constructing a command line from them:

exec "!xv" @m

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .