Summary: | I'm missing information on the number of words currently used in a kate document. | ||
---|---|---|---|
Product: | [Applications] kate | Reporter: | norbert.lindlbauer |
Component: | general | Assignee: | KWrite Developers <kwrite-bugs-null> |
Status: | RESOLVED DUPLICATE | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | openSUSE | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
norbert.lindlbauer
2006-02-15 01:14:04 UTC
On Wednesday 15 February 2006 05:09, Matej Cepl wrote:
> http://wiki.kate-editor.org/index.php/Kate_Application_DCOP_Scripting
That wouldn't put it in the status bar.
There are several other pieces of information that could be nice to see in the
statusbar, but it could easily end up very crowded too. I wonder if offering
some options would be nice, letting the user select what to see.
-anders
So, I am afraid, that we are returning to my previous effort with abusing external tools. See this thread http://thread.gmane.org/gmane.comp.kde.devel.kwrite/6888 for more info. Oh well. At least you can use something like [ -z "%selection" ] for counting words in all document / only in selection. I tried this JavaScript function: wcCount = document.textFull().split(/[\s\n]+/).length; document.insertLine(0,wcCount+"\n"); but obviously document.insertLine is not the best way how to report number. Any better way? On Sunday 19 February 2006 02:44, Matej Cepl wrote: > I tried this JavaScript function: > > wcCount = document.textFull().split(/[\s\n]+/).length; > document.insertLine(0,wcCount+"\n"); > > but obviously document.insertLine is not the best way how to report number. > Any better way? use wc(1) and external tools. Here is a simple configuration that works for local files: [externaltool_Wordcount] acname=externaltool_Wordcount cmdname= command=url=`echo %URL|sed -r 's,^\\w+\\:/+,/,'`\nkdialog --msgbox "Word count for\n%URL:\\n$(wc -lwm $url|sed - r 's,\\s*(\\w+)\\s+(\\w+)\\s+(\\w+).*,Lines: \\1\\nWords: \\2\\nCharacters: \\3,')"\n executable=wc icon= mimetypes= name=Word count save=1 If you don't like wc you can use whatever command (sed, perl) to do the calculations as you please. |