Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: smart open should prefer alternative window #83

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

Bekaboo
Copy link
Contributor

@Bekaboo Bekaboo commented Nov 28, 2023

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.

Copy link
Owner

@willothy willothy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, thanks! I've been wanting to update the smart open feature :)

@willothy willothy merged commit 8a88333 into willothy:main Nov 28, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants