29bbe78a79df

Emit a warning when there is no Python support, or unsupported Python version
[view raw] [browse files]
author claytron
date Tue, 19 Oct 2010 14:35:07 -0400
parents 40049e1b235d
children b01d889ef2d7
branches/tags (none)
files plugin/gundo.vim

Changes

--- a/plugin/gundo.vim	Mon Oct 18 16:21:51 2010 -0400
+++ b/plugin/gundo.vim	Tue Oct 19 14:35:07 2010 -0400
@@ -16,6 +16,28 @@
 
 "let loaded_gundo = 1
 
+let s:warning_string = "Gundo requires that vim be compiled with Python 2.5+"
+" Check for Python support and required version
+if has('python')
+    let s:has_supported_python = 1
+python << ENDPYTHON
+import sys
+import vim
+if sys.version_info[:2] < (2, 5):
+    vim.command('let s:has_supported_python = 0')
+ENDPYTHON
+
+    " Python version is too old
+    if !s:has_supported_python
+        echo s:warning_string
+        finish                                                                                                          
+    endif
+else
+    " no Python support
+    echo s:warning_string
+    finish
+endif
+
 if !exists('g:gundo_width')
     let g:gundo_width = 45
 endif