Yes, I know.

> Probably a nice addition, but one can already do all of this in vimscript, 
> see attachment. 
> In your example, replace capture() with StrRedir().

No, it can't. It depend on your vim script. We want to get the result without 
side effect.

---------------------------------
function! s:bar()
  let a = ''
  redir => a
  call thirdparty#library#function() 
  redir END
  return a
endfunction

echo s:bar()
---------------------------------

Do you know the wheather thirdparty#library#function() call redir? or not?
I don't think all of vim script like the thirdparty#library#function() call 
your Redir function.

On Wednesday, May 1, 2013 8:45:07 PM UTC+9, Andy Wokula wrote:
> Am 01.05.2013 13:21, schrieb mattn:
> 
> > Hi, list.
> 
> >
> 
> > I wrote a patch to add new function 'capture()'.
> 
> > When you want to get a list of all commands/functions/mappings with using 
> > vim script, probably, you'll do like follow.
> 
> >
> 
> > ---------------------------------
> 
> > let funcs = ''
> 
> > redir => funcs
> 
> > silent! function
> 
> > redir END
> 
> > ---------------------------------
> 
> >
> 
> > I guess, most of vim script programmers want to get the result as 
> > expression.  not command, want to get more easily.
> 
> > If vim have 'capture()' which allow to getting those command line 
> > 'function', I guess this is very useful.
> 
> >
> 
> > For example, getting :Command list as array.
> 
> > ---------------------------------
> 
> > :echo map(split(capture("command"), "\n")[1:], 'split(v:val[4:])[0]')
> 
> > ---------------------------------
> 
> >
> 
> > One more thing. vim doesn't support nest of :redir.
> 
> > ---------------------------------
> 
> > function! s:foo()
> 
> >    let a = ''
> 
> >    redir => a
> 
> >    silent echo "foo"
> 
> >    redir END
> 
> >    return a
> 
> > endfunction
> 
> >
> 
> > function! s:bar()
> 
> >    let a = ''
> 
> >    redir => a
> 
> >    call s:foo()
> 
> >    redir END
> 
> >    return a
> 
> > endfunction
> 
> >
> 
> > echo s:bar()
> 
> > ---------------------------------
> 
> >
> 
> > This 'echo s:bar()' doesn't show anything. But capture() can do it.
> 
> > ---------------------------------
> 
> > echo capture("s:bar()")
> 
> >
> 
> > foo
> 
> > ---------------------------------
> 
> >
> 
> > capture() is working on sandbox. so you can't use this in modeline.
> 
> >
> 
> > Below is a patch. How about this new feature?
> 
> >
> 
> > https://gist.github.com/mattn/5449425
> 
> >
> 
> > - Yasuhiro Matsumoto
> 
> 
> 
> Probably a nice addition, but one can already do all of this in vimscript,
> 
> see attachment.
> 
> 
> 
> (the script is not in release shape ... just what I use at the moment).
> 
> 
> 
> In your example, replace capture() with StrRedir().
> 
> 
> 
> see also (my older version, didn't get any feedback on it):
> 
> https://groups.google.com/d/msg/vim_use/Ea3IW7JH5MM/p41COFlyMO0J
> 
> 
> 
> -- 
> 
> Andy

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui