A simple plugin to display reading time and word count.
Using plug
:
Plug 'skwee357/nvim-prose'
Call setup
with the config you want to pass. The default config is shown below
require('nvim-prose').setup {
wpm = 200.0,
filetypes = { 'markdown', 'asciidoc' },
placeholders = {
words = 'words',
minutes = 'min'
}
}
After than, you can use nvim-prose
in any location you want (e.g. your status line). It exposes 3 methods:
word_count()
- return the number of words in the documentreading_time()
- return the reading time (in minutes) of the current documentis_available()
- returns whethernvim-prose
is supported in the current filetype (based onfiletypes
provided in the config)
If you use lualine
, you can set up nvim-prose
with it like this:
local prose = require 'nvim-prose'
require 'lualine'.setup {
...
sections = {
...
lualine_x = {
{ prose.word_count, cond = prose.is_available },
{ prose.reading_time, cond = prose.is_available },
},
},
...
}
- [] Add support for
lualine
(vialualine
extensions) - [] Generate proper docs