I have created a minimal Neovim configuration (Test) that only includes the plugin and the lazy.nvim setup.
The local neovim plugin Test loads with lazy.nvim using Lazy-load on command: cmd = "Test".
After loading the command with :Test, i get Command Test not found after loading test.
This is the module:
local M = {}
function M.test()
local variable = vim.ui.input({ prompt = "Enter value: " }, function(str)
return str
end)
print(variable)
end
return M
This is the Lazy configuration:
local map_test = {
["<leader>T"] = {
mode = { "n" },
name = "Test",
["t"] = {
function()
require("test").test()
end,
"Test",
},
},
}
return {
name = "test",
cmd = "Test",
dir = "~/.config/nvim/lua/plugins-my/test.nvim",
config = function()
local wk = require("which-key")
wk.register(map_test)
end,
}
Added the structure of the lua directory as suggested by KamilCuk:
├── config
├── plugins-active
├── plugins-inactive
├── plugins-my
│ ├── motli.nvim
│ │ ├── lua
│ │ │ └── motli
│ │ └── plugin
│ ├── presenta.nvim
│ │ ├── lua
│ │ │ └── presenta
│ │ └── plugin
│ └── test.nvim
│ ├── lua
│ └── plugin
└── util
While the plugin is loaded and working, I wonder how to get around the message.
Thanks!
with :Testwhere do you register :Test command? Where is the call tovim.api.nvim_create_user_command? Tehre isrequire("test"), but your dir is set to lua/plugins-my/test.nvim. So the path would berequire("plugins-my.test.nvim.test"), but it is impossible to load a file with a dot, so rename it? What is the directory structure?This is the module:isrequire("test")working? Is your "Test" module loaded in:Lazy?vim.api.nvim_create_user_command. I thought it was not needed, as the speccmd = "Test"should Lazy-load the plugin (as it does). I will try your suggestion and include the directory structure to make the question clearer. Thanks very much for the suggestions!should Lazy-load the pluginyes, it lazy loads the plugin and.. the command is still not found. You have to tell nvim the command.