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.
redir.vim
Description: application/octetstream
