From ed36a0f716a7d63c24f3b0601e6097e2f23bfcdc Mon Sep 17 00:00:00 2001
From: Jerome Reybert <jreybert@gmail.com>
Date: Fri, 24 Feb 2017 21:46:58 +0100
Subject: [PATCH] Revert "plugin/magit.vim: simplify auto jump to magit window
 if any"

This reverts commit f5756b24ddf653c289373542024c8f0dc99e3d3d.

ref #119
it is not really related to location window, actually, it does not work
as excpected: window numbers are not consistent:
- winnr() == 1
- vsplit, jump to new window
- winnr() == 1
- last window, winnr() == 2
- close winnr()==1, remaing window winnr()==1
---
 plugin/magit.vim | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/plugin/magit.vim b/plugin/magit.vim
index df9bfa1..248c8c6 100644
--- a/plugin/magit.vim
+++ b/plugin/magit.vim
@@ -667,7 +667,6 @@ function! magit#toggle_help()
 	call magit#update_buffer()
 endfunction
 
-let g:magit_windows = {}
 " magit#show_magit: prepare and show magit buffer
 " it also set local mappings to magit buffer
 " param[in] display:
@@ -705,8 +704,7 @@ function! magit#show_magit(display, ...)
 
 	let buffer_name=fnameescape('magit://' . git_dir)
 
-	let magit_win = has_key(g:magit_windows, buffer_name) ?
-				\ g:magit_windows[buffer_name] : 0
+	let magit_win = magit#utils#search_buffer_in_windows(buffer_name)
 
 	if ( magit_win != 0 )
 		silent execute magit_win."wincmd w"
@@ -726,7 +724,6 @@ function! magit#show_magit(display, ...)
 	else
 		throw 'parameter_error'
 	endif
-	let g:magit_windows[buffer_name] = winnr()
 
 	silent execute "buffer " . buffer_name
 
-- 
GitLab