overseer.nvim component to mini.statusline #1200
-
Hi all, https://github.com/stevearc/overseer.nvim/blob/master/doc/third_party.md#lualine |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 9 replies
-
Taking its lualine component as a reference, here is how I'd approach this:
Does this answer your question? |
Beta Was this translation helpful? Give feedback.
-
Thank you @echasnovski, my current solution with your help is,
-- overseer.lua config with lazy.nvim
return {
"stevearc/overseer.nvim",
cmd = { "Build", "OverseerClose", "OverseerOpen", "OverseerRun", "OverseerToggle" },
opts = {
templates = { "builtin" },
task_list = {
default_detail = 2,
direction = "bottom",
max_width = { 600, 0.7 },
},
},
config = function(_, opts)
local overseer = require("overseer")
overseer.setup(opts)
-- mini.statusline config
local constants = require("overseer.constants")
local task_list = require("overseer.task_list")
local util = require("overseer.util")
local STATUS = constants.STATUS
local symbols = {
[STATUS.FAILURE] = " ",
[STATUS.CANCELED] = " ",
[STATUS.SUCCESS] = " ",
[STATUS.RUNNING] = " ",
}
local overseer_status = function()
local tasks = task_list.list_tasks()
local tasks_by_status = util.tbl_group_by(tasks, "status")
local pieces = { " " }
for _, status in ipairs(STATUS.values) do
local status_tasks = tasks_by_status[status]
if symbols[status] and status_tasks then
table.insert(pieces, symbols[status] .. #status_tasks)
end
end
return table.concat(pieces, " ")
end
--stylua: ignore
local active_content = function()
local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 })
local git = MiniStatusline.section_git({ trunc_width = 40 })
local diff = MiniStatusline.section_diff({ trunc_width = 75 })
local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 75 })
local lsp = MiniStatusline.section_lsp({ trunc_width = 75 })
local filename = MiniStatusline.section_filename({ trunc_width = 140 })
local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120 })
local location = MiniStatusline.section_location({ trunc_width = 75 })
local search = MiniStatusline.section_searchcount({ trunc_width = 75 })
local overseer = overseer_status()
return MiniStatusline.combine_groups({
{ hl = mode_hl, strings = { mode } },
{ hl = 'MiniStatuslineDevinfo', strings = { git, diff, diagnostics, lsp, overseer } },
'%<', -- Mark general truncate point
{ hl = 'MiniStatuslineFilename', strings = { filename } },
'%=', -- End left alignment
{ hl = 'MiniStatuslineFileinfo', strings = { fileinfo } },
{ hl = mode_hl, strings = { search, location } },
})
end
MiniStatusline.config.content.active = active_content
end,
}
|
Beta Was this translation helpful? Give feedback.
-
After using this for a while found out that there is one issue. There needs to be some type of continuous evaluation for task else if status set to running always stay as Something that lualine component has on overseer source code. |
Beta Was this translation helpful? Give feedback.
Taking its lualine component as a reference, here is how I'd approach this: