Please explain following two lines found in synload.vim
file:
let s:cpo_save = &cpo
set cpo&vim
What is vim
in the last expression? What is result of such an expression, and what does it affect?
It resets 'cpo'
value to its default value.
Some people may be running vim in compatible mode, by choice or not. In those cases, various things would be inhibited, things we usually rely upon when writing plugins -- in particular :h line-continuation
. As a consequence, the plugins would emit many error messages.
Resetting 'cpo'
to its factory setting, the plugin becomes resilient to these hostile (IMO) configurations.
This syntax could be used with many (all?) vim options. Before doing that, we record the old value in order to properly restore it afterward
let s:cpo_save = &cpo
set cpo&vim
.
. plugin code
.
let &cpo = s:cpo_save
What is vim in the last expression?
See:h set-&vim