Ken Takata wrote: > 2016/7/8 Fri 5:32:58 UTC+9 Bram Moolenaar wrote: > > Christian Brabandt wrote: > > > > > > > On Do, 07 Jul 2016, Bram Moolenaar wrote: > > > > > > > > > > > > > > > > > Patch 7.4.1996 > > > > > > Problem: Capturing the output of a command takes a few commands. > > > > > > Solution: Add evalcmd(). > > > > > > Files: src/eval.c, runtime/doc/eval.txt, > > > > > > src/testdir/test_alot.vim, > > > > > > src/Makefile, src/testdir/test_evalcmd.vim > > > > > > > > > > Does that work recursively? e.g. what happens, if you do > > > > > :echo evalcmd(':redir =>a|syn|redir end') > > > > > > > > Nope. The help for :redir says: > > > > > > > > Only one ":redir" can be active at a time. > > > > > > Sorry, but in that case, I don't see how the evalcmd() is helping much. > > > I would have rather seen a fixed :redir command. Perhaps make use of > > > Neovims capture() function? > > > https://github.com/neovim/neovim/pull/4697 > > > > Hmm, wasn't aware that people wanted nested redirection. > > It's not so difficult to make that work, use another redir flag instead > > of reusing redir_vname. > > > > The neovim implementation is similar, but not better. > > It skips adding spaces where needed. > > The neovim implementation is based on mattn's patch. > https://groups.google.com/d/msg/vim_dev/H3Z3ChSUh_4/beZs6KzYdBsJ > > Comparing with mattn's capture(), evalcmd() lacks (at least) two items: > > * Checking for sandbox.
Not sure why that would be needed. If you are able to call evalcmd(), aren't you already out of the sandbox? > * Accepting a list of strings. (I'm not sure how this is useful.) That would be easy to add. But I also wondered if it is useful, at least in that way. And the way it's done you can't pass a multi-line statement such as "if". Would need to pass a getline function. -- hundred-and-one symptoms of being an internet addict: 228. You spend Saturday night making the counter on your home page pass that 2000 mark. /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.