History Report a problem
Article Edit this page Discussion

Provide script-accessible version info in your plugins

From Vim Tips Wiki

Jump to: navigation, search
 

Tip 1559Previous TipNext Tip

Created: April 25, 2008 Complexity: intermediate Author: David Fishburn Version: 7.0


Most plugins have something like the following at the beginning:

if exists('g:loaded_dbext') || &cp
  finish
endif
let g:loaded_dbext = 1

This prevents the plugin from being sourced more than once. It successfully accomplishes this task, but is essentially useless after that. So I have taken to setting the variable to the version of the plugin, rather than just 1. For example:

if exists('g:loaded_dbext') || &cp
  finish
endif
let g:loaded_dbext = 503

This way, other plugins that utilize my plugin can verify the version, and provide useful error messages or handle things as needed.

[edit] References

[edit] Comments

 

Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto
Doctor Who
Legend of Zelda Wiki
Terminator Wiki
Everquest II Wiki
Mystery Science Theater 3000
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions
Send this article to a friend
"Provide script-accessible version info in your plugins"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation