From 4d513c8a68bfeabaa8965323c6d8ab8f7eb446ce Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Sun, 16 Oct 2016 23:19:42 +1300 Subject: [PATCH] Also restore window history when opening Tagbar, ref #319 --- autoload/tagbar.vim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index f941bbc..6a2aa7d 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -1816,6 +1816,11 @@ function! s:OpenWindow(flags) abort return endif + let prevwinnr = winnr() + call s:goto_win('p', 1) + let pprevwinnr = winnr() + call s:goto_win('p', 1) + " This is only needed for the CorrectFocusOnStartup() function let s:last_autofocus = autofocus @@ -1860,7 +1865,8 @@ function! s:OpenWindow(flags) abort call s:HighlightTag(g:tagbar_autoshowtag != 2, 1, curline) if !(g:tagbar_autoclose || autofocus || g:tagbar_autofocus) - call s:goto_win('p') + call s:goto_win(pprevwinnr, 1) + call s:goto_win(prevwinnr) endif call s:debug('OpenWindow finished')