AutoYADM commit: 2024-11-26 14:15:04

This commit is contained in:
Daniel Fichtinger 2024-11-26 14:15:04 -05:00
parent c32b1c1e45
commit fa680621b8
2 changed files with 30 additions and 11 deletions

View file

@ -0,0 +1 @@
return { "chrisgrieser/nvim-spider", lazy = true }

View file

@ -1,12 +1,3 @@
local function getWords()
local wc = vim.api.nvim_eval("wordcount()")
local w = "w:"
if wc["visual_words"] then
return w .. wc["visual_words"]
else
return w .. wc["words"]
end
end
local modes = { local modes = {
NORMAL = "NRM", NORMAL = "NRM",
INSERT = "INS", INSERT = "INS",
@ -23,6 +14,24 @@ local modes = {
REPLACE = "REP", REPLACE = "REP",
["V-REPLACE"] = "V-R", ["V-REPLACE"] = "V-R",
} }
local wordCountFiletypes = {
markdown = true,
txt = true,
tex = true,
}
local wcCache = ""
local function updateWordCount()
local ft = vim.bo.filetype
local wc = vim.api.nvim_eval("wordcount()")
local w = "w:"
if wc["visual_words"] then
wcCache = w .. wc["visual_words"]
else
wcCache = w .. wc["words"]
end
end
local sections = { local sections = {
lualine_a = { lualine_a = {
{ {
@ -32,10 +41,13 @@ local sections = {
end, end,
}, },
}, },
-- lualine_a = { "mode" },
lualine_b = { "branch", "diff" }, lualine_b = { "branch", "diff" },
lualine_c = { { "filename", path = 1 } }, lualine_c = { { "filename", path = 1 } },
lualine_x = { "diagnostics", { "filetype", colored = false }, { getWords } }, lualine_x = { "diagnostics", { "filetype", colored = false }, {
function()
return wcCache
end,
} },
lualine_y = { "progress" }, lualine_y = { "progress" },
lualine_z = { "location" }, lualine_z = { "location" },
} }
@ -48,6 +60,12 @@ return {
local noirbuddy_lualine = require("noirbuddy.plugins.lualine") local noirbuddy_lualine = require("noirbuddy.plugins.lualine")
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(
{ "TextChanged", "TextChangedI", "CursorHold" },
{ pattern = "*", callback = updateWordCount }
)
require("lualine").setup({ require("lualine").setup({
options = { options = {
theme = theme, theme = theme,