-- The IDE's own commands. All begin with :LLeMbasIde. local M = {} local function launcher() local l = vim.env.LLEMBAS_IDE_LAUNCHER if l and l ~= "" and vim.fn.executable(l) == 1 then return l end if vim.fn.executable("llembas-ide") == 1 then return "llembas-ide" end return nil end function M.versions() local ide = require("llembas_ide") local v = vim.version() return { ("LLeMbas IDE %s"):format(ide.version), ("Neovim %d.%d.%d"):format(v.major, v.minor, v.patch), ("LLeMbas plugin %s"):format(require("llembas_ide.llembas").version() or "not installed"), } end function M.setup() local cmd = vim.api.nvim_create_user_command cmd("LLeMbasIdeKeys", function() require("llembas_ide.keys").show() end, { desc = "LLeMbas IDE: the keys" }) cmd("LLeMbasIdeHome", function() require("llembas_ide.dashboard").open() end, { desc = "LLeMbas IDE: the start screen" }) cmd("LLeMbasIdeLsp", function() require("llembas_ide.lsp").guide() end, { desc = "LLeMbas IDE: language servers, found and missing" }) cmd("LLeMbasIdeFormat", function() require("llembas_ide.plugins").format() end, { range = true, desc = "LLeMbas IDE: format the file or the selection" }) cmd("LLeMbasIdeTerminal", function() require("llembas_ide.terminal").toggle() end, { desc = "LLeMbas IDE: the terminal, open and close" }) cmd("LLeMbasIdeDiff", function() require("llembas_ide.git").diff_head() end, { desc = "LLeMbas IDE: this file beside its committed version" }) cmd("LLeMbasIdeSignIn", function() require("llembas_ide.llembas").sign_in() end, { desc = "LLeMbas IDE: sign in to LLeMbas" }) cmd("LLeMbasIdeVersion", function() vim.notify(table.concat(M.versions(), "\n")) end, { desc = "LLeMbas IDE: versions" }) cmd("LLeMbasIdeConfig", function() vim.cmd.edit(vim.fn.fnameescape(vim.fn.stdpath("config") .. "/lua/user/init.lua")) end, { desc = "LLeMbas IDE: open your own settings file" }) cmd("LLeMbasIdeProblems", function() local p = require("llembas_ide").problems local lines = #p == 0 and { "Every part of the IDE started." } or vim.list_extend({ "These parts did not start:", "" }, p) require("llembas_ide.ui").page("LLeMbas IDE: problems", lines) end, { desc = "LLeMbas IDE: what did not start" }) cmd("LLeMbasIdeDoctor", function() local l = launcher() if not l then return vim.notify("The llembas-ide command is not on PATH; run `llembas-ide doctor` from where it was installed (~/.local/bin).", vim.log.levels.WARN) end require("llembas_ide.terminal").run({ l, "doctor" }) end, { desc = "LLeMbas IDE: check the installation" }) end return M