AutoYADM commit: 2024-11-26 15:00:03

This commit is contained in:
Daniel Fichtinger 2024-11-26 15:00:03 -05:00
parent b9afe82aa4
commit 2e5906ae7b

View file

@ -22,15 +22,17 @@ local word_count_filetypes = {
} }
local wc_cache = "" local wc_cache = ""
local function _update_word_count()
return tostring(vim.fn.wordcount().words)
end
local function update_word_count() local function update_word_count()
local ft = vim.bo.filetype local ft = vim.bo.filetype
local wc = vim.api.nvim_eval("wordcount()") local wc = vim.api.nvim_eval("wordcount()")
local w = "w:"
if word_count_filetypes[ft] then if word_count_filetypes[ft] then
if wc["visual_words"] then if wc["visual_words"] then
wc_cache = w .. wc["visual_words"] wc_cache = "vw:" .. wc["visual_words"]
else else
wc_cache = w .. wc["words"] wc_cache = "w:" .. wc["words"]
end end
else else
wc_cache = "" wc_cache = ""
@ -47,11 +49,16 @@ local sections = {
}, },
lualine_b = { "branch", "diff" }, lualine_b = { "branch", "diff" },
lualine_c = { { "filename", path = 1 } }, lualine_c = { { "filename", path = 1 } },
lualine_x = { "diagnostics", { "filetype", colored = false }, { lualine_x = {
"diagnostics",
{ "filetype", colored = false },
{
function() function()
update_word_count()
return wc_cache return wc_cache
end, end,
} }, },
},
lualine_y = { "progress" }, lualine_y = { "progress" },
lualine_z = { "location" }, lualine_z = { "location" },
} }
@ -65,10 +72,10 @@ return {
local theme = noirbuddy_lualine.theme local theme = noirbuddy_lualine.theme
local nb_inactive_sections = noirbuddy_lualine.inactive_sections local nb_inactive_sections = noirbuddy_lualine.inactive_sections
vim.api.nvim_create_autocmd( -- vim.api.nvim_create_autocmd(
{ "TextChanged", "TextChangedI", "CursorHold" }, -- { "TextChanged", "TextChangedI", "CursorHold" },
{ pattern = "*", callback = update_word_count } -- { pattern = "*", callback = update_word_count }
) -- )
require("lualine").setup({ require("lualine").setup({
options = { options = {