Hi mattn!
On Mi, 01 Mai 2013, mattn wrote:
> 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.
Perhaps we should first fix redir before we introduce another similar
function?
regads,
Christian
--
Zerstreuete Gedanken lieset man wieder zerstreuet und blättert in
ihnen herum.
-- Jean Paul
--
--
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.