What I’m trying to do
Hi want to display count of lines [ Total Lines in the document] preferably in status Bar or at top of document
Things I have tried
Done search on google & the forum → no suggestions
Please help. Thank you
Hi want to display count of lines [ Total Lines in the document] preferably in status Bar or at top of document
Done search on google & the forum → no suggestions
Please help. Thank you
“Better Word Count” plugin can do sentences. I’m not personally sure of any way of counting blocks/paragraphs.
“Novel Word Count” plugin can count “pages”, which is based on a word count you can specify.
I think counting “lines” would depend on the size of your tab or pane, and how the words are wrapping. Do you mean lines that ignore wrapping?
Thanks rigmarole for looking at it
I mean the actual number of lines you see when enabling "show line number " in Editor
It would give the size of the document
I don’t think it depends on line wrap or size of tab/ pane
Cheers
To access the actual line count of your current note, you can put app.workspace.activeEditor.editor.lineCount()
in your console. (ctrl + shift + i/j
on windows, and cmd + option + i/j
on MacOS).
You can build a plugin base on the sample, and modify the status bar text here.
Note that it won’t exclude the properties lines.
Thank you for looking into this @Acylation , did not know that console exists !
The code works perfectly in the console. I would give plugin a try
Btw, is there a way to use the code in the document itself or in frontmatter?
Cheers
You could do it with Dataview in your document like this:
Lines: `$=app.workspace.activeEditor.editor.lineCount()`
Will show
Lines: 25
or whatever, and it will automatically update.
Works perfect, Thank you @AlanG
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.