On 15/03/09 04:18, StarWing wrote:
>
> use redir in functions, e.g.
> func! Func1()
>      redir =>  funclist
>      silent func
>      redir END
>      " .... other sentence ...
>
> endfunc
>
> funclist maybe a local-variable, but it is globle variable here, must
> write
> redir =>  l:funclist
> to make funclist a local variable.
>
> the doc only said:
> :redi[r] =>  {var}    Redirect messages to a variable.  If the variable
>                       doesn't exist, then it is created.  If the variable
>                       exists, then it is initialized to an empty string.
>                       The variable will remain empty until redirection ends.
>                       Only string variables can be used.  After the
>                       redirection starts, if the variable is removed or
>                       locked or the variable type is changed, then further
>                       command output messages will cause errors. {not in Vi}




Here's the relavant info, from elsewhere in the docs:

>                                               *global-variable* *g:var*
> Inside functions global variables are accessed with "g:".  Omitting this will
> access a variable local to a function.  But "g:" can also be used in any other
> place if you like.
>
>                                               *local-variable* *l:var*
> Inside functions local variables are accessed without prepending anything.
> But you can also prepend "l:" if you like.  However, without prepending "l:"
> you may run into reserved variable names.  For example "count".  By itself it
> refers to "v:count".  Using "l:count" you can have a local variable with the
> same name.

So, _inside_ a function, funclist (with no explicit namespace) is 
equivalent to l:funclist. _Outside_ all functions it is equivalent to 
g:funclist.


Best regards,
Tony.
-- 
We apologise again for the fault in the subtitles.  Those responsible for
sacking the people who have just been sacked have been sacked.
                  "Monty Python and the Holy Grail" PYTHON (MONTY) 
PICTURES LTD

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui