# HG changeset patch # User lilydjwg # Date 1312016845 -28800 # Node ID e95429ee65956ba31dc7daa062bf155de4140de1 # Parent fa7b2854f44faadd3b1c35ae63ae74a7c5bd5c2d Add Python3 support diff -r fa7b2854f44f -r e95429ee6595 autoload/gundo.vim --- 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 +"}}}