# HG changeset patch # User Steve Losh # Date 1316435873 14400 # Node ID 91190e67720f852c17602504d5225d4e675b6499 # Parent ea53db23b78075ea091c71056ed54a24c7e94b03# Parent 25f505f044d091876501137e8cc1ad51cf962763 Merge. diff -r ea53db23b780 -r 91190e67720f autoload/gundo.vim --- a/autoload/gundo.vim Sat Aug 27 16:38:43 2011 -0700 +++ b/autoload/gundo.vim Mon Sep 19 08:37:53 2011 -0400 @@ -19,24 +19,6 @@ finish endif"}}} -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 -endif - -if !s:has_supported_python - function! s:GundoDidNotLoad() - echohl WarningMsg|echomsg "Gundo requires Vim to be compiled with Python 2.4+"|echohl None - endfunction - command! -nargs=0 GundoToggle call s:GundoDidNotLoad() - finish -endif"}}} - -let s:plugin_path = escape(expand(':p:h'), '\') - if !exists('g:gundo_width')"{{{ let g:gundo_width = 45 endif"}}} @@ -61,7 +43,26 @@ if !exists("g:gundo_close_on_revert")"{{{ let g:gundo_close_on_revert = 0 endif"}}} +if !exists("g:gundo_prefer_python3")"{{{ + let g:gundo_prefer_python3 = 0 +endif"}}} +let s:has_supported_python = 0 +if g:gundo_prefer_python3 && has('python3')"{{{ + let s:has_supported_python = 2 +elseif has('python')" + let s:has_supported_python = 1 +endif + +if !s:has_supported_python + function! s:GundoDidNotLoad() + echohl WarningMsg|echomsg "Gundo requires Vim to be compiled with Python 2.4+"|echohl None + endfunction + command! -nargs=0 GundoToggle call s:GundoDidNotLoad() + finish +endif"}}} + +let s:plugin_path = escape(expand(':p:h'), '\') "}}} "{{{ Gundo utility functions @@ -265,7 +266,7 @@ function! s:GundoOpen()"{{{ if !exists('g:gundo_py_loaded') - if s:has_supported_python == 2 + if s:has_supported_python == 2 && g:gundo_prefer_python3 exe 'py3file ' . s:plugin_path . '/gundo.py' python3 initPythonModule() else @@ -370,7 +371,7 @@ "{{{ Gundo rendering function! s:GundoRenderGraph()"{{{ - if s:has_supported_python == 2 + if s:has_supported_python == 2 && g:gundo_prefer_python3 python3 GundoRenderGraph() else python GundoRenderGraph() @@ -378,7 +379,7 @@ endfunction"}}} function! s:GundoRenderPreview()"{{{ - if s:has_supported_python == 2 + if s:has_supported_python == 2 && g:gundo_prefer_python3 python3 GundoRenderPreview() else python GundoRenderPreview() @@ -386,7 +387,7 @@ endfunction"}}} function! s:GundoRenderChangePreview()"{{{ - if s:has_supported_python == 2 + if s:has_supported_python == 2 && g:gundo_prefer_python3 python3 GundoRenderChangePreview() else python GundoRenderChangePreview() @@ -398,7 +399,7 @@ "{{{ Gundo undo/redo function! s:GundoRevert()"{{{ - if s:has_supported_python == 2 + if s:has_supported_python == 2 && g:gundo_prefer_python3 python3 GundoRevert() else python GundoRevert() @@ -406,7 +407,7 @@ endfunction"}}} function! s:GundoPlayTo()"{{{ - if s:has_supported_python == 2 + if s:has_supported_python == 2 && g:gundo_prefer_python3 python3 GundoPlayTo() else python GundoPlayTo()