Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
O.K., I looked at the code suggested, cut it, and pasted it into Kate. It didn't work for me, either until I pasted it into the Kate terminal. When I did that, I noticed that the backquote, quote, and single-quote characters in the command line had be "converted" to the extended (typographically correct, of course) forms. They look correct in the Kate edit window, but you need to go through and overtype them with the standard keyboard characters. You also need to replace the "-message" by a "--msgbox" in the kdiaog command. (The single, long, dash should, of course, be a double-dash.)
When that's done, you'll get a nice pop-up with the wc outpit in it for whatever you've selected.
Here's what I have in the "Script" section:
if [ -n "%selection" ]
msg=`echo -E "%selection" |\
wc -cmwl |\
sed 's/\s*\([0-9]*\)\s*\([0-9]*\)\s*\([0-9]*\)\s*\([0-9]*\)/Bytes: \4\nCharacters: \3\nWords: \2\nLines: \1/'`
kdialog --msgbox "$msg"
msg="Please select the text for which you desire statistics."
kdialog --error "$msg"
Hum. Well, I tried replacing the kdialog call with a dialog call, and it still failed to work on a GNOME system. So, all I can think of is that kate is using a KDE-specific method of running an embedded script. (Since kate is part of the KDE development kit, having an embedded KDE dependency is, of course, neither surprising nor a bug.)
Does gedit support script extensions? If it does, perhaps the script, or its equivalent, could be used with it.
Thanks Raveolution! I've just installed Mepis 11 and my old fix was no good. Someday the Kate developers may supply a wordcount, but until then I'll have to rely on heroes like you. Or learn to code it myself.
I know that this is an old thread, but word count in Kate is such a huge gap, and PTrenholme's script at comment #8 actually provides a solution. So I felt I had to point that out, because here it is, 2012, and I searched for hours before stumbling on this. I'm using kde 4.7 running under LinuxMintDebian squeeze, with update4 applied.
Step by step: Sessions > Configure Kate. Under Application > Plugins, I ticked the box for "External Tools". Hit "Apply". That causes an "External Tools" entry to appear as a choice under Application. Select Application > External Tools, select the "New" button. Give the script any label that means something to you, copy and paste PTrenholme's script into the script box, under Executable enter "kdialog" (without the quotes), mime types can be left blank, Save can be None, and command is whatever you want to call this command. For instance "wcount".
Now, if you go to Tools > External Tools one of the choices will be wcount (or whatever you called it). If you use it often, you can go to Sessions > Configure Shortcuts and give it a keyboard shortcut.
(Oh, and hint to the Kate devs: INCLUDE THIS AS STANDARD WITH KATE )