Files
LLeMbas-IDE/ide/config/lua/llembas_ide/plugins.lua
T
HomerandClaude Opus 5.5 1459e6162f LLeMbas IDE: a directory opened like a file goes to the tree, not to the old explorer over the bars
mini.files was still Neovim's default explorer after the tree became the left bar, so
`llembas-ide .`, `llembas-ide src/` and `:e src/` opened its floating columns on top of the
four bars. A directory at the start is now the working directory (tree rooted there, start
screen shown); one opened later opens in the tree with the focus there. mini.files stays on
<Space>E and for directories outside the tree or with the bars off; netrw stays off.
The plugin's tree gains show_dir(path). Layout test: a directory start and :e dir.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 23:04:29 +00:00

109 lines
4.5 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- The third-party plugins, set up. Each is a package the installer placed at a pinned commit
-- (ide/plugins.lock); a missing one is named as a problem and the rest still work.
local M = {}
local function mini(name, opts)
local ide = require("llembas_ide")
ide.try("mini." .. name, function() require("mini." .. name).setup(opts or {}) end)
end
function M.setup()
-- Icons as plain letters: a terminal's font is not ours to assume. With a Nerd Font, put
-- require("mini.icons").setup({ style = "glyph" }) in lua/user/init.lua.
mini("icons", { style = "ascii" })
mini("files", {
content = { prefix = function() end }, -- no icon column
windows = { preview = true, width_preview = 60 },
-- Not the default explorer: a directory opened like a file goes to the tree (directories.lua);
-- mini.files is <Space>E, and what a directory outside the tree or without the bars opens in.
options = { use_as_default_explorer = false },
})
mini("pick", { window = { prompt_prefix = "› " } })
require("llembas_ide").try("mini.pick as vim.ui.select", function() vim.ui.select = require("mini.pick").ui_select end)
mini("extra")
mini("surround")
mini("pairs")
mini("bufremove")
mini("git")
mini("diff", {
view = { style = "sign", signs = { add = "▎", change = "▎", delete = "▁" } },
-- ]h and [h, ga and gr are the LLeMbas plugin's (its proposed changes): git hunks move on g.
mappings = {
apply = "", reset = "", textobject = "ih",
goto_first = "[G", goto_prev = "[g", goto_next = "]g", goto_last = "]G",
},
})
local keys = require("llembas_ide.keys")
local ok, clue = pcall(require, "mini.clue")
if ok then
local clues = {
clue.gen_clues.g(), clue.gen_clues.z(), clue.gen_clues.windows(),
clue.gen_clues.registers(), clue.gen_clues.marks(), clue.gen_clues.builtin_completion(),
}
for _, g in ipairs(keys.groups) do
table.insert(clues, { mode = "n", keys = g[1], desc = "+" .. g[2] })
table.insert(clues, { mode = "x", keys = g[1], desc = "+" .. g[2] })
end
mini("clue", {
triggers = {
{ mode = "n", keys = "<Leader>" }, { mode = "x", keys = "<Leader>" },
{ mode = "n", keys = "g" }, { mode = "x", keys = "g" },
{ mode = "n", keys = "z" }, { mode = "x", keys = "z" },
{ mode = "n", keys = "<C-w>" },
{ mode = "n", keys = '"' }, { mode = "x", keys = '"' },
{ mode = "n", keys = "'" }, { mode = "n", keys = "`" },
{ mode = "n", keys = "[" }, { mode = "n", keys = "]" },
{ mode = "i", keys = "<C-x>" },
},
clues = clues,
window = { delay = 300, config = { width = "auto", border = "rounded" } },
})
else
table.insert(require("llembas_ide").problems, "mini.clue: not installed")
end
require("llembas_ide").try("conform", function()
-- Formatting happens when asked for (<leader>cf, :LLeMbasIdeFormat), never on save.
-- A formatter listed here is used when it is installed; otherwise the language server formats.
require("conform").setup({
formatters_by_ft = {
lua = { "stylua" },
python = { "ruff_format", "black", stop_after_first = true },
javascript = { "prettierd", "prettier", stop_after_first = true },
typescript = { "prettierd", "prettier", stop_after_first = true },
javascriptreact = { "prettierd", "prettier", stop_after_first = true },
typescriptreact = { "prettierd", "prettier", stop_after_first = true },
json = { "prettierd", "prettier", stop_after_first = true },
yaml = { "prettierd", "prettier", stop_after_first = true },
markdown = { "prettierd", "prettier", stop_after_first = true },
html = { "prettierd", "prettier", stop_after_first = true },
css = { "prettierd", "prettier", stop_after_first = true },
sh = { "shfmt" },
bash = { "shfmt" },
go = { "gofmt" },
rust = { "rustfmt" },
c = { "clang-format" },
cpp = { "clang-format" },
},
default_format_opts = { lsp_format = "fallback" },
notify_no_formatters = true,
})
end)
end
--- Format the buffer, or the selected lines.
function M.format()
local ok, conform = pcall(require, "conform")
if ok then
conform.format({ async = true, lsp_format = "fallback" }, function(err, did)
if err then vim.notify("Format: " .. tostring(err), vim.log.levels.WARN)
elseif did == false then vim.notify("Format: nothing to change") end
end)
else
vim.lsp.buf.format({ async = true })
end
end
return M