Wednesday, October 31, 2012

Re: What do I need to read to understand g: and s: VIM variable prefixes?

On 10/31/12 06:05, Dotan Cohen wrote:
> On Wed, Oct 31, 2012 at 12:55 PM, Tony Mechelynck wrote:
>> Yes, and in addition, if you don't use a scope prefix Vim
>> implies l: if you're inside a function and g: otherwise.
>>
>> See :help internal-variables
>
> Thank you, that is not consistent with other programming
> environments that I am familiar with. Very good to know!

Python happens to work this way:

x = 42
def foo():
x = 32
return x
print foo()
print x

prints 32 followed by 42 (the x remains local to the function).
I've noticed little bits of Python show up in VimScript--such as
array slicing, negative-indexing, and first-class(ish) functions.
Not that I mind, as Python is my preferred language. :-)

There may be others where this scope is the same (pascal comes to mind)

-tim


--
You received this message from the "vim_use" 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

No comments: