Added a get_config() method which returns a table of config options. The configuration can either be defined:
Like a "normal" neovim configuration, e.g. using the opts in lazy.nvim
Through custom .img-clip.lua files, which mimicks the opts field in lazy.nvim
The get_config method will search for the nearest .img-clip.lua, execute it, and if valid, use it as the configuration. Otherwise, it defaults back to the normal neovim configuration. This behaviour is cached in the M.configs table (key is current dir of file) to reduce overhead. Tests have been adjusted such that they are not affected by .img-clip.lua files. They always use M.opts.
Also added the ability to pass nested options through the API.
Related issue
Closes #31.
Summary of changes
Added a
get_config()
method which returns a table of config options. The configuration can either be defined:opts
in lazy.nvim.img-clip.lua
files, which mimicks theopts
field in lazy.nvimThe
get_config
method will search for the nearest.img-clip.lua
, execute it, and if valid, use it as the configuration. Otherwise, it defaults back to the normal neovim configuration. This behaviour is cached in theM.configs
table (key is current dir of file) to reduce overhead. Tests have been adjusted such that they are not affected by.img-clip.lua
files. They always useM.opts
.Also added the ability to pass nested options through the API.