Loading ...
Sorry, an error occurred while loading the content.

69421Re: capture() function to get output of command

Expand Messages
  • Ingo Karkat
    May 7, 2013
      On 07-May-2013 05:57 +0200, mattn wrote:

      >> I fully agree, it would be better if :redir could be fixed; even with my
      >> proposed inclusion of split()ing into lines, the additional benefit is
      >> low, and it will take a long time until plugins can fully benefit from
      >> that function without a compatibility wrapper.
      >> Because I'm still mostly ignorant of the Vim source code, I had assumed
      >> the patch author has found fixing :redir too difficult (as it also /
      >> mostly handles file and register targets where there indeed will be
      >> issues with overriding); I hope mattn can shed some light on that.
      > The functions in message.c write message with color attributes. So if
      > splitting per line, it must get whole contents at the first.

      Well, okay; right now, if split() is called separately, that works out
      the same.

      > I guess someone want to get the contents as text which contains \n,
      > but someone want to get the contents as array of lines. So I want to
      > keep the contents as text.

      My point is that I've *never* seen that use case so far in plugins; they
      all want to parse the captured output into a data structure. Do you have
      any counterexample? (And for that rare use case, they could be join()'ed
      back together easily.)

      Any way, that built-in splitting would only be one weak counterargument
      in favor of a separate capture() function. Could you make :redir work
      with nested invocations instead?!

      -- regards, ingo

      You received this message from the "vim_dev" 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

      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Show all 26 messages in this topic