Articles

Insertion templates

The insertion template system is one of the hidden gems of KatePart, modelled after a similar feature in the eclipse IDE by Joseph Wenninger.

Insertion templates allows to insert a text snippet into the editor that contains variables like user name, date and similar, or fields that may be filled out by the user. Such fields can be repeated within the template text and can then be edited at once, they are highlighted in a special way (underlined) and are navigated between simply by pressing the TAB key.

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].

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.

Writing a Kate Highlighting XML File

This section is an overview of the Highlight Definition XML format. Based on a small example it will describe the main components and their meaning and usage.