- The CLI is found where the plugin finds it (require("llembas").cli(): PATH, then
~/.local/bin); the installer and the launcher keep the same find_cli in shell, and
scripts/test-ide.sh fails when the two shell copies differ or disagree with the plugin. A CLI
in ~/.local/bin that is not on PATH (right after a first install) is no longer "not installed".
- The CLI's get.sh is taken from a CLI release (the newest of the channel, or
LLEMBAS_IDE_CLI_VERSION) and run only after that release's SHA256SUMS is verified with the
release key and get.sh matches it; LEMBAS_REF names that release.
- curl … | bash -s -- --help prints the help (it is a here-document now); it names ssh-keygen.
- The start screen says a sign-in is needed only when there is none.
- doctor and an update see files added to a plugin, not only changed ones; doctor accepts the
start as the installer does, says when plugins.lock is missing, checks ssh-keygen, and counts
"1 check failed" / "N checks failed".
- A release archive that holds a link is refused; newest_tag keeps redirects on https.
- The README key table says where a chord also works.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
72 lines
3.1 KiB
Lua
72 lines
3.1 KiB
Lua
-- LLeMbas IDE: a complete Neovim, with LLeMbas built in. Everything here works from what the
|
|
-- installer placed: nothing is fetched, installed or updated when the editor starts.
|
|
local M = {}
|
|
|
|
M.name = "LLeMbas IDE"
|
|
M.problems = {} -- what could not be set up, in words; the dashboard and :LLeMbasIdeDoctor show it
|
|
M.prefix = nil
|
|
M.version = "dev"
|
|
|
|
--- Run one part of the setup; a part that fails is named, and the editor still starts.
|
|
function M.try(what, fn)
|
|
local ok, err = xpcall(fn, debug.traceback)
|
|
if not ok then table.insert(M.problems, what .. ": " .. tostring(err):gsub("\n.*", "")) end
|
|
return ok
|
|
end
|
|
|
|
local function read_first_line(path)
|
|
local f = io.open(path, "r")
|
|
if not f then return nil end
|
|
local line = f:read("*l")
|
|
f:close()
|
|
return line and vim.trim(line) or nil
|
|
end
|
|
|
|
--- Whether a plugin the installer places is there: a module that `require` can find.
|
|
function M.has(module)
|
|
return #vim.api.nvim_get_runtime_file("lua/" .. module:gsub("%.", "/") .. ".lua", false) > 0
|
|
or #vim.api.nvim_get_runtime_file("lua/" .. module:gsub("%.", "/") .. "/init.lua", false) > 0
|
|
end
|
|
|
|
function M.start(opts)
|
|
if M.started then return end
|
|
M.started = true
|
|
M.prefix = opts and opts.prefix or vim.fn.stdpath("data")
|
|
local here = vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":p:h")
|
|
M.version = read_first_line(M.prefix .. "/lib/VERSION")
|
|
or read_first_line(vim.fn.fnamemodify(here, ":h:h:h:h") .. "/VERSION") -- a checkout
|
|
or "dev"
|
|
|
|
-- The LLeMbas plugin sits beside its VERSION file, as it does in its repository.
|
|
local plugin = M.prefix .. "/lib/llembas/nvim"
|
|
if vim.fn.isdirectory(plugin) == 0 then plugin = vim.fn.fnamemodify(here, ":h:h:h:h") .. "/nvim" end
|
|
if vim.fn.isdirectory(plugin) == 1 then vim.opt.runtimepath:prepend(plugin) end
|
|
|
|
M.try("options", function() require("llembas_ide.options").setup() end)
|
|
M.try("theme", function() vim.cmd.colorscheme("llembas") end)
|
|
M.try("plugins", function() require("llembas_ide.plugins").setup() end)
|
|
M.try("treesitter", function() require("llembas_ide.treesitter").setup() end)
|
|
M.try("completion", function() require("llembas_ide.completion").setup() end)
|
|
M.try("lsp", function() require("llembas_ide.lsp").setup() end)
|
|
M.try("llembas", function() require("llembas_ide.llembas").setup() end)
|
|
M.try("bars", function() require("llembas_ide.bars").setup() end)
|
|
M.try("sessions", function() require("llembas_ide.sessions").setup() end)
|
|
M.try("keys", function() require("llembas_ide.keys").setup() end)
|
|
M.try("commands", function() require("llembas_ide.commands").setup() end)
|
|
M.try("dashboard", function() require("llembas_ide.dashboard").setup() end)
|
|
|
|
-- The person's own file, last: it may change anything above.
|
|
local user = vim.fn.stdpath("config") .. "/lua/user/init.lua"
|
|
if vim.fn.filereadable(user) == 1 then
|
|
M.try("your lua/user/init.lua", function() dofile(user) end)
|
|
end
|
|
|
|
if #M.problems > 0 then
|
|
vim.schedule(function()
|
|
vim.notify("LLeMbas IDE: " .. (#M.problems == 1 and "1 part" or (#M.problems .. " parts")) .. " did not start. :LLeMbasIdeProblems lists them.", vim.log.levels.WARN)
|
|
end)
|
|
end
|
|
end
|
|
|
|
return M
|