diff options
| author | Teddy Wing | 2019-06-03 21:09:51 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2019-06-03 21:09:51 +0200 | 
| commit | 7364a7ebdd25e8aa0893cfe15adfab5f81e937d4 (patch) | |
| tree | 3130993e9b730f6fb317df13c216fd6ddbfae86b | |
| parent | bcdd58b8c4e1679f9cd15a09e14b7749f98e05c3 (diff) | |
| download | dotvim-7364a7ebdd25e8aa0893cfe15adfab5f81e937d4.tar.bz2 | |
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]..<SNR>102_GundoToggle[6]..<SNR>102_GundoOpen[31]..<SNR>102_GundoRenderPreview:
    line    2:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      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.
| -rw-r--r-- | vimrc | 14 | 
1 files changed, 11 insertions, 3 deletions
| @@ -419,6 +419,9 @@  "       * Add `<leader>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 <leader>gu :GundoToggle<cr> +" Gundo / Undotree  if has('python3') -	let g:gundo_prefer_python3 = 1 +	let loaded_gundo = 1 + +	nnoremap <leader>gu :UndotreeToggle<cr> +else +	let g:loaded_undotree = 1 + +	nnoremap <leader>gu :GundoToggle<cr>  endif | 
