In scripts it is customary to do something like:

let s:save_cpo = &cpo
set cpo&vim

... script ...

let &cpo = s:save_cpo

To ensure nocompatible mode for the script.


set cpo&vim

some sort of special syntax, as in foo & bar? Or is it more like a command, trigger line or something else?

2 Answers 2


Yes, it's a special syntax to reset options to the Vim defaults. From :help :set-&vim:

:se[t] {option}&        Reset option to its default value.  May depend on the
                        current value of 'compatible'. {not in Vi}
:se[t] {option}&vi      Reset option to its Vi default value. {not in Vi}
:se[t] {option}&vim     Reset option to its Vim default value. {not in Vi}

:se[t] all&             Set all options, except terminal options, to their
                        default value.  The values of 'term', 'lines' and
                        'columns' are not changed. {not in Vi}

I found it by just typing :help &vim (which also goes to :help :set-&vim) :-)


cpo means compatible option and & means option variable, so &cpo represents the value of compatible option.

set cpo&vim is a special syntax which tells vim to reset the option of cpo which defaults to aABceFs.

See the doc in :h cpo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.