diff options
Diffstat (limited to 'dot-config/nvim/lua/wordcount.lua')
| -rw-r--r-- | dot-config/nvim/lua/wordcount.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/dot-config/nvim/lua/wordcount.lua b/dot-config/nvim/lua/wordcount.lua new file mode 100644 index 0000000..b61a4ee --- /dev/null +++ b/dot-config/nvim/lua/wordcount.lua @@ -0,0 +1,27 @@ +-- Wordcount in markdown +-- +-- Credits +-- https://github.com/nvim-lualine/lualine.nvim/issues/328#issuecomment-982672253 +-- https://github.com/skwee357/nvim-prose + +local M = {} + +function M.wordcount() + local wc = vim.fn.wordcount() + + if not (wc.visual_words == nil) then + return tostring(wc.visual_words) .. " words" + end + + return tostring(wc.words) .. " words" +end + +function M.is_available() + if vim.bo.filetype == "markdown" then + return true + end + + return false +end + +return M |
