Closed mkdior closed 2 years ago
This seems to be an effect of using :drop
. If you remove Vifm from the test and after switching to the second tab do :split a.txt
and :drop a.txt
, same thing happens. This makes me think that it's a bug in Vim, focus shoudn't be switched to a different window if current one contains the same buffer.
:drop
is used to switch to first file if you open several files at once, so it can be skipped in this use case, but Vim's behaviour still looks wrong.
Thanks for moving this issue and thanks for the reply. I see, I guess it can't be helped without a fix from vim, correct? In that case, think it'd be good for this issue to be close, agree?
I changed code to not call :drop
for a single file (should be most of use cases), but the issue is still there if you open several files and the first one is already available in some other window. In this case Vim has to choose some window and it can be a wrong one, it can't really know which one is right so some more code changes might be needed here (remembering/iterating over windows).
To reproduce this:
mkdir test && cd test
touch a.txt b.txt
echo 'aaaaa' > a.txt && echo 'bbbbb' > b.txt
vim -p a.txt b.txt
Now if you switch your tab to
b.txt
and run:VsplitVifm
and opena.txt
- Vifm switches focus to the initiala.txt
file instead of havingb.txt
in focus witha.txt
in split.Is this intended behaviour? When I work on projects I generally have a ton of tabs open, knowing whether or not I have a tab I want to open already open isn't something I can always track, thus if Vifm switches focus it kinda confuses me.
Thanks and much love