MunifTanjim / nougat.nvim

🍫 Hyperextensible Statusline / Tabline / Winbar for Neovim 🚀
MIT License
199 stars 3 forks source link

feat(nut): add buf.wordcount #10

Closed MunifTanjim closed 2 years ago

MunifTanjim commented 2 years ago
local nut = {
  buf = {
    wordcount = require("nougat.nut.buf.wordcount").create,
  },
}

local wordcount_enabled = {
  markdown = true,
}

statusline:add_item(nut.buf.wordcount({
  hidden = function(_, ctx)
    return not wordcount_enabled[vim.bo[ctx.bufnr].filetype]
  end,
  hl = { bg = "darksalmon", fg = "bg" },
  prefix = " ",
  suffix = " ",
  sep_right = sep.right_chevron_solid(true),
  config = {
    format = function(count)
      return string.format("%d %s", count, count > 1 and " Words" or " Word")
    end,
  },
}))

Peek 2022-10-28 20-30