• Kate Highlighting Power

    by  • September 12, 2007

    Kate’s highlighting capabilities are amazing. If you want you can highlight really complex syntax, without having to hardcode rules in C++. As an example, we’ll take a look at how Lua comments can be realized: –=] ends the multiline comment the number of ‘=’...

    Read more →

    Extending Kate by Scripts

    by  • July 21, 2007

    We have seen how scripting basically works for indentation. It’s also possible to register commandline functions (The command line is bound to F7 by default, or invoke View > Switch to Command Line). We will consider a small example again: sort the selected text. /* kate-script * name: unused * author: foo bar * license: LGPL * version: 1 * kate-version: 3.0 * functions: sorter */ function sorter (){    if (view.hasSelection()) {        var start = view.startOfSelection().line;        var end = view.endOfSelection().line;         var text = document.textRange(start, 0, end, document.lineLength(end));         var lines = text.split(“\n”);        lines.sort();        text = lines.join(“\n”);         view.clearSelection();         document.editBegin();        document.removeText(start, 0, end, document.lineLength(end));        document.insertText(start, 0, text);        document.editEnd();    }} The header line functions:...

    Read more →

    Kate: More on Indentation Scripting

    by  • July 20, 2007

    My last blog was about the theory of how indentation works by using javascripts. Now we will look at a concrete example: a LISP-style indenter. (LISP indentation is easy, that’s why it’s a good example). The rules: comments starting with ;;; always have indentation 0 comments starting with ;; should be aligned with the...

    Read more →

    Kate Scripting: Indentation

    by  • July 18, 2007

    Kate Part in KDE4 supports the ECMAScript (JavaScript) language by using kjs. In KDE3 we had several hard-coded indenters in C++, the idea is to let scripts do all the indentation in KDE4. How does it work? It is similar to vim: You simply create a script in the directory $KDEDIR/share/apps/katepart/jscript. An indentation script...

    Read more →