small medium large xlarge

23 Feb 2015, 17:58
Matthias Günther (3 posts)

Hi Ben just started to read your book and could learn a lot so far.

Working though the variables scope of the book under p. 14 I had some additional scopes in my notes about VimL:

  • “a:” - argument scope (using params of the signature of the function)
  • “g:” - global scope (this is the default scope)
  • “l:” - function scope
  • ”s:” - specifying script variables, they can only used within a script
  • “b:” - local to buffer
  • “w:” - local to window

Do I have everyone some of them? Maybe it’s a good idea to make a rerence to them on the vimdocs.



03 Mar 2015, 21:55
Benjamin Klein (7 posts)

Hello Matthias,

You are correct—that list is only missing two scopes (t:, for variables local to a tab page and v:, which is just used by special Vim variables).

Under “Constructing a Statusline,” in Chapter 4, I do mention the script scope s:, but I don’t think I cover b:or w:.

Also I just checked, and although I do mention :help internal-variables (where you can see the full list, with details), I did not actually state how many scopes there were. (Oops!) Perhaps I should fix that.



You must be logged in to comment