You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you use a variable without a scope outside a function, implicitly its scope is global scope(g:). Generally when you use a variable outside a function, you have to define it with script scope(s:).
The variable isn't used outside a function, so it's implicitly locally scoped. See :help local-variable:
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.
vint should definitely warn if you use any reserved variable name without l: but I think generally being able to recognize undecorated variable names --> local is helpful and it makes g: or s: stand out more.
The text was updated successfully, but these errors were encountered:
I don't understand why vint encourages people to make their vimscript less readable by including extra decoration on variables.
I often have code like this:
And I get this warning:
However, Anti-pattern of vimrc (Scope of identifier) says:
The variable isn't used outside a function, so it's implicitly locally scoped. See
:help local-variable
:vint should definitely warn if you use any reserved variable name without
l:
but I think generally being able to recognize undecorated variable names --> local is helpful and it makesg:
ors:
stand out more.The text was updated successfully, but these errors were encountered: