dotfiles/config/nvim/lua/lualine/components/fschauen/whitespace.lua

26 lines
629 B
Lua

local M = require("lualine.component"):extend()
function M:init(options)
M.super.init(
self,
vim.tbl_deep_extend("keep", options or {}, {
color = { bg = "#d65d0e" },
cond = function() return vim.bo.filetype ~= "help" end,
})
)
end
function M:update_status(--[[is_focused]]_)
local trailing = [[\s\+$]]
local lineno = vim.fn.search(trailing, "nwc")
if lineno == 0 then return "" end
local result = "" .. lineno
local total = vim.fn.searchcount({ pattern = trailing }).total
if total > 1 then result = result .. string.format(" (%d total)", total) end
return result
end
return M