feat(ui): config option to override buffer switching logic#288
feat(ui): config option to override buffer switching logic#288mrcjkb wants to merge 3 commits intodmtrKovalenko:mainfrom
Conversation
9f0437f to
2835f31
Compare
|
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 |
I removed that check because it seemed too strict to me (terminal buffers aren't modifiable, for instance). |
|
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? |
|
https://github.com/hedyhli/outline.nvim I use this one personally |
|
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? |
|
Yeah that’s what I’m saying you can make a function that overrides the existing one without changing the behavior |
2835f31 to
69f840c
Compare
|
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. |
80abd24 to
85b432a
Compare
d613c43 to
ce78633
Compare
| select = { | ||
| --- @param current_buf integer | ||
| --- @param action FffSelectAction | ||
| pre_select_hook = function(current_buf, action) |
There was a problem hiding this comment.
I don't know if this is actually a hook
There was a problem hiding this comment.
Shall we call it pre_select_callback or on_pre_select?
There was a problem hiding this comment.
I mean it's unclear that this hook should actually change the window, maybe we should just override the whole open_file callback that is doing all the window picking and :e call
this would be more flixble probably
There was a problem hiding this comment.
or the other option is to make this callback return the window_id and we then opening the file in this window
This is my suggestion to fix #287.