From be00efa70362ff19f3a58877bc18843ce5dbfc2c Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Mon, 18 Mar 2013 18:51:54 +1300 Subject: [PATCH] Save and restore window position when expanding, closes #129 --- autoload/tagbar.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 2b7587e..580dfe9 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -54,9 +54,11 @@ let s:ctags_types = {} let s:new_window = 1 let s:is_maximized = 0 let s:short_help = 1 -let s:window_expanded = 0 let s:nearby_disabled = 0 +let s:window_expanded = 0 +let s:window_pos = { 'x' : 0, 'y' : 0 } + " Script-local variable needed since compare functions can't " take extra arguments let s:compare_typeinfo = {} @@ -1690,6 +1692,8 @@ function! s:OpenWindow(flags) abort " Expand the Vim window to accomodate for the Tagbar window if requested if g:tagbar_expand && !s:window_expanded && has('gui_running') + let s:window_pos.x = getwinposx() + let s:window_pos.y = getwinposy() let &columns += g:tagbar_width + 1 let s:window_expanded = 1 endif @@ -1831,6 +1835,7 @@ function! s:CloseWindow() abort if index(tablist, tagbarbufnr) == -1 let &columns -= g:tagbar_width + 1 let s:window_expanded = 0 + execute 'winpos ' . s:window_pos.x . ' ' . s:window_pos.y endif endif