René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

LET versus SET in VIM scripts to set options

Options, such as autoindent or textwidth can be set using either let or set is:
:set  guifont=Lucida_Console:h9:cANSI
:let &guifont="Lucida_Console:h9:cANSI"
Note the ampersand. :let actually assigns a value to a variable. The ampersand in front of an identifier turns the identifier into a variable whose value is the option's value.
One advantage of using :let is that you can use more complex expressions on the right hand side of the equal sign, e.g., combining the new guifont value from three variables containing the name, size, and encoding of the font:
:let &guifont="Lucida_Console" . ":" . "h9" . ":" . "cASNI"
Also, if using :set, double quote characters (") are considered comment starters, so everything after them is not part of the command.