Hallo,
ich versuche gerade neovim mit lua aufzusetzen.
Habe hier aber ein Problem beim Laden von einem Projekt.
Meine Projektstruktur:
1 | nvim
|
2 | - init.lua
|
3 | lua
|
4 | project.lua
|
5 | projects
|
6 | - init.lua
|
7 | - Lightstripe.lua
|
in project.lua habe ich die Funktion
1 | vim.api.nvim_create_user_command("Project", function(opts)
|
2 | local projects = require("projects")
|
3 | local sub = opts.fargs[1]
|
4 |
|
5 | -- ----------------------------------------------------------
|
6 | -- :Project open <name>
|
7 | -- ----------------------------------------------------------
|
8 | if sub == "open" then
|
9 | local name = opts.fargs[2]
|
10 | if not name then
|
11 | vim.notify("Usage: :Project open <name>", vim.log.levels.ERROR)
|
12 | return
|
13 | end
|
14 | projects.load(name)
|
15 | ... ...
|
16 | ... ...
|
in der init.lua in nvim/lua/projects habe ich die Funktion
1 | -- ------------------------------------------------------------
|
2 | -- Projekt laden
|
3 | -- ------------------------------------------------------------
|
4 | function M.load(name)
|
5 | local ok, project = pcall(require, "projects." .. name)
|
6 | if not ok then
|
7 | vim.notify("Projekt nicht gefunden: " .. name, vim.log.levels.ERROR)
|
8 | return
|
9 | end
|
Wenn ich jetzt im neovim das Commando
1 | :Project open Lightstripe
|
aufrufe, bekomme ich das Ergebnis
1 | Projekt nicht gefunden: Lightstripe
|
Diese Ausgabe kommt aus der init.lua in nvim/lua/projects.
Die Lightstripe.lua liegt aber direkt neben der init.lua .
Warum wird Lightstripe.lua nicht mehr gefunden?