Something went wrong. Try again.
Vim/Neovim configurations just for me
neovim
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108local highlight = require("rc.highlight")local line = require("rc.line")local ui = require("rc.ui")
---@return stringlocal function overseer_info() local result = "" if not package.loaded.overseer then return result end
local tasks = require("overseer.task_list").list_tasks({ unique = true }) local tasks_by_status = require("overseer.util").tbl_group_by(tasks, "status")
for status, symbol in pairs(ui.status) do status = status:upper() local task = tasks_by_status[status] if task then result = result .. line.with_hl( symbol .. " " .. #task, highlight.ensure("TabLineOverseer" .. status, function() return highlight.get("Overseer" .. status):extend("TabLineFill") end) ) .. " " end end
return resultend
---@param buf integer---@return booleanlocal function is_modified(buf) return vim.api.nvim_get_option_value("modified", { buf = buf })end
---@param buffer integer---@param is_selected boolean---@return stringlocal function buffer_info(buffer, is_selected) local bufname = vim.api.nvim_buf_get_name(buffer) local hl_suffix = is_selected and "Sel" or "" local hl_group = "TabLine" .. hl_suffix local t = ""
local sep_hl = highlight.ensure("TabLineSep", function() return highlight.get("TabLineFill"):extend(highlight.get("Normal"):reverse():clear_bg()) end)
if is_selected then t = t .. line.with_hl("", sep_hl.name) end t = t .. line.with_hl((is_selected and " " or " "), hl_group) t = t .. line.with_hl(" " .. vim.fs.basename(bufname) .. " ", hl_group)
if is_modified(buffer) then t = t .. line.with_hl( "" .. (is_selected and "" or " "), highlight.ensure("TabLineModified" .. hl_suffix, function() return highlight.get("Function"):extend(hl_group) end) ) else t = t .. line.with_hl(" ", hl_group) end
t = t .. line.with_hl(is_selected and " " or "", hl_group) if is_selected then t = t .. line.with_hl("", sep_hl) end
return tend
---@param buffer integerlocal function filter_buffer(buffer) return vim.api.nvim_buf_is_loaded(buffer) and vim.api.nvim_get_option_value("buflisted", { buf = buffer }) and vim.api.nvim_buf_get_name(buffer) ~= ""end
---@return stringlocal function get_tabline() local current_buf = vim.api.nvim_get_current_buf() local tabline = vim.iter(vim.api.nvim_list_bufs()) :filter(filter_buffer) :map(function(buf) return buffer_info(buf, buf == current_buf) end) :join("")
tabline = tabline .. "%=" .. overseer_info() return tablineend
local M = {}
function M.setup() vim.o.showtabline = 2 vim.o.tabline = line.as_opt(get_tabline) vim.api.nvim_create_autocmd({ "BufAdd", "BufDelete" }, { command = "redrawtabline" })end
return M