TOOL » VIM » VIMSCRIPT

Variables

Namespaces

See help for internal-variables for more details.

SyntaxDescription
myvarLocal to a function, may conflict with other scopes.
a:myargArgument.
b:myvarLocal to buffer.
w:myvarLocal to window.
s:myvarLocal to script.
l:myvarLocal to function.
g:myvarGlobal.
&shiftwidthGlobal setting.
$HOMEEnvironment variable.

Set variable value

Differently of other programming languages, on every value change let keyword is needed.

vim
let myvar = 'Hello'

Variable existence

Checks if the variable / function is defined. Check the help for exists for more details.

vim
echo exists('&setting')
echo exists('*function')
echo exists('varname')