Skip to content

Commit

Permalink
Merge pull request jeetsukumaran#79 from ayevee/master
Browse files Browse the repository at this point in the history
Fix stealing previous window in autoupdate mode
  • Loading branch information
jeetsukumaran authored Feb 5, 2017
2 parents 1104421 + 2d08fd8 commit 04dfbc0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions autoload/buffergator.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,7 @@ function! s:NewBufferCatalogViewer()
""""" Selection: show target and switch focus
noremap <buffer> <silent> <CR> :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "")<CR>
noremap <buffer> <silent> o :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "")<CR>
noremap <buffer> <silent> <LeftMouse> :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "")<CR>
noremap <buffer> <silent> s :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "vert sb")<CR>
noremap <buffer> <silent> <C-v> :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "vert sb")<CR>
noremap <buffer> <silent> i :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "sb")<CR>
Expand Down Expand Up @@ -1867,6 +1868,8 @@ function! buffergator#UpdateBuffergator(event, affected)
endif
let l:calling = bufnr("%")
let l:self_call = 0
let l:curr_winnr = winnr()
let l:prev_winnr = winnr("#")
let l:buffergators = s:_find_buffers_with_var("is_buffergator_buffer",1)
call s:_catalog_viewer.update_buffers_info()

Expand Down Expand Up @@ -1899,12 +1902,14 @@ function! buffergator#UpdateBuffergator(event, affected)
endfor
if exists("b:is_buffergator_buffer") && !l:self_call
try
execute "wincmd p"
execute l:prev_winnr . "wincmd w"
execute l:curr_winnr . "wincmd w"
catch //
endtry
elseif a:event == 'delete' && !l:self_call
try
execute "wincmd ^"
execute l:prev_winnr . "wincmd w"
execute l:curr_winnr . "wincmd w"
catch //
endtry
endif
Expand Down

0 comments on commit 04dfbc0

Please sign in to comment.