I have a tab with the following window structure within:
________________________________
a |
|
x |
________________________________|
b |
|
|
________________________________|
x
is the cursor position.
:ls
lists two buffers open on this tab: Main.cpp
and maininclude.h
Main.cpp
is visible on a
, and maininclude.h
is visible on b
. From a
, if I issue command :find maininclude.h
, this buffer is (re)opened in a
, even though it is currently activie/visible in b
. That is, I end up having two views in two different windows of the same file that I would like to avoid.
Is there a way to favor/privilege the window in which a current buffer is active/visible so that a :find
for that file/buffer issued from any window in the tab automatically goes to that window and places the cursor there? If that buffer is not active/visible in any window, then indeed that buffer should be made active in the window from which :find
was issued from.
An animated gif example of what I am facing is provided here, reproduced below:
Edit1: set switchbuf=useopen
does not work.
See image gif here, reproduced below:
set switchbuf=useopen
switchbuf
does not workfind
does not respect it or your config somehow disables it. I can't try rn. You should give a shot atsb
or other commands.:sb filename
works withswitchbuf=useopen
as you mentioned -- moving to a previously existing window itself.switchbuf
are listed in the help for the option. OTOH, If that is an acceptable answer to your question Tryer, please add an answer (or ask Biggybi too).