nvim-FeMaco.lua icon indicating copy to clipboard operation
nvim-FeMaco.lua copied to clipboard

Expand `float_opts` with user's options

Open gegoune opened this issue 3 years ago • 4 comments

Hi there,

at the moment in order to change border configuration user has to provide all of the other required keys in table returned from float_opts. It would be better user experience if returned table got merged with default one so only keys that user wants changing would have to be supplied. At the moment users might want to keep an eye on internal implementation and maintain its copy within their configurations.

Thanks for great plugin!

gegoune avatar Oct 15 '22 18:10 gegoune

@gegoune Yes, maybe a better approach is to support either a table of a function as the user's setting, and in the case of a table it gets merged with the default one. What do you think? Would you like to implement this?

AckslD avatar Oct 17 '22 08:10 AckslD

I am not a programmer and only know lua to the extends of nvim configuration, but perhaps with some guidance I could give it a go. :)

gegoune avatar Oct 17 '22 08:10 gegoune

If you want to you could try to move the current float_opts function into a module-level function such that it can be imported separately and change this line to do something like:

local extend_conf = function(name, opts)
  local config = require('femaco.config')
  return vim.tbl_extend(config[name](opts), config.settings[name](opts))
end

...prepare_buffer(extend_conf('float_opts', {range=range, ...}))

Just a suggestion and if you feel like trying out to implement it :)

AckslD avatar Oct 17 '22 08:10 AckslD

Thanks for the pointers, will have a go at it later today.

gegoune avatar Oct 17 '22 08:10 gegoune