mfussenegger / nvim-fzy

Fuzzy picker & vim.ui.select implementation via fzy for neovim
GNU General Public License v3.0
55 stars 4 forks source link

Easier customization of floating window #40

Open danrot opened 1 year ago

danrot commented 1 year ago

Hey, I am wondering if it would be possible to provide some options that allow to customize the floating window. I would like to remove the border, which would require me to change the value of this line:

https://github.com/mfussenegger/nvim-fzy/blob/a7a746f0e46f6e191c3ade52fd77d72a4239fe72/lua/fzy.lua#L68

However, this simple change requires me to override a function with 17 lines, which means I would need to copy over 16 lines which would already be included in this plugin. Wouldn't it be better to provide some options instead using a setup function?

mfussenegger commented 1 year ago

It would make customizing the border (or style) more convenient, but I don't think it's justified because if you want to customize any of the other options you very quickly end up wanting a function to compute row/col/width/height dynamically. So it would end up adding a second way to customize it.

Some time ago there was some discussion around having a border or vim.ui.border setting in neovim itself, and encourage plugins to use that to have a more consistent ui, but nobody pushed that forward. Maybe worth bringing that up again. I'd certainly use that as default value if it existed.

danrot commented 1 year ago

But does a single setting cut this? It's not like I want no borders at all, just not in some places... E.g. I definitely want the borders in nvim-dap-ui, but not in this plugin.

saccarosium commented 11 months ago

I think would be a good idea exposing a easier mechanism to modify very subjective settings, such as window border. A common pattern I see frequently when dealing with floating windows is something along the lines:

require('plugin').setup({
  height = 0.8, -- 0.0 to 1.0
  width = 0.8, -- 0.0 to 1.0
  x = 0.5,
  y = 0.5,
  border = "None"
})

IMHO This is a good middle ground between exposing every option and rewriting the function.