nvim-metals
nvim-metals copied to clipboard
Allow to customize float window appearance e.g. of the doctor
Describe the feature
The doctor float window is created here:
https://github.com/scalameta/nvim-metals/blob/6065608a98a6add79886ad8ab6d2f2619cff8a09/lua/metals/doctor.lua#L164-L175
It has hardcoded parameters for creating the window and relies on plenary. I would be very happy if this could be more customizeable. I.e., I would want to do something like this to specify configuration:
require("metals").setup {
floats = {
window_options = {
width = 0.9,
height = 0.9,
title_pos = "left",
},
border = {
style = "double",
},
},
}
where window_options
and border
have are similar to the options for the builtin nvim_open_win
.
Perhaps it would make sense to rely on Popup from nui.nvim instead of plenary here? It provides something that is more in line with nvim_open_win
and that it may be easier to customize; possibly.
Potential ways to implement
I could possibly help with implementing this, but I would need some guidance and I think it should be done for more than just the doctor. That is, I would want to allow custom configuration for all the floating windows similar to the doctor using the same mechanism.
Thanks for opening this up @lervag. I can understand why someone may want a bit more control here.
Perhaps it would make sense to rely on Popup from nui.nvim instead of plenary here?
I don't think I really want to switch at this time. I use Plenary
for a couple other modules throughout nvim-metals
, like Path
, etc, so it's not as easy to swap it out, even if I wanted to. I also wouldn't want to require another dependency.
Let me think on this a bit and I'll see if I can come up with a direction I feel comfortable with that would allow something like this. It's also worth being said that I've purposefully kept configuration in nvim-metals
very minimal just to make maintenance easier, so I also want to be a bit careful here.
Perhaps it would make sense to rely on Popup from nui.nvim instead of plenary here?
I don't think I really want to switch at this time. I use
Plenary
for a couple other modules throughoutnvim-metals
, likePath
, etc, so it's not as easy to swap it out, even if I wanted to. I also wouldn't want to require another dependency.
Ok, that's fine and understandable.
Let me think on this a bit and I'll see if I can come up with a direction I feel comfortable with that would allow something like this.
Cool!
It's also worth being said that I've purposefully kept configuration in
nvim-metals
very minimal just to make maintenance easier, so I also want to be a bit careful here.
Yes, I like that idea personally. But on this specific topic, I think there is a reason to allow more flexibility. I've tried to make all my floating windows have a consistent style. I believe for everyone who wants to do that, we actually need a way to provide this configuration. Of course, we will use sensible defaults that many people will be fine with.