Permalink
Browse files

gundo updated to 2.3.0

  • Loading branch information...
1 parent 9cce4a9 commit ca2daf37b2a50edde3f7dbb664ba82fbdc9e1253 @lilydjwg committed Feb 28, 2012
Showing with 75 additions and 42 deletions.
  1. +4 −1 autoload/gundo.py
  2. +55 −40 autoload/gundo.vim
  3. +12 −0 doc/gundo.txt
  4. +3 −1 plugin/gundo.vim
  5. +1 −0 vimrc
View
@@ -553,7 +553,10 @@ def _walk_branch(origin, dest):
return None
nodes.append(current)
- return reversed(nodes) if rev else nodes
+ if rev:
+ return reversed(nodes)
+ else:
+ return nodes
branch = _walk_branch(start, end)
View
@@ -19,24 +19,6 @@ if v:version < '703'"{{{
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('<sfile>:p:h'), '\')
-
if !exists('g:gundo_width')"{{{
let g:gundo_width = 45
endif"}}}
@@ -61,7 +43,26 @@ endif"}}}
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('<sfile>:p:h'), '\')
"}}}
"{{{ Gundo utility functions
@@ -215,6 +216,9 @@ function! s:GundoOpenGraph()"{{{
call s:GundoResizeBuffers(winnr())
endif
endif
+ if exists("g:gundo_tree_statusline")
+ let &l:statusline = g:gundo_tree_statusline
+ endif
endfunction"}}}
function! s:GundoOpenPreview()"{{{
@@ -249,6 +253,9 @@ function! s:GundoOpenPreview()"{{{
endif
endif
endif
+ if exists("g:gundo_preview_statusline")
+ let &l:statusline = g:gundo_preview_statusline
+ endif
endfunction"}}}
function! s:GundoClose()"{{{
@@ -265,13 +272,13 @@ endfunction"}}}
function! s:GundoOpen()"{{{
if !exists('g:gundo_py_loaded')
- 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 == 2 && g:gundo_prefer_python3
+ 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()
@@ -310,6 +317,14 @@ function! s:GundoToggle()"{{{
endif
endfunction"}}}
+function! s:GundoShow()"{{{
+ call s:GundoOpen()
+endfunction"}}}
+
+function! s:GundoHide()"{{{
+ call s:GundoClose()
+endfunction"}}}
+
"}}}
"{{{ Gundo mouse handling
@@ -370,26 +385,26 @@ endfunction"}}}
"{{{ Gundo rendering
function! s:GundoRenderGraph()"{{{
- if s:has_supported_python == 2
- python3 GundoRenderGraph()
+ if s:has_supported_python == 2 && g:gundo_prefer_python3
+ python3 GundoRenderGraph()
else
- python GundoRenderGraph()
+ python GundoRenderGraph()
endif
endfunction"}}}
function! s:GundoRenderPreview()"{{{
- if s:has_supported_python == 2
- python3 GundoRenderPreview()
+ if s:has_supported_python == 2 && g:gundo_prefer_python3
+ python3 GundoRenderPreview()
else
- python GundoRenderPreview()
+ python GundoRenderPreview()
endif
endfunction"}}}
function! s:GundoRenderChangePreview()"{{{
- if s:has_supported_python == 2
- python3 GundoRenderChangePreview()
+ if s:has_supported_python == 2 && g:gundo_prefer_python3
+ python3 GundoRenderChangePreview()
else
- python GundoRenderChangePreview()
+ python GundoRenderChangePreview()
endif
endfunction"}}}
@@ -398,18 +413,18 @@ endfunction"}}}
"{{{ Gundo undo/redo
function! s:GundoRevert()"{{{
- if s:has_supported_python == 2
- python3 GundoRevert()
+ if s:has_supported_python == 2 && g:gundo_prefer_python3
+ python3 GundoRevert()
else
- python GundoRevert()
+ python GundoRevert()
endif
endfunction"}}}
function! s:GundoPlayTo()"{{{
- if s:has_supported_python == 2
- python3 GundoPlayTo()
+ if s:has_supported_python == 2 && g:gundo_prefer_python3
+ python3 GundoPlayTo()
else
- python GundoPlayTo()
+ python GundoPlayTo()
endif
endfunction"}}}
View
@@ -17,6 +17,8 @@ CONTENTS *Gundo-contents*
3.7 gundo_map_move_older ...... |gundo_map_move_older|
gundo_map_move_newer ...... |gundo_map_move_newer|
3.8 gundo_close_on_revert ..... |gundo_close_on_revert|
+ 3.9 gundo_preview_statusline .. |gundo_preview_statusline|
+ gundo_tree_statusline ..... |gundo_tree_statusline|
4. License ........................ |GundoLicense|
5. Bugs ........................... |GundoBugs|
6. Contributing ................... |GundoContributing|
@@ -196,6 +198,14 @@ Set this to 1 to automatically close the Gundo windows when reverting.
Default: 0 (windows do not automatically close)
+------------------------------------------------------------------------------
+3.9 g:gundo_preview_statusline *gundo_preview_statusline*
+ g:gundo_tree_statusline *gundo_tree_statusline*
+
+Set these to a string to display it as the status line for each Gundo window.
+
+Default: unset (windows use the default statusline)
+
==============================================================================
4. License *GundoLicense*
@@ -219,6 +229,8 @@ GitHub: http://github.com/sjl/gundo.vim/
==============================================================================
7. Changelog *GundoChangelog*
+v2.3.0
+ * Add statusline configuration.
v2.2.2
* More performance improvements.
v2.2.1
View
@@ -18,5 +18,7 @@ let loaded_gundo = 1"}}}
"{{{ Misc
command! -nargs=0 GundoToggle call gundo#GundoToggle()
+command! -nargs=0 GundoShow call gundo#GundoShow()
+command! -nargs=0 GundoHide call gundo#GundoHide()
command! -nargs=0 GundoRenderGraph call gundo#GundoRenderGraph()
-"}}}
+"}}}
View
1 vimrc
@@ -833,6 +833,7 @@ let g:DirDiffExcludes = "*~,*.swp"
let g:DirDiffWindowSize = 20
" gundo[[[2
let gundo_preview_bottom = 1
+let gundo_prefer_python3 = 1
" bufexplorer[[[2
let g:bufExplorerFindActive = 0
" taglist[[[2

0 comments on commit ca2daf3

Please sign in to comment.