" ============================================================================ " File: mundo.vim " Description: vim global plugin to visualize your undo tree " Maintainer: Hyeon Kim " 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. " " ============================================================================ let s:save_cpo = &cpoptions set cpoptions&vim "{{{ Init " Initialise global vars let s:auto_preview_timer = -1"{{{ let s:preview_outdated = 1 let s:has_supported_python = 0 let s:has_timers = 0 let s:init_error = 'Initialisation failed due to an unknown error. ' \ . 'Please submit a bug report :)' " This has to be outside of a function, otherwise it just picks up the CWD let s:plugin_path = escape(expand(':p:h'), '\')"}}} " Default to placeholder functions for exposed methods function! mundo#MundoToggle() abort "{{{ call mundo#util#Echo('WarningMsg', \ 'Mundo init error: ' . s:init_error) endfunction function! mundo#MundoShow() abort call mundo#util#Echo('WarningMsg', \ 'Mundo init error: ' . s:init_error) endfunction function! mundo#MundoHide() abort call mundo#util#Echo('WarningMsg', \ 'Mundo init error: ' . s:init_error) endfunction "}}} " Check vim version if v:version =? '800' && has('timers') let s:has_timers = 1 endif"}}} " Check python version if g:mundo_prefer_python3 && has('python3')"{{{ let s:has_supported_python = 2 elseif has('python')" let s:has_supported_python = 1 elseif has('python3')" let s:has_supported_python = 2 endif if !s:has_supported_python let s:init_error = 'A supported python version was not found.' let &cpoptions = s:save_cpo finish endif"}}} " Python init methods function! s:InitPythonModule(python)"{{{ exe a:python .' import sys' exe a:python .' if sys.version_info[:2] < (2, 4): '. \ 'vim.command("let s:has_supported_python = 0")' endfunction"}}} function! s:MundoSetupPythonPath()"{{{ if g:mundo_python_path_setup == 0 let g:mundo_python_path_setup = 1 call s:MundoPython('sys.path.insert(1, "'. s:plugin_path .'")') call s:MundoPython('sys.path.insert(1, "'. s:plugin_path .'/mundo")') end endfunction"}}} "}}} "{{{ Mundo buffer settings function! s:MundoMakeMapping(mapping, action) exec 'nnoremap