Monday, May 7, 2012

Re: Getting the value of runtimepath from the command line

On Monday, May 7, 2012 5:34:53 AM UTC-6, John Little wrote:
> A challenge left hanging... I foolishly took the bait, though I'm not claiming success, such inelegance as follows cannot be termed such.
[snip scary looking stuff]

:D I didn't mean that as a challenge, but thanks for the hour's worth of yak-shaving exploring coproc. But, I'm using perl and that would make it more complicated. This is what I've done, if anyone's curious.

my @doc_dirs = do {

my $fh = File::Temp->new;
my $tmpfile = $fh->filename;

# Thanks to John Little on vim_use for the pointer to redir.
# https://groups.google.com/d/msg/vim_use/tGQdQX4MB68/kIhYPAMMsTgJ
my @cmd = ( 'vim', '-c', "redir! > $tmpfile", '-c', 'echo &rtp', '-c', 'redir END', '-c', 'q' );
my ( undef, $err, $syserr, $time ) = run3( \@cmd );

warn "Took $time seconds to run @cmd\n";
die "err: ($syserr) $err\n" if $syserr;
die "$err\n" if $err ne '' && $err ne 'Vim: Warning: Output is not to a terminal';

map { "$_/doc" }
grep { ! /^$/ }
split /[,\s]+/, do { local $/ ; <$fh> };

};

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: