AutoYADM commit: 2024-12-11 03:30:01

This commit is contained in:
Daniel Fichtinger 2024-12-11 03:30:01 -05:00
parent 94a13a0c64
commit 860e54ebd7

View file

@ -1,120 +1,93 @@
local modes = { -- local modes = {
NORMAL = "NRM", -- NORMAL = "NRM",
INSERT = "INS", -- INSERT = "INS",
VISUAL = "VIS", -- VISUAL = "VIS",
["V-LINE"] = "V-L", -- ["V-LINE"] = "V-L",
["V-BLOCK"] = "V-B", -- ["V-BLOCK"] = "V-B",
SELECT = "SEL", -- SELECT = "SEL",
["S-LINE"] = "S-L", -- ["S-LINE"] = "S-L",
["S-BLOCK"] = "S-B", -- ["S-BLOCK"] = "S-B",
COMMAND = "CMD", -- COMMAND = "CMD",
TERMINAL = "TRM", -- TERMINAL = "TRM",
["O-PENDING"] = "O-P", -- ["O-PENDING"] = "O-P",
EX = "EX", -- EX = "EX",
REPLACE = "REP", -- REPLACE = "REP",
["V-REPLACE"] = "V-R", -- ["V-REPLACE"] = "V-R",
} -- }
--
local word_count_filetypes = { -- local word_count_filetypes = {
markdown = true, -- markdown = true,
txt = true, -- txt = true,
tex = true, -- tex = true,
} -- }
--
local wc_cache = "" -- local wc_cache = ""
local function _update_word_count() -- local function _update_word_count()
return tostring(vim.fn.wordcount().words) -- return tostring(vim.fn.wordcount().words)
end -- 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()")
if word_count_filetypes[ft] then -- if word_count_filetypes[ft] then
if wc["visual_words"] then -- if wc["visual_words"] then
wc_cache = "vw:" .. 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 = ""
end -- end
end -- end
local sections = { -- local sections = {
lualine_a = { -- lualine_a = {
{ -- {
"mode", -- "mode",
fmt = function(str) -- fmt = function(str)
return modes[str] or str -- return modes[str] or str
end, -- end,
}, -- },
{ -- {
require("noice").api.status.mode.get, -- require("noice").api.status.mode.get,
cond = require("noice").api.status.mode.has, -- cond = require("noice").api.status.mode.has,
}, -- },
function() -- function()
local ok, pomo = pcall(require, "pomo") -- local ok, pomo = pcall(require, "pomo")
if not ok then -- if not ok then
return "" -- return ""
end -- end
--
local timer = pomo.get_first_to_finish() -- local timer = pomo.get_first_to_finish()
if timer == nil then -- if timer == nil then
return "" -- return ""
end -- end
--
return "󰄉 " .. tostring(timer) -- return "󰄉 " .. tostring(timer)
end, -- end,
}, -- },
lualine_b = { "branch", "diff" }, -- lualine_b = { "branch", "diff" },
lualine_c = { { "filename", path = 1 } }, -- lualine_c = { { "filename", path = 1 } },
lualine_x = { -- lualine_x = {
"diagnostics", -- "diagnostics",
{ "filetype", colored = false }, -- { "filetype", colored = false },
{ -- {
function() -- function()
update_word_count() -- update_word_count()
return wc_cache -- return wc_cache
end, -- end,
}, -- },
}, -- },
lualine_y = { "progress" }, -- lualine_y = { "progress" },
lualine_z = { { -- lualine_z = { {
"location", -- "location",
fmt = function(str) -- fmt = function(str)
return string.match(str, "^[^:]+") -- return string.match(str, "^[^:]+")
end, -- end,
} }, -- }
} -- } },
return { return {
"nvim-lualine/lualine.nvim", "nvim-lualine/lualine.nvim",
enabled = true,
dependencies = { dependencies = {
"ficcdaf/ashen.nvim", "ficcdaf/ashen.nvim",
}, },
config = function() opts = require("ashen.plugins.lualine").lualine_opts,
local ashen_lualine = require("ashen.plugins.lualine")
local theme = ashen_lualine.theme
local ashen_inactive_sections = ashen_lualine.inactive_sections
-- vim.api.nvim_create_autocmd(
-- { "TextChanged", "TextChangedI", "CursorHold" },
-- { pattern = "*", callback = update_word_count }
-- )
require("lualine").setup({
options = {
theme = theme,
disabled_filetypes = {
statusline = {
"snacks_dashboard",
},
},
-- section_separators = { left = "", right = "" },
-- component_separators = { left = "", right = "" },
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
},
sections = sections,
inactive_sections = ashen_inactive_sections,
})
end,
} }