VIM¶
A Jupyter kernel for Vim script: github repo. Other available Jupyter kernels can be found here
pip3 install vim-kernel --break-system-packages
python3 -m vim_kernel.install
Variable Scopes in Vimscript¶
Vimscript uses various prefixes to define the scope of variables:
g: (global): variables accessible from anywhere.b: (buffer): variables local to the current buffer.w: (window): variables local to the current window.t: (tab page): variables local to the current tab page.l: (function local): variables local to a function.s: (script local): variables local to a specific Vimscript file.a: (function argument): formal parameters within a function.v: (vim built-in): predefined Vim variables.env: (environment): environment variables.
Function¶
In [0]:
function s:tasty()
echo "Tasty"
endfunction
call s:tasty()
Tasty
In [2]:
function Yummy()
let location = "tummy"
return "Yummy in my " . location
endfunction
echo Yummy()
Yummy in my tummy