TOOL » NEOVIM » 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/unset variable

Create/change a variable with let.

vim
let myvar = 'Hello'

Delete a variable with unlet.

vim
unlet myvar

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')