From 7364a7ebdd25e8aa0893cfe15adfab5f81e937d4 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 3 Jun 2019 21:09:51 +0200 Subject: vimrc: Use Gundo when -python3 and Undotree when +python3 I got this error today when opening Gundo: "__Gundo__" [New File] Error detected while processing function gundo#GundoToggle[1]..102_GundoToggle[6]..102_GundoOpen[31]..102_GundoRenderPreview: line 2: Traceback (most recent call last): File "", line 1, in File "HOME/.vim/bundle/gundo/autoload/gundo.py", line 474, in GundoRenderPreview _output_preview_text(_generate_preview_diff(current, node_before, node_after)) File "HOME/.vim/bundle/gundo/autoload/gundo.py", line 382, in _generate_preview_diff before_time, after_time)) File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/difflib.py", line 1177, in unified_diff _check_types(a, b, fromfile, tofile, fromfiledate, tofiledate, lineterm) File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/difflib.py", line 1312, in _check_types raise TypeError('all arguments must be str, not: %r' % (arg,)) TypeError: all arguments must be str, not: 74 Didn't really want to bother investigating, so I tried Undotree and it worked. Since I have different Vims on different machines, keep Gundo as before, but use Undotree instead when compiled with +python3. --- vimrc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'vimrc') diff --git a/vimrc b/vimrc index f2c62ab..9265b86 100644 --- a/vimrc +++ b/vimrc @@ -419,6 +419,9 @@ " * Add `tc` mapping to close current tab. " * Turn on 'undofile' for persistent undo. " +" 2019.06.03: +" * Use Gundo when -python3 and Undotree when +python3. +" " Pathogen @@ -605,10 +608,15 @@ if exists('g:colors_name') && g:colors_name ==# 'twilight256' endif -" Gundo -nnoremap gu :GundoToggle +" Gundo / Undotree if has('python3') - let g:gundo_prefer_python3 = 1 + let loaded_gundo = 1 + + nnoremap gu :UndotreeToggle +else + let g:loaded_undotree = 1 + + nnoremap gu :GundoToggle endif -- cgit v1.2.3