Back to article
Kate Text Editor-- Advanced Configuration and Command-Line Tips
Configuration Tips and Tricks
March 3, 2009
In the last article in this series, Getting Started With Kate, the Friendly yet Powerful Text Editor, I covered Kate basics. This article will look at its extensive configurability, and the command-line interface.
The Kate configuration menu is user-friendly, and should mostly be intuitive. One useful editor config option is the persistent selection setting. If persistent selection is switched on, the selection made will remain even when you move the cursor away and/or type: so you can leave something selected while you're typing elsewhere in the document.
The shortcuts menu allows you to set your own keyboard shortcuts for various functions, which is great if you're used to a particular key combination for doing a particular thing, or if you have a non-standard keyboard.
Kate's plugin capability can also be accessed from the config menu. You can turn on the plugins that are installed by default here; or you can find or write your own plugins and install them. The default plugins include incremental (as-you-type) search, and a plugin which allows you to use the kdata thesaurus and spellcheck functions, if they're installed on your system (you'll need ispell or aspell, at least). There's also a word completion plugin, which gives popup word completion. Note that it doesn't complete from a dictionary; it completes from words you've previously typed in the document.
Configuring with document variables
The other way to set configuration options in advance is by using document variables. This involves putting a configuration line (which can be in a comment) in a particular document. So for example, in a C++ script, you might want to set tabs to be interpreted as spaces (to agree with a particular coding style), and C-style indentation (see the next article in this series for more on automatic indentation). In which case, you would put this line in either the first or the last 10 lines of your file:
// kate: set-replace-tabs on; indent cstyle;(The // is just the C++ comment marker: the important part from the point of view of Kate is that the line should start with kate:.) The syntax of the document variable line is the same as the syntax used to set options on the command-line (see below).
Document variables have the highest priority when config options are being applied, so they're useful if you want a particular document to be treated differently from your normal setup. The set of variables that can be set in this way is fairly comprehensive, including various colour settings and syntax highlighting as well as selection options, display options, indent, folding, and other options.
You can also set per-filetype (as opposed to per-file) options via the configuration screen, under the Filetypes tab.