Some time ago I stumbled upon Groovy.
Groovy is a relatively new language. It is an agile dynamic language for the Java Platform with almost-zero learning curve for Java programmers.
Someone said that Groovy is a super Java. It’s a laconic and powerful language with closures, builders, support for unit testing and mocking out-of-the-box. It can use any Java class or library and can be used anywhere Java can be used.
I started to learn Groovy and I used, to edit my scripts, my favorite lightweight editor kate. Besides vim/gvim (yes my favorite text editor is vi), one of my best gui editors is kate, a KDE editor.
Kate, among other things (Regular expressions, Codepage conversions, Multiple files, Synchronized terminal etc) is also able to highlight the keywords in a file, based on the file type.
But I had no support for groovy in kate, or I thought so.
After some search I found a Syntax xml file for KDE 4 Kate at Other Plugins at the Groovy home site.
The first problem was that the file was for KDE 4 Kate. I decided to try using it in my KDE 3.5, I had nothing to loose by trying it.
The second problem was that I had to find how to use it, how to convince my kate to use it.
At first I thought that I had to search about «kate plugins» (I had found it under groovy plugins) but this was a dead end, with compilations on KDE 4 etc. It had to be easier, after all I was using KDE 3.5.
After searching in my machine (packages, installed files, etc) and the internet, I found this excellent article about Writing a Kate Highlighting XML File which explained everything to me.
Of course the only thing I needed was which was the place of the syntax file, but I learned a lot of things. By the way the syntax file is good for KDE 3.5 kate also, it works for me.
So, following are the steps needed to make kate able to highlight groovy scripts.
- Download this Kate Syntax xml file for Groovy (link found at Other Plugins at the Groovy home site)
- Find the KDE_DIR variable, needed in the next step
* for personal use or
for non super-users
: KDE_DIR=$HOME/.kde * for global use if KDE3 : KDE_DIR=$(kde-config –prefix) * for global use if KDE4 : KDE_DIR=$(kde4-config –prefix)
- Move/copy groovy.xml to
* if KDE3 : mv groovy.xml $KDE_DIR/share/apps/katepart/syntax * if KDE4 : mv groovy.xml $KDE_DIR/share/kde4/apps/katepart/syntax
|Fixed the link for «Writing a Kate Highlighting XML File»|
|Added the use of home directory|