Getting Started With the Kate Text Editor: Kate For Coders - page 2
One very useful function is the comment/uncomment feature. Select the text you want to comment out with the cursor, hit Ctrl-D, and Kate will automatically comment that text out using whatever form of comment is appropriate for the automatically-detected type of file. (If Kate can't tell what type of file this is, or doesn't have a comment type defined for this file, the function doesn't operate.) Select it again and hit Ctrl-Shift-D, and it's uncommented again. Very useful when debugging!
There's an automatic indent function, but its styles are limited. It's turned off by default; turn it on either from the Tools menu, or from the command line with indent STRING (options are "none", "normal", "cstyle", "csands", "python", "xml", and "variable"). Normal indenting will maintain the indent of the previous line whenever you hit return or a line wraps onto the next line (and will indicate the latter case with a crossed-out highlight.
There's also automatic indenting for C and a couple of other languages, but not for Perl or HTML. So Kate won't, for example, automatically reduce the indentation one level when it sees , as some editors are able to. It does, however, indent back a level when it sees }, even in 'normal' indent style.
You can turn on automatic bracket insertion with the auto-brackets: true setting from the command line (or as a document variable – see previous article).
Finally, there's code folding. This feature looks for certain sections of code, and shows a folding marker beside them. If you click the folding marker, this section of code will be temporarily hidden. This can be useful when looking through large sections of code, as it can help you get a grasp of the overall structure. This is only available in some formats. You can also manually define foldable regions – this is done in the highlight definition files, so if Kate doesn't support code folding for your preferred language, you can add it yourself.
Finally, there are a few external tools available via the Tools -> External Tools menu. The provided tools are to run the script you're currently editing (in an external terminal, unfortunately, rather than in the Terminal section of Kate), and to email a CVS diff of the file you're editing. You can also write your own external tools, so you're limited only by your own scripting ability! Similarly, as discussed in the last article, Kate offers a variety of plugins, but you can also write your own.
If you're already a power user of one of the popular terminal-based text editors like emacs or vim, you'll probably find Kate a little limited. However, if what you want is an easy-to-use graphical text editor with some powerful and useful functions both for plaintext and for code, give Kate a try.