Skip to content

feat(ui): config option to override buffer switching logic#288

Open
mrcjkb wants to merge 2 commits intodmtrKovalenko:mainfrom
mrcjkb:mj/push-uyrxpruvtnsz
Open

feat(ui): config option to override buffer switching logic#288
mrcjkb wants to merge 2 commits intodmtrKovalenko:mainfrom
mrcjkb:mj/push-uyrxpruvtnsz

Conversation

@mrcjkb
Copy link
Copy Markdown
Contributor

@mrcjkb mrcjkb commented Mar 16, 2026

This is my suggestion to fix #287.

@mrcjkb mrcjkb force-pushed the mj/push-uyrxpruvtnsz branch from 9f0437f to 2835f31 Compare March 16, 2026 13:19
@dmtrKovalenko
Copy link
Copy Markdown
Owner

I'd probably have a suggestion to have a function override here we might want to extend the logic with more heuristics there for example if the buffer is modifiable or not

@mrcjkb
Copy link
Copy Markdown
Contributor Author

mrcjkb commented Mar 16, 2026

for example if the buffer is modifiable or not

I removed that check because it seemed too strict to me (terminal buffers aren't modifiable, for instance).

@dmtrKovalenko
Copy link
Copy Markdown
Owner

Please do not remove any checks. There are a plenty of buffers of special file types that we should never replace

this is simply the worst experience when your file opens in the sidebar which is always happens to snacks nvim for example

@mrcjkb
Copy link
Copy Markdown
Contributor Author

mrcjkb commented Mar 16, 2026

Please do not remove any checks. There are a plenty of buffers of special file types that we should never replace

this is simply the worst experience when your file opens in the sidebar which is always happens to snacks nvim for example

Do you have an example?
I don't think I use any plugins that create a "sidebar", which would explain why I haven't experienced any issues without the modifiable check.

@dmtrKovalenko
Copy link
Copy Markdown
Owner

https://github.com/hedyhli/outline.nvim I use this one personally

@mrcjkb
Copy link
Copy Markdown
Contributor Author

mrcjkb commented Mar 17, 2026

Hmm, how about keeping the behaviour as is and adding a config option to disable it altogether? Or a config option to override the behaviour with a function?
I don't use sidebar or file tree plugins, so for me, having my selection replace a seemingly arbitrary buffer isn't great.

@dmtrKovalenko
Copy link
Copy Markdown
Owner

Yeah that’s what I’m saying you can make a function that overrides the existing one without changing the behavior

@mrcjkb mrcjkb force-pushed the mj/push-uyrxpruvtnsz branch from 2835f31 to 69f840c Compare March 17, 2026 17:25
@mrcjkb
Copy link
Copy Markdown
Contributor Author

mrcjkb commented Mar 17, 2026

Done. I moved the logic for finding a suitable window to the config module. That might not be the best place - perhaps you'd want a hooks module or something.

@mrcjkb mrcjkb changed the title feat(ui): more intuitive buffer switching logic feat(ui): config option to override buffer switching logic Mar 17, 2026
@mrcjkb mrcjkb force-pushed the mj/push-uyrxpruvtnsz branch from 80abd24 to 85b432a Compare March 20, 2026 15:56
@mrcjkb mrcjkb force-pushed the mj/push-uyrxpruvtnsz branch from d613c43 to ce78633 Compare March 26, 2026 08:54
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.

[Discussion] unintuitive find_suitable_window logic for edit actions

2 participants