john-jones
john-jones

Reputation: 7780

vimscript buffer to get output of perl script

I'm trying to edit the copy-paste buffer:

I have the following command:

nmap gfb :let .shellescape(getreg('0'))=1<br>

that should have put the number 1 into the buffer, which is not happening.

how do i put the output of a perl script into a vimscript buffer?

Upvotes: 5

Views: 745

Answers (2)

Rob N
Rob N

Reputation: 1015

To get the output of an external command into a vim buffer you use system:

:let @0 = system("/bin/ls")
:echo @0

I'm not sure how this relates to Perl exactly. You might want to edit your question to clarify.

Upvotes: 3

Naveed
Naveed

Reputation: 726

To store 1 inside register 0:

:let @0 = 1

To do this in vimscript via perl:

function! Foo()
perl << EOF
    my $foo = 1;
    VIM::DoCommand(':let @0 = ' . $foo);
EOF
endfunction

Then you can call that function:

:call Foo()

Upvotes: 2

Related Questions