I have done this:
:reg a
"a iabc
I want to output the value in register a like :w !xargs -n1 echo
command, but not all buffer content just the register value.
Thx in advanced!
:echo getreg('a')
getreg([{regname} [, 1 [, {list}]]])
The result is a String, which is the contents of register
{regname}
. Example::let cliptext = getreg('*')
When
{regname}
was not set the result is an empty string.
getreg('=')
returns the last evaluated value of the expression register. (For use in maps.)getreg('=', 1)
returns the expression itself, so that it can be restored withsetreg()
. For other registers the extra argument is ignored, thus you can always give it. If{list}
is present and TRUE, the result type is changed to List. Each list item is one text line. Use it if you care about zero bytes possibly present inside register: without third argument both NLs and zero bytes are represented as NLs (see NL-used-for-Nul). When the register was not set an empty list is returned. If{regname}
is not specified,v:register
is used.
Wrap in exe
to use the value of getreg within a vim command:
:exe ":!echo ".getreg('a')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With