2009/3/16 StarWing <[email protected]>
>
>
>
> On 3月16日, 下午6时15分, Tony Mechelynck <[email protected]>
> wrote:
> > 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.
>
> So, is it a bug?
No
It is consistent with other use of g:var, l:var, var inside the function.
redir => g:var | let g:var = 0 " (in a function) refers to global var
redir => l:var | let l:var = 0 " (in a function) refers
to local var
redir => var | let var = 0 " (in a function) refers to
local local var,
" it's reserved
name like 'count'
Everything is consistent. Where do you see a problem ?
Yakov
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---