Tuesday, October 30, 2012

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

Hello,

> What do I need to read to understand g: and s: VIM variable prefixes?
> This one is hard to guess for the built in help, and Google isn't
> helping.

Have you tried
:h s:^D
?
which will give you :h s:var

> The root of the issue is trying to figure out why g:someVariable can
> be seen in SomeFunction() but cannot be seen in s:AnotherFunction().

someVariable in a function will be actually l:someVariable. When accessing global variables from functions, always prefix them with g:.


> What is the s: for that precedes the second function's name, and why
> does it change scope (s for scope, perhaps)? Thanks.

s: stands for script. The scope of the variable is the script. As file static variables in C.

HTH,
--
Luc Hermitte
http://lh-vim.googlecode.com/
http://hermitte.free.fr/vim/

--
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:

Post a Comment