Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nut): add buf.wordcount #10

Merged
merged 1 commit into from
Oct 28, 2022
Merged

feat(nut): add buf.wordcount #10

merged 1 commit into from
Oct 28, 2022

Conversation

MunifTanjim
Copy link
Owner

@MunifTanjim MunifTanjim commented Oct 28, 2022

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

@MunifTanjim MunifTanjim mentioned this pull request Oct 28, 2022
16 tasks
@MunifTanjim MunifTanjim merged commit eda5ea0 into main Oct 28, 2022
@MunifTanjim MunifTanjim deleted the feat-nut-buf-wordcount branch October 28, 2022 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant