1. Steve Losh
  2. gundo.vim
  3. Issues
Issue #40 new

Feature request: Live reload

Patrick Oscity
created an issue

One can "live" reload Gundo with the following lines of VIM Script:

" automatically reload Gundo buffer if open
function! s:GundoRefresh()
  " abort when there were no changes
  if b:gundoChangedtick == b:changedtick | return | endif
  let b:gundoChangedtick = b:changedtick

  let gundoWin    = bufwinnr('__Gundo__')
  let gundoPreWin = bufwinnr('__Gundo_Preview__')
  let currentWin  = bufwinnr('%')

  " abort if Gundo is closed or is current window
  if (gundoWin == -1) || (gundoPreWin == -1) || (gundoWin == currentWin) || (gundoPreWin == currentWin)
    return
  endif

  :GundoRenderGraph

  " switch back to previous window
  execute currentWin . 'wincmd w'
endfunction

au CursorHold * call s:GundoRefresh()
au BufEnter * let b:gundoChangedtick = 0

However, a built-in live reload feature would probably not feel so hacky. I also couldn't get Gundo to update the tree when i switching buffers (and thus showing the undo tree of the new buffer/file). This would be great, too.

Comments (4)

  1. Dane Summers

    I've made several fixes for this plugin, including:

    I'm in the process of trying to get a pull request accepted...but its been about a week w/o any response from the author - if you want to try out the plugin with your change request you can do so on my branch.

  2. Log in to comment