You've already discovered some basics of Vimscript syntax. To set internal Vim options, you use the set keyword:
To assign a value to a non-internal variable, use the let keyword:
let animal_name = 'Miss Cattington'
Vimscript doesn't have explicit booleans, so 1 is treated as true and 0 as false:
let is_cat = 1
Since we're assigning variables, let's talk about scopes. Vim handles variable and function scopes with prefixes, like so:
let g:animal_name = 'Miss Cattington'let w:is_cat=1
Each letter has a unique meaning, in particular the following:
- g: global scope (default if scope is not specified)
- v: global defined by Vim
- l: local scope (default within a function if scope is not specified)
- b: current ...