Currently smart open will pick the FIRST window that is "valid" (a window that is not floating and contains a normal buffer, etc.), which can be unintuitive sometimes.
Suppose I have the following window layout and my cursor is at window B, and in C runs ranger in a terminal:
+-------------------+
| A | B |
| | |
|-------------------|
| C (terminal) |
| |
+-------------------+
If I switch from B to C using <C-w>j, then open a file from ranger, the current implementation of smart open will open the file in A, but I expect it to be opened in B.
This PR fixes this issue by picking the alternative window (B) if it is valid.
Currently smart open will pick the FIRST window that is "valid" (a window that is not floating and contains a normal buffer, etc.), which can be unintuitive sometimes.
Suppose I have the following window layout and my cursor is at window
B
, and inC
runs ranger in a terminal:If I switch from
B
toC
using<C-w>j
, then open a file from ranger, the current implementation of smart open will open the file inA
, but I expect it to be opened inB
.This PR fixes this issue by picking the alternative window (
B
) if it is valid.