HOWTO

The Variable Based Indenter

This article was originally published as a blog at http://www.alweb.dk/blog/anders/autoindentation at 2004/11/02.

NOTE Mon Nov 1 16:49:03 CET 2004: revised versions of the variables for both perl and bash. Also update kdelibs/kate/part.

Some time ago, when I convinced Laurence Withers to contribute a XML auto-indenter to Kate, I got the idea that we should also have a more flexible indenter that could be configured using the document variable system. The other day while commenting on this bug I was reminded again. So in one of my usual streaks away from my overfilled TODO list, I sat down and implemented one last night..

Embedding KatePart in your application

© 2005 by Dominik Haumann

If you need a more powerful text editor part than a simple KTextEdit the way to go is to embed a katepart into your application. This HOWTO assumes you already have a working KDE application based on a KMainWindow. You can achieve this for example with KDevelop templates.

Scripting KatePart with JavaScript

KatePart gained scripting support in version 2.5 (KDE 3.5) using the common language JavaScript (ECMAScript).

First some basics: A katepart represents a document and one or more views - that’s all. Scripts can access the document and the active view. As JavaScript supports functions and properties every function will be marked with a [function] and every property with a [property:read only].

The File .kateconfig

Kate allows you to specify local document variables by setting the corresponding modelines. The hidden file .kateconfig provides exactly the same functionality, but for all files in the directory.

Writing Indenters

Kate Part itself already ships with several indenters, however it may be that users are not content or need another indenter to indent their code.

Syndicate content