let name = "John" echo "Hello, " . name You can either put this in a script (script.vim) and run it (:source script.vim), or you can type the commands individually in normal mode as :let and :echo. function! SuperTab() let l:part = strpart(getline('.'),col('.')-2,1) if (l:part =~ '^\W\?$') return "\<Tab>" else return "\<C-n>" endif endfunction imap <Tab> <C-R>=SuperTab()<CR> Here’s another example
![Vim scripting cheatsheet](https://cdn-ak-scissors.b.st-hatena.com/image/square/727bc4d579fc71b56671ec708fe362f42c27cfd1/height=288;version=1;width=512/https%3A%2F%2Fassets.devhints.io%2Fpreviews%2Fvimscript.jpg)