From 7aeed3b5f0eeca0e9727bf908f6bd9847bc494fd Mon Sep 17 00:00:00 2001 From: Nathaniel Date: Tue, 30 Oct 2018 22:03:01 -0700 Subject: [PATCH 1/2] Change python version check Hello, I run neovim without python2 support, currently without setting `g:gundo_prefer_python3` I get an error regarding the import of the neovim module (to be expected), this removes the need to set the above mentioned variable when running with only python3 support, while otherwise keeping the same default behaviour. Cheers, and thank you for creating such an awesome plugin. Nathaniel --- autoload/gundo.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/gundo.vim b/autoload/gundo.vim index f8894d0..21a2a68 100644 --- a/autoload/gundo.vim +++ b/autoload/gundo.vim @@ -57,7 +57,7 @@ if !exists("g:gundo_return_on_revert")"{{{ endif"}}} let s:has_supported_python = 0 -if g:gundo_prefer_python3 && has('python3')"{{{ +if has('python3') && (g:gundo_prefer_python3 || !has('python'))"{{{ let s:has_supported_python = 2 elseif has('python')" let s:has_supported_python = 1 From b9fb338b8501e4c01032770b24edebecece3d856 Mon Sep 17 00:00:00 2001 From: Nathaniel Date: Tue, 30 Oct 2018 22:12:35 -0700 Subject: [PATCH 2/2] Remove additional 'g:gundo_prefer_python3' checks These check are no longer needed, we will either have python, or python3, or have thrown an error and finished. --- autoload/gundo.vim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/autoload/gundo.vim b/autoload/gundo.vim index 21a2a68..ae5ec8e 100644 --- a/autoload/gundo.vim +++ b/autoload/gundo.vim @@ -282,7 +282,7 @@ endfunction"}}} function! s:GundoOpen()"{{{ if !exists('g:gundo_py_loaded') - if s:has_supported_python == 2 && g:gundo_prefer_python3 + if s:has_supported_python == 2 exe 'py3file ' . escape(s:plugin_path, ' ') . '/gundo.py' python3 initPythonModule() else @@ -403,7 +403,7 @@ endfunction"}}} "{{{ Gundo rendering function! s:GundoRenderGraph()"{{{ - if s:has_supported_python == 2 && g:gundo_prefer_python3 + if s:has_supported_python == 2 python3 GundoRenderGraph() else python GundoRenderGraph() @@ -411,7 +411,7 @@ function! s:GundoRenderGraph()"{{{ endfunction"}}} function! s:GundoRenderPreview()"{{{ - if s:has_supported_python == 2 && g:gundo_prefer_python3 + if s:has_supported_python == 2 python3 GundoRenderPreview() else python GundoRenderPreview() @@ -419,7 +419,7 @@ function! s:GundoRenderPreview()"{{{ endfunction"}}} function! s:GundoRenderChangePreview()"{{{ - if s:has_supported_python == 2 && g:gundo_prefer_python3 + if s:has_supported_python == 2 python3 GundoRenderChangePreview() else python GundoRenderChangePreview() @@ -431,7 +431,7 @@ endfunction"}}} "{{{ Gundo undo/redo function! s:GundoRevert()"{{{ - if s:has_supported_python == 2 && g:gundo_prefer_python3 + if s:has_supported_python == 2 python3 GundoRevert() else python GundoRevert() @@ -439,7 +439,7 @@ function! s:GundoRevert()"{{{ endfunction"}}} function! s:GundoPlayTo()"{{{ - if s:has_supported_python == 2 && g:gundo_prefer_python3 + if s:has_supported_python == 2 python3 GundoPlayTo() else python GundoPlayTo()