e95429ee6595

Add Python3 support
[view raw] [browse files]
author lilydjwg <lilydjwg@gmail.com>
date Sat, 30 Jul 2011 17:07:25 +0800
parents fa7b2854f44f
children 9524242bda64
branches/tags (none)
files autoload/gundo.vim

Changes

--- a/autoload/gundo.vim	Fri Jul 29 09:39:45 2011 -0400
+++ b/autoload/gundo.vim	Sat Jul 30 17:07:25 2011 +0800
@@ -19,7 +19,9 @@
     finish
 endif"}}}
 
-if has('python')"{{{
+if has('python3')"{{{
+    let s:has_supported_python = 2
+elseif has('python')
     let s:has_supported_python = 1
 else
     let s:has_supported_python = 0
@@ -263,8 +265,13 @@
 
 function! s:GundoOpen()"{{{
     if !exists('g:gundo_py_loaded')
-        exe 'pyfile ' . s:plugin_path . '/gundo.py'
-        python initPythonModule()
+	if s:has_supported_python == 2
+	  exe 'py3file ' . s:plugin_path . '/gundo.py'
+	  python3 initPythonModule()
+	else
+	  exe 'pyfile ' . s:plugin_path . '/gundo.py'
+	  python initPythonModule()
+	endif
 
         if !s:has_supported_python
             function! s:GundoDidNotLoad()
@@ -363,15 +370,27 @@
 "{{{ Gundo rendering
 
 function! s:GundoRenderGraph()"{{{
-    python GundoRenderGraph()
+    if s:has_supported_python == 2
+	python3 GundoRenderGraph()
+    else
+	python GundoRenderGraph()
+    endif
 endfunction"}}}
 
 function! s:GundoRenderPreview()"{{{
-    python GundoRenderPreview()
+    if s:has_supported_python == 2
+	python3 GundoRenderPreview()
+    else
+	python GundoRenderPreview()
+    endif
 endfunction"}}}
 
 function! s:GundoRenderChangePreview()"{{{
-    python GundoRenderChangePreview()
+    if s:has_supported_python == 2
+	python3 GundoRenderChangePreview()
+    else
+	python GundoRenderChangePreview()
+    endif
 endfunction"}}}
 
 "}}}
@@ -379,11 +398,19 @@
 "{{{ Gundo undo/redo
 
 function! s:GundoRevert()"{{{
-    python GundoRevert()
+    if s:has_supported_python == 2
+	python3 GundoRevert()
+    else
+	python GundoRevert()
+    endif
 endfunction"}}}
 
 function! s:GundoPlayTo()"{{{
-    python GundoPlayTo()
+    if s:has_supported_python == 2
+	python3 GundoPlayTo()
+    else
+	python GundoPlayTo()
+    endif
 endfunction"}}}
 
 "}}}
@@ -404,4 +431,4 @@
     autocmd BufNewFile __Gundo_Preview__ call s:GundoSettingsPreview()
 augroup END
 
-"}}}
\ No newline at end of file
+"}}}