René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

Script variables (s:) in VIM

A variable can be prefixed with s:. The scope of the variable is then extended (or limited, depending on one's view) to the file in which it occurs.
script_var_1.vim
fu! Set_func_1() 
  let s:var = 'ONE'
endfu

fu! Get_func_1() 
  return s:var
endfu
script_var_2.vim
fu!,/vim/scripting/function.html Set_func_2() 
  let,/vim/let_vs_set.html s:var = 'TWO'
endfu

fu! Get_func_2() 
  return s:var
endfu
:so script_var_1.vim
:so script_var_2.vim

:call Set_func_1
:call Set_func_2

:echo Get_func_1()
:echo Get_func_2()