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?

  • 1
    What is vim in the last expression? See :h set-&vim
    – Matt
    Mar 25, 2020 at 4:46
  • 2
    Does this answer your question? Is cpo&vim a special syntax? Mar 25, 2020 at 22:34
  • 1
    While, I totally agree with you all, the help page doesn't explain why the plugins have this habit. Mar 26, 2020 at 12:25
  • 1
    l00p, I've edited your question to make it less of a dupe (and more relevant to @LucHermitte 's answer). If you feel the edits go against the grain of the question you were asking, feel free to revert them. But I feel the question stands better on it's own this way
    – D. Ben Knoble
    Mar 26, 2020 at 14:42
  • 1
    Fair enough @LucHermitte; I've retracted the duplicate vote. Mar 27, 2020 at 2:57

1 Answer 1


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
  • @BLayer Indeed. thanks :) Mar 25, 2020 at 1:16
  • 1
    No problemo :) ...
    – B Layer
    Mar 25, 2020 at 3:01

Your Answer

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

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