summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortriethyl <triethylammonium@pm.me>2026-03-12 19:21:24 -0400
committertriethyl <triethylammonium@pm.me>2026-03-12 19:21:24 -0400
commit7336c280400f9a4873bad6589b04c1a6cc18f44a (patch)
treeef0b4c94c322c914c836a52f6c9a76438117ac46
parente7a4d07e71c6cf577eb12f4bddd781d7bef8decd (diff)
neovim: added word count to markdown files
-rw-r--r--pkgs/custom-neovim/config/lua/statusline.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/pkgs/custom-neovim/config/lua/statusline.lua b/pkgs/custom-neovim/config/lua/statusline.lua
index dc7bce7..af3a947 100644
--- a/pkgs/custom-neovim/config/lua/statusline.lua
+++ b/pkgs/custom-neovim/config/lua/statusline.lua
@@ -265,6 +265,20 @@ components.session_name = function (args)
return before..require("auto-session.lib").current_session_name(true)..after
end
+components.markdown_word_count = function (args)
+ args = args or {}
+ local before = args.before or ""
+ local after = args.after or ""
+
+ if vim.bo.filetype ~= "markdown" then
+ return ""
+ end
+
+ local word_count = vim.fn.wordcount().visual_words or vim.fn.wordcount().words
+
+ return before..word_count.." words"..after
+end
+
-- Define Statusline
local statusline = function ()
return {
@@ -275,6 +289,7 @@ local statusline = function ()
"%=",
components.session_name(),
+ components.markdown_word_count(),
components.tab_counter(),
components.location({after = vim.g.neovide and " " or ""}),
components.progress({after = ""}),