I see this guard clause at the top of a lot of plugins,

if exists("g:loaded_thisplugin") || v:version < 700 || &cp
let g:loaded_thisplugin = 1

Is there something specific about versions of Vim prior to 7.0 that motivates this version check?

2 Answers 2


v:version specifies your current version of Vim. Version 7.0 has version 700, 7.2 has version 702, etc.

Now, version 7 was a very major release with many enhancements to the previous release 6, that introduced man scripting enhancements. For example I believe prior to that version dictionaries, Funcrefs and lists were not available, many functions did not exists, no floating point data type (that one was actually included I believe with 7.2), Tab pages were not possible, Spell checking has been included, Completion functions have been added, the undo branches feature was added, and so on.

So in principle this is just a guard, that your plugin is run by a Vim version, that has all required features needed for the plugin to perform its work.

If you are interested in what feature was added in which version, read the help at :h new-8, :h new-7 :h new-6, etc...

  • 3
    autoloaded functions have also been added in Vim7. Mar 8, 2018 at 14:30
  • Ah oh yes, of course. Mar 8, 2018 at 20:15

Not all plugins have this condition. This is added if the plugin uses a feature that didn’t exist before version 7.

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.