# HG changeset patch # User Steve Losh # Date 1286629241 14400 # Node ID 82d190d1da64764163ae7b02b1ff2a2b963af9df # Parent ae5f399be2c21cce9524fa951af8797031921468 Syntax highlighting! diff -r ae5f399be2c2 -r 82d190d1da64 plugin/gundo.vim --- a/plugin/gundo.vim Fri Oct 08 22:10:04 2010 -0400 +++ b/plugin/gundo.vim Sat Oct 09 09:00:41 2010 -0400 @@ -16,7 +16,7 @@ "let loaded_gundo = 1 if !exists('g:gundo_width') - let g:gundo_width = 40 + let g:gundo_width = 45 endif function! s:GundoOpenBuffer() @@ -50,6 +50,8 @@ let back = bufwinnr(s:gundo_back) exe back . "wincmd w" exe "undo " . target_num + GundoRender + exe back . "wincmd w" endfunction function! s:GundoToggle() @@ -68,9 +70,23 @@ setlocal noswapfile setlocal buflisted setlocal nomodifiable + setlocal filetype=gundo + call s:GundoSyntax() endfunction +function! s:GundoSyntax() + let b:current_syntax = 'gundo' + syn match GundoCurrentLocation '@' + syn match GundoHelp '\v^".*$' + syn match GundoNumberField '\v\[[0-9]+\]' + syn match GundoNumber '\v[0-9]+' contained containedin=GundoNumberField + + hi def link GundoCurrentLocation Keyword + hi def link GundoHelp Comment + hi def link GundoNumberField Comment + hi def link GundoNumber Identifier +endfunction @@ -447,10 +463,16 @@ result = generate(walk_nodes(dag), asciiedges, current).splitlines() +INLINE_HELP = '''\ +" j/k - move between undo states +" - revert to that state + +'''.splitlines() + vim.command('GundoOpenBuffer') vim.command('setlocal modifiable') vim.command('normal ggdG') -vim.current.buffer.append(result) +vim.current.buffer.append(INLINE_HELP + result) vim.command('setlocal nomodifiable') i = 1 @@ -462,7 +484,7 @@ except ValueError: pass i += 1 -vim.command('%d' % i) +vim.command('%d' % (i+3)) ENDPYTHON endfunction