" ============================================================================ " File: gundo.vim " Description: vim global plugin to visualize your undo tree " Maintainer: Steve Losh " License: GPLv2+ -- look it up. " Notes: Much of this code was thiefed from Mercurial, and the rest was " heavily inspired by scratch.vim and histwin.vim. " " ============================================================================ "{{{ Init if v:version < '703'"{{{ function! s:GundoDidNotLoad() echohl WarningMsg|echomsg "Gundo unavailable: requires Vim 7.3+"|echohl None endfunction command! -nargs=0 GundoToggle call s:GundoDidNotLoad() finish endif"}}} if !exists('g:gundo_width')"{{{ let g:gundo_width = 45 endif"}}} if !exists('g:gundo_preview_height')"{{{ let g:gundo_preview_height = 15 endif"}}} if !exists('g:gundo_preview_bottom')"{{{ let g:gundo_preview_bottom = 0 endif"}}} if !exists('g:gundo_right')"{{{ let g:gundo_right = 0 endif"}}} if !exists('g:gundo_help')"{{{ let g:gundo_help = 1 endif"}}} if !exists("g:gundo_map_move_older")"{{{ let g:gundo_map_move_older = 'j' endif"}}} if !exists("g:gundo_map_move_newer")"{{{ let g:gundo_map_move_newer = 'k' 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(':p:h'), '\') "}}} "{{{ Gundo utility functions function! s:GundoGetTargetState()"{{{ let target_line = matchstr(getline("."), '\v\[[0-9]+\]') return matchstr(target_line, '\v[0-9]+') endfunction"}}} function! s:GundoGoToWindowForBufferName(name)"{{{ if bufwinnr(bufnr(a:name)) != -1 exe bufwinnr(bufnr(a:name)) . "wincmd w" return 1 else return 0 endif endfunction"}}} function! s:GundoIsVisible()"{{{ if bufwinnr(bufnr("__Gundo__")) != -1 || bufwinnr(bufnr("__Gundo_Preview__")) != -1 return 1 else return 0 endif endfunction"}}} function! s:GundoInlineHelpLength()"{{{ if g:gundo_help return 6 else return 0 endif endfunction"}}} "}}} "{{{ Gundo buffer settings function! s:GundoMapGraph()"{{{ exec 'nnoremap