Closed KevinNitroG closed 2 months ago
There is no need to use vim.fn.executable
in the config, as actions-preview will check for the existence of the command when it executes the command. That is, you can simply set the following in the configuration.
highlight_command = {
require(“actions-preview.highlight”).delta(),
},
Thank you <3 I didn't notice that ☺️. But it's great to support lazy loading...
I believe that is the responsibility of the plugin manager. I don't use lazy.nvim, so I'm not sure, but doesn't it have a mechanism for evaluating config during lazy loading?
@aznhe21 I guess it's possible to pass the opt directly in the setup like this. But it doesn't follow the convention of LazyNvim
{
"aznhe21/actions-preview.nvim",
keys = {
{
"<leader>la",
function()
require("actions-preview").code_actions()
end,
mode = { "v", "n" },
desc = "Action Preview | Open",
silent = true,
},
},
config = function()
require("actions-preview").setup {
highlight_command = {
require("actions-preview.highlight").delta(),
},
}
end,
}
I'm not sure what 'the convention of LazyNvim' refers to, but according to the LazyVim reference, there is a method for specifying a function
in opts
. You can use this.
This isn't a place for LazyVim questions, so I won't provide further support. Please continue in the appropriate forum from here.
Because the plugin is lazy loaded, it hasn't loaded while declaring
opts.highlight_command
. Here's my current config which make my nvim got error.I suggest just making
opts.highlight_command
receive a string (name of diff) and checking it behind the scenes.