You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Option to set window.open for each individual file being opened, not once globally #111
Is your feature request related to a problem? Please describe.
When using the terminal to open files normally, I like having them open in the alternate window, but for git commit, I would like to be able to do something like:
[openfloatingwindow]
vim.cmd.term("git commit")
Such that the editor opens in that floating window.
Describe the solution you'd like
Perhaps a global variable to make it possible to do something like GIT_EDITOR="nvim --cmd 'let g:flatten_window_open=\"current\"'"
Another option could be to let the pre_open hook return a new configuration (or subset of the configuration) which would be applied to just the current window being opened. This is a bit more complicated to work with, but it would solve this question for other config options too, not just window.open.
Describe alternatives you've considered
My current solution seems to work, but it's pretty ugly
Yeah, I would definitely like to support this - I've had the need for it as well. I'm pretty busy with work right now but I'll try to get to this soon :)
I would personally be in favour of the second solution where pre_open returns the new config to be merged, but it technically could be a breaking change.
I'd love a PR! In this solution would pre_open return the config for each window? I might be misunderstanding. I think it should still be possible to set a global default, but having the ability to define custom handlers / determine what to do for individual files would be great too :)
PR opened. The config returned by pre_open is merged with the global one only for the current file, so users can use guest_data to determine if/how config needs to be updated. returning nil just keeps the old config, so old behaviour is not changed.
Activity
willothy commentedon May 30, 2025
Yeah, I would definitely like to support this - I've had the need for it as well. I'm pretty busy with work right now but I'll try to get to this soon :)
dk949 commentedon May 30, 2025
I've got a weekend spare if you accept PRs
I would personally be in favour of the second solution where
pre_openreturns the new config to be merged, but it technically could be a breaking change.willothy commentedon May 31, 2025
I'd love a PR! In this solution would pre_open return the config for each window? I might be misunderstanding. I think it should still be possible to set a global default, but having the ability to define custom handlers / determine what to do for individual files would be great too :)
dk949 commentedon Jun 1, 2025
PR opened. The config returned by
pre_openis merged with the global one only for the current file, so users can useguest_datato determine if/how config needs to be updated. returningniljust keeps the old config, so old behaviour is not changed.