Wikia

Vim Tips Wiki

Changes: Provide script-accessible version info in your plugins

Edit

Back to page

(Adjust previous/next navigation)
(Assign tip id + convert to TipNew template + minor clean)
 
Line 1: Line 1:
{{TipProposed
+
{{TipNew
|id=0
+
|id=1559
|previous=0
+
|previous=1558
|next=0
+
|next=1560
 
|created=April 25, 2008
 
|created=April 25, 2008
 
|complexity=intermediate
 
|complexity=intermediate

Latest revision as of 04:47, May 12, 2008

Tip 1559 Printable Monobook Previous Next

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.

ReferencesEdit

CommentsEdit

Around Wikia's network

Random Wiki