25 lines
655 B
Lua
25 lines
655 B
Lua
local M = require("lualine.component"):extend()
|
|
|
|
function M:init(options)
|
|
M.super.init(
|
|
self,
|
|
vim.tbl_deep_extend("keep", options or {}, {
|
|
color = { fg = "#d65d0e" },
|
|
cond = function() return vim.bo.filetype ~= "help" end,
|
|
})
|
|
)
|
|
end
|
|
|
|
local TRAILING_WS_PATTERN = [[\s\+$]]
|
|
|
|
local total = function()
|
|
local count = vim.fn.searchcount({ pattern = TRAILING_WS_PATTERN }).total
|
|
return count > 1 and string.format("·%d", count) or ""
|
|
end
|
|
|
|
function M:update_status(--[[is_focused]]_)
|
|
local lineno = vim.fn.search(TRAILING_WS_PATTERN, "nwc")
|
|
return lineno > 0 and string.format(" %d%s", lineno, total()) or ""
|
|
end
|
|
|
|
return M
|