Search notes:

Vim: variables

Data types

A variable has a data type which is one of
See also type()

TODO

A special (environment) variable is VIMINIT (and EXINIT?): it/they(?) influences which vimrc / initialization file is read at startup (source_startup_scripts()).

Global (g:) variables

Global variables might be stored in the viminfo file.

g:filetype_*

It seems that the g:filetype_* variables are used in runtime/autoload/dist/ft.vim.
For example, g:filetype_sql can be set define a filetype to be used for *.sql files. This variable is used in the mentioned ft.vim file like so:
func dist#ft#SQL()
  if exists("g:filetype_sql")
    exe "setf " . g:filetype_sql
  else
    setf sql
  endif
endfunc
dist#ft#SQL is called by an autocommand that is defined in $VIMRUNTIME/filetype.vim:
au BufNewFile,BufRead *.sql                   call dist#ft#SQL()

v: variables

set_vim_var_string (eval.c)
v: variables are identified with the VV_ macros (vim.h).
v:lang and v:lc_time are set according to the current locale settings (set_lang_var in ex_cmds2.c).

Three special $ variables

$HOME, $VIM and $VIMRUNTIME are treated specially, see vim_getenv() in src/misc1.c.
Apparently, the $VIMRUNTIME must not end in a backslash (on Windows).

Index