feat(lualine): add counters to lualine

- Word, character and line counters upon selection
- From https://www.reddit.com/r/neovim/comments/1130kh5/comment/j8navg6/
This commit is contained in:
Fabrice Mouhartem 2025-05-06 13:57:26 +02:00
parent 031e7694a5
commit e934e38bd0
Signed by: fmouhart
GPG Key ID: 2C5033B228CFE4E7

View File

@ -179,6 +179,23 @@ require('lazy').setup({
path = 1,
}
},
lualine_y = {
{
-- Character, word and line counts
-- https://www.reddit.com/r/neovim/comments/1130kh5/comment/j8navg6/
function()
local isVisualMode = vim.fn.mode():find("[Vv]")
if not isVisualMode then return "" end
local starts = vim.fn.line("v")
local ends = vim.fn.line(".")
local lines = starts <= ends and ends - starts + 1 or starts - ends + 1
local wordcount = vim.fn.wordcount()
return tostring(wordcount.visual_words) ..
"W " .. tostring(wordcount.visual_chars) .. "C " .. tostring(lines) .. "L"
end
},
'progress'
}
},
inactive_sections = {
lualine_c = {