-- The bars. LLeMbas IDE's own are the LLeMbas plugin's layout (lua/llembas/layout.lua): the top -- bar is the tabline, the bottom bar the statusline. What is here is what stands in when one of -- them is switched off: mini.statusline for the bottom, mini.tabline (the open buffers) for the top. local M = {} local set = { statusline = false, tabline = false } local function active() local s = require("mini.statusline") local mode, mode_hl = s.section_mode({ trunc_width = 100 }) local git = s.section_git({ trunc_width = 60 }) local diff = s.section_diff({ trunc_width = 80 }) local diagnostics = s.section_diagnostics({ trunc_width = 80 }) local lsp = s.section_lsp({ trunc_width = 100 }) local filename = s.section_filename({ trunc_width = 140 }) local fileinfo = s.section_fileinfo({ trunc_width = 120 }) local llembas, live = require("llembas_ide.llembas").status() if s.is_truncated(70) then llembas = "" end return s.combine_groups({ { hl = mode_hl, strings = { mode } }, { hl = "MiniStatuslineDevinfo", strings = { git, diff, diagnostics, lsp } }, "%<", { hl = "MiniStatuslineFilename", strings = { filename } }, "%=", { hl = live and "LLeMbasIdeStatus" or "LLeMbasIdeStatusOff", strings = { (llembas:gsub("%%", "%%%%")) } }, { hl = "MiniStatuslineFileinfo", strings = { fileinfo } }, { hl = mode_hl, strings = { "%l:%v" } }, }) end --- Set up the stand-in for each bar of the layout that is off. Called at the start and whenever --- the layout's bars change (`User LLeMbasBars`). function M.refresh() local ok, layout = pcall(require, "llembas.layout") local o = ok and layout.options() or { on = false } if not (o.on and o.bottom) and not set.statusline then set.statusline = true require("mini.statusline").setup({ use_icons = false, content = { active = active } }) end if not (o.on and o.top) and not set.tabline then set.tabline = true require("mini.tabline").setup({ show_icons = false }) end end M.active = active function M.setup() M.refresh() vim.api.nvim_create_autocmd("User", { group = vim.api.nvim_create_augroup("llembas_ide_bars", { clear = true }), pattern = "LLeMbasBars", callback = function() M.refresh() end, }) end return M