&Anders.Lund; &Anders.Lund.mail;

# Configuring &kate;

## Overview

&kate; offers several means of tweaking the application to behave as desired. The most important ones are:

The Configuration Dialog

  The main configuration tool, allowing you to configure the &kate; application, the editor component and the usage of plugins.

The Settings Menu

  Allows you to change often used settings, and to launch the configuration dialogs.

The View Menu

  Allows you to split the current frame, as well as to display the icons and line numbers pane for the currently edited document.

The embedded &konsole; is using the configuration defined in the &kcontrolcenter;, and may be configured by clicking the right mouse button and choosing from the Settings sub menu.

## The Main Configuration Dialog

The &kate; configuration dialog displays a tree of topics on the left, and a configuration page corresponding to the selected topic on the right.

The configuration is divided into two groups, namely

- Application configuration

- Editor component configuration

## The &kate; Application Configuration

This group contains pages to configure the main &kate; application

### The General Page

This section contains a few global options for &kate;

Show Full Path in Title

  When enabled, Kate will display the full URL of your current document in the window title, rather than just the file name.

Behavior
  Sync Konsole with Active Document

    This will cause the built-in &konsole; to `cd` into the directory of the active document when launched and when a new document gets the focus. If not enabled, you have to do all your navigation in the &konsole; on your own.

  Warn about files modified by foreign processes

    When enabled, &kate; will notify you about files modified from outside the application whenever the main window receives input focus. You will be able to deal with several modified files at once, you can reload, save or discard changed files in groups.

    If not enabled, &kate; will prompt you for action when a externally modified file receives focus within the application.

Meta Data
  Keep meta-information past sessions

    When enabled, &kate; will store meta data such as bookmarks and session configuration even when you close your documents. The data will be used if the document is unchanged when reopened.

  Delete unused meta information after

    Set the maximum number of days to keep meta information for unopen files. This helps keeping the database of meta information reasonably sized.

### The Sessions Page

This section contains options related to using sessions.

Elements of Sessions
  Include window configuration

    If enabled, &kate; will save the window configuration with each session.

Behavior on Application Startup

  Select how you want &kate; to behave at startup. This setting can be overridden by specifying what to do on the command line.

  Start new session

    With this option, &kate; will start a new, unnamed session when you start it.

  Load last used session

    &kate; will use the most recently opened session at startup. This is good if you want to use the same session always or switch rarely.

  Manually choose a session

    &kate; will display a small dialog that lets you choose your preferred session. This is the default behavior. Nice if you use a lot of different sessions frequently.

Behavior on Application Exit or Session Switch
  Do not save session

    The changes to the session data (open files and if enabled, window configuration) will not be saved. You will of course be prompted if you have unsaved files. With this option, your can configure your sessions once, and not worry about closing extra files that you opened and do not want to see next time you use the session.

  Save Session

    &kate; will save session data, except if the session is unnamed. With this option, your sessions are allways restored just like you left them. This is the default behavior.

  Ask user

    You will be asked if you want to save the session every time a named session is closed.

### The Filesystem Browser Page

Toolbar

  Configure the buttons on the file system browser toolbar by moving the ones you want enabled to the Selected Actions list, and order them using the arrow buttons at the side of the list.

Auto Synchronization

  You can have the filesystem browser automatically navigate to the directory containing the current document on certain events:

  - When a new document becomes the active one.

  - When the filesystem browser becomes visible.

  Even if you select not to use this feature, you can manually synchronize the browser with the current document by pressing the Synchronize toolbar button.
Remember locations

  Select how long a browsing history you want. The browser does only remember individual locations, duplicates are removed.

Remember filters

  Select how many filters you want remembered. Only individually distinct filters are remembered, duplicates are removed.

Session

  Configure wether the file system browser should remember its location and filter over sessions.

### The Doucment List Page

Backgound Shading

  This section allows you to enable or disable the background shading visualization of your recent activity, and chose which colors to use if enabled. See the section about The Document List for more about this feature.

Sort By

  Set how you want the document list sorted. This can be set from the &RMB; menu in the document list as well.

### The Plugins Page

This page provides a list of installed plugins for the &kate; application. Each plug-in is represented with its name and a short description. You can check the checkbox with an item to enable the plug-in it represents.

If a plug-in provides configuration options, a section to access those will appear as a child of this page.

### External Tools

In the Tools menu you will find a submenu labeled External Tools. These tools invokes external applications with data related to the current document, for example its URL, directory, text or selection. This page allows you to manage the menu and edit, remove or add new tools.

Each external tool is a shell command which contains macros representing the document data. When activated, the macros are substituted with data from the active document.

#### External Tools Properties

Label

  A friendly label for the External Tools menu.

Script

  The script to execute when the tool is activated. Before passing the script to the shell, the following macros are substituted:

  %URL

    The full URL of the current document, or an empty string if the document is unsaved.

  %URLS

    A space seperated list of the URLs of all open documents (except unsaved ones).

  %directory

    The directory part of the current documents URL or an empty string if the current document is unsaved.

  %filename

    the filename of the current document without the path, or an empty string if the current document is unsaved.

  %line

    The line number of the insertion cursor is in the current document.

  %column

    The column number of the insertion cursor in the current document.

  %selection

    The selected text in the current document, or an empty string if no text is selected

  %text

    The full text of the current document. Beware that this will potentially exceed the maximum command length allowed on your system. Use with care.

Executable

  The main executable is the script. This is mandatory, and is used to test if the command can be run at all. A fully qualified path is allowed in case the executable is not in your `PATH` variable.

Mimetypes

  A semicolon separated list of mimetypes for which this command should be enabled. This is currently unused.

Save

  You can optionally select to have the current or all documents saved prior to executing the script. This is handy if your script reads the file from disk.

Command Line Name

  If you fill this, the tool will be available in the editors command line as `exttool-Command Line Name` (the string you enter here prepended exttool-).

## The Editor Component Configuration

This group contains all pages related to the editor component of &kate;. Most of the settings here are defaults, they can be overridden by defining a filetype, by Document Variables or by changing them pr. document during an editing session.

### Appearance

Word Wrap
  Dynamic word wrap

    If this option is checked, the text lines will be wrapped at the view border on the screen.

  Dynamic word wrap indicators

    Choose when the Dynamic word wrap indicators should be displayed.

  Vertically align dynamically wrapped lines to indentation depth:

    Enables the start of dynamically wrapped lines to be aligned vertically to the indentation level of the first line. This can help to make code and markup more readable.

    Additionally, this allows you to set a maximum width of the screen, as a percentage, after which dynamically wrapped lines will no longer be vertically aligned. For example, at 50%, lines whose indentation levels are deeper than 50% of the width of the screen will not have vertical alignment applied to subsequent wrapped lines.

Code Folding
  Show folding markers (if available)

    If this option is checked, the current view will display marks for code folding, if code folding is available.

Borders
  Show icon border

    If this is checked, you will see an icon border on the left hand side. The icon border shows bookmark signs for instance.

  Show line numbers

    If this is checked, you will see line numbers on the left hand side.

  Show scrollbar marks

    If this option is checked the current view will show marks on the vertical scrollbar. These marks will for instance show bookmarks.

Sort Bookmarks Menu

  By position

    The bookmarks will be ordered by the line numbers they are placed at.

  By creation

    Each new bookmark will be added to the bottom, independently from where it is placed in the document.

Show identation lines

  If this is checked, the editor wil display vertical lines to help identifying indent lines.

### Fonts & Colors

This section of the dialog lets you configure all fonts and colors in any color scheme you have, as well creating new schemes or deleting existing ones. Each scheme has settings for colors, fonts and normal and highlight text styles.

&kate; will preselect the currently active scheme for you, if you want to work on a different scheme start by selecting that from the Schema combobox.

#### Colors

Text Area Background
  Normal text

    This is the default background for the editor area, it will be the dominant color on the editor area.

  Selected Text

    This is the background for selected text. The default is the global selection color, as set in your &kde; color preferences.

  Current Line

    Set the color for the current line. Setting this a bit different from the Normal text background helps to keep focus on the current line.

  Bookmark

    This combo lets you set overlay colors for various mark types. The color is mixed into the background color of a marked line, so that a line with more marks or a marked line that is current has a background that is a mix of more colors. The mark colors are also used if you enable display of scrollbar marks.

Other Elements
  Left Border Background

    This color is used for the marks, line numbers and folding marker borders in the left side of the editor view when they are displayed.

  Line Numbers

    This color is used to draw the line numbers on the left side of the view when displayed.

  Bracket Highlight

    This color is used to draw the background of matching brackets.

  Word Wrap Markers

    This color is used to draw a pattern to the left of dynamically wrapped lines when those are aligned vertically, as well as for the static word wrap marker.

  Tab Markers

    This color is used to draw white space indicators when enabled.

#### Fonts

Here you can choose the font for the schema. You can choose from any font available on your system, and set a default size. A sample text displays at the bottom of the dialog, so you can see the effect of your choices.

#### Normal Text Styles

The normal text styles are inherited by the highlight text styles, allowing the editor to present text in a very consistent way, for example comment text is using the same style in allmost all of the text formats that kate can highlight.

The name in the list of styles is using the style configured for the item, providing you with an immediate preview when configuring a style.

Each style lets you select common attributes as well as foreground and background colors. To unset a background color, rightclick to use the context menu.

#### Highlighting Text Styles

Here you can edit the text styles used by a specific highlight definition. The editor preselects the highlight used by your current document. To work on a different highlight, select one in the Highlight combobox above the style list.

The name in the list of styles is using the style configured for the item, providing you with an immediate preview when configuring a style.

Each style lets you select common attributes as well as foreground and background colors. To unset a background color, rightclick to use the context menu. In addition you can see if a style is equal to the default style used for the item, and set it to that if not.

You will notice that many highlights contain other highlights represented by groups in the style list. For example most highlights import the Alert highlight, and many source code formats imports the Doxygen highlight. Editing colors in those groups only affects the styles when used in the edited highlight format.

### Cursor & Selection

Text Cursor Movement
  Smart home

    When selected, pressing the home key will cause the cursor to skip white space and go to the start of a line's text.

  Wrap cursor

    When on, moving the insertion cursor using the Left and Right keys will go on to previous/next line at beginning/end of the line, similar to most editors.

    When off, the insertion cursor cannot be moved left of the line start, but it can be moved off the line end, which can be very handy for programmers. When this option is chosen, moving the cursor with the arrow keys off the end of a line (to the right) causes it to jump down to the beginning of the next line. Likewise when the cursor is moved past the beginning of a line (to the left) it jumps up to the end of the preceding line. When this option is not selected, moving the cursor right past the end of a line merely causes it to continue horizontally in the same line and trying to move it left past the beginning does nothing.

  Page Up/Page Down moves cursor

    This option changes the behavior of the cursor when the user presses the Page Up or Page Down key. If unselected the text cursor will maintain its relative position within the visible text in &kate; as new text becomes visible as a result of the operation. So if the cursor is in the middle of the visible text when the operation occurs it will remain there (except when one reaches the beginning or end.) With this option selected, the first key press will cause the cursor to move to either the top or bottom of the visible text as a new page of text is displayed.

  Autocenter cursor (lines):

    Sets the number of lines to maintain visible above and below the cursor when possible.

Selection Mode
  Normal

    Selections will be overwritten by typed text and will be lost on cursor movement.

  Persistent

    Selections will stay even after cursor movement and typing.

### Editing

Tabulators
  Insert spaces instead of tabulators

    When this is enabled the editor will insert a calculated number of spaces according to the position in the text and the `tab-width` setting when you press the TAB key.

  Show tabulators

    When this is enabled &kate; will display a small dot as a visual representation of tabulator characters.

    This also causes dots to be drawn to indicate trailing white space. This will be fixed in a future version of &kate;

  Tab Width

    If the Replace Tabs By Spaces option is selected this entry determines the number of spaces with which the editor will automatically replace tabs.

Static Word Wrap

  Word wrap is a feature that causes the editor to automatically start a new line of text and move (wrap) the cursor to the beginning of that new line. &kate; will automatically start a new line of text when the current line reaches the length specified by the Wrap Words At: option.

  Enable static word wrap

    Turns static word wrap on or off.

  Show static word wrap markers (if applicable)

    If this option is checked, a vertical line will be drawn at the word wrap column as defined in the Settings Configure Editor... in the Editing tab. Please note that the word wrap marker is only drawn if you use a fixed pitch font.

  Wrap words at:

    If the Word Wrap option is selected this entry determines the length (in characters) at which the editor will automatically start a new line.

Remove Trailing Spaces

  &kate; will automatically eliminate extra spaces at the ends of lines of text.

Auto Brackets

  When the user types a left bracket ([, (, or {) &kate; automatically enters the right bracket (}, ), or ]) to the right of the cursor.

Maximum undo steps:

  Here the user may specify the number of steps &kate; will retain in memory for purposes of undoing entries and actions. This means that the higher the number of steps set the more memory &kate; will use for this. Setting this entry to 10 would mean that the user would be be able reverse the last ten operations, i.e. click the undo button 10 times and obtain results.

Smart search text from:

  This determines where &kate; will get the search text from (this will be automatically entered into the Find Text dialog):

  - Nowhere: Don't guess the search text.

  - Selection Only: Use the current text selection, if available.

  - Selection, then Current Word: Use the current selection if available, otherwise use the current word.

  - Current Word Only: Use the word that the cursor is currently resting on, if available.

  - Current Word, then Selection: Use the current word if available, otherwise use the current selection.

  Note that, in all the above modes, if a search string has not been or cannot be determined, then the Find Text Dialog will fall back to the last search text.

### Indentation

Automatic indentation
  Indentation mode:

    Select the automatic indentation mode you want to use as default. It is strongly recommended to use `None` or `Normal`here, and use filetype configurations to set other indentation modes for text formats like C/C++ code or &XML;.

  Insert leading Doxygen "*" when typing

    Automatically insert a leading "*" while typing within a doxygen style comment. This setting is only enabled when applicable.

Indentation with Spaces
  Use spaces instead of tabs to indent

    This replaces tabs with the number of spaces set in Number of spaces: below.

  Emacs style mixed mode

    Use a mix of tabs and space characters for indentation.

  Number of spaces:

    Set the number of spaces you want to use for indentation when you check Use spaces instead of tabs to indent above.

Keep Indent Profile

  When this is enabled, the editor will not unindent lines in a selection further when the line with the least indentation becomes unindented. If you sometimes unindent blocks of indented code, this may be helpful.

Keep Extra Spaces

  Indentations of more than the selected number of spaces will not be shortened.

Keys to use
  Tab key indents

    This allows the tab key to be used to indent.

  Backspace key indent

    This allows the backspace key to be used to indent.

Tab Key Mode if Nothing Selected
  Insert indent characters

    This allows the Tab key insert indent characters.

  Insert tab character

    This allows the Tab key insert a tab.

  Indent current line

    This allows the Tab key indent the current line.

### Open & Save

File Format
  Encoding:

    This sets the default character encoding for your files.

  End of line:

    Choose your prefered end of line mode for your active document. You have the choice between &UNIX;, DOS/&Windows; or Macintosh.

  Automatic end of line detection

    Check this if you want the editor to autodetect the end of line type. The first found end of line type will be used for the whole file.

Memory Usage
  Maximum loaded blocks per file:

    The editor will load given number of blocks (of around 2048 lines) of text into memory; if the filesize is bigger than this the other blocks are swapped to disk and loaded transparently as-needed.

    This can cause little delays while navigating in the document; a larger block count increases the editing speed at the cost of memory.

    For normal usage, just choose the highest possible block count: limit it only if you have problems with the memory usage.

Automatic Cleanups on Load/Save
  Remove trailing spaces

    The editor will automatically eliminate extra spaces at the ends of lines of text while loading/saving the file.

Folder Config File
  Search depth for config file:

    The editor will search the given number of folder levels upwards for &kate; config file and load the settings line from it.

Backup on Save

  Backing up on save will cause &kate; to copy the disk file to <prefix><filename><suffix>' before saving changes. The suffix defaults to ~ and prefix is empty by default.

  Local files

    Check this if you want backups of local files when saving.

  Remote files

    Check this if you want backups of remote files when saving.

  Prefix

    Enter the prefix to prepend to the backup file names.

  Suffix

    Enter the suffix to add to the backup file names.

### Highlighting

This group of options is used to customize the highlighting styles for each programming language type. Any changes you made in other areas of this dialog apply only to this type.

Highlight:

  This is used to choose the language type to configure.

Informations

  View the properties of the chosen language highlighting rules: author name and license.

Properties
  File extensions:

    This is the list of file extensions used to determine which files to highlight using the current syntax highlight mode.

  MIME types:

    Clicking the wizard button will display a dialog with a list of all available mime types to choose from.

    The File Extensions entry will automatically be edited as well.

  Priority:

    Set the priority of the highlight rule.

Download...

  Click this button to download new or updated syntax highlight descriptions from the &kate; website.

### Filetypes

This page allows you to override the default configuration for documents of specified mimetypes. When the editor loads a document, it will try if it matches the file masks or mimetypes for one of the defined filetypes, and if so apply the variables defined. If more filetypes match, the one with the highest priority will be used.

Filetype:

  The filetype with the highest priority is the one displayed in the first drop down box. If more filetypes were found, they are also listed.

  New

    This is used to create a new filetype. After you click on this button, the fields below get empty and you can fill the properties you want for the new filetype.

  Delete

    To remove an existing filetype, select it from the drop down box and press the Delete button.

Properties of current filetype

  The filetype with the highest priority is the one displayed in the first drop down box. If more filetypes were found, they are also listed.

  Name:

    The name of the filetype will be the text of the corresponding menu item. This name is displayed in the Tools Filetypes

  Section:

    The section name is used to organize the file types in menus. This is also used in the Tools Filetypes menu.

  Variables:

    This string allows you to configure &kate;'s settings for the files selected by this mimetype using &kate; variables. You can set almost any configuration option, such as highlight, indent-mode, encoding, etc.

    For a full list of known variables, see the manual.

  File extensions:

    The wildcards mask allows you to select files by filename. A typical mask uses an asterisk and the file extension, for example `*.txt; *.text`. The string is a semicolon-separated list of masks.

  MIME types:

    Displays a wizard that helps you easily select mimetypes.

  Priority:

    Sets a priority for this file type. If more than one file type selects the same file, the one with the highest priority will be used.

### Shortcuts

You can change here the shortcut keys configuration. Select an action and click on Custom if you want a different shortcut for this action.

The search line alllows you to look for a specific action and see its associated shortcut.

### Plugins

This tab lists all available plugins and you can check those you want to use. Once a plugin is checked, the Configure button is enabled and you can click it in order to configure the highlighted plugin.

## Configuring With Document Variables

Kate variables is kateparts implementation of document variables, similar to emacs and vi modelines. In katepart, the lines have the format

`kate: VARIABLENAME VALUE; [ VARIABLENAME VALUE; ... ]`

the lines can of course be in a comment, if the file is in a format with comments. Variable names are single words (no whitespace), and anything up to the next semicolon is the value. The semicolon is required.

Here is an example variable line, forcing indentation settings for a C++, java or javascript file:

    // kate: space-indent on; indent-width 4; mixedindent off; indent-mode cstyle;

Only the first and last 10 lines are searched for variable lines.

There are variables to support almost all configurations in katepart, and aditionally plugins can use variables, in which case it should be documented in the plugin's documentation.

### How kate uses variables

When reading configuration, katepart looks in the following places (in that order):

- The global configuration.

- Optional session data.

- The "Filetype" configuration.

- Document variables in the document itself.

- Settings made during editing from menu or command line.

As you can understand document variables has the next highest precedence. Whenever a document is saved, the document variables are reread, and will overwrite changes made using menu items or the command line.

Any variable not listed below is stored in the document and can be queried by other objects such as plugins, which can use them for their own purpose. For example the variable indent mode uses document variables for its configuration.

The variables listed here documents &kate; version 2.4. More variables may be added in the future. There are 3 possible types of values for variables, with the following valid expressions:

- BOOL - on|off|true|false|1|0

- INTEGER - any integer number

- STRING - anything else

#### Available Variables

    auto-bracketsBOOL

  Set auto insertion of brackets on or off.

    auto-center-linesINT

  Set the number of autocenter lines.

    auto-insert-doxygenBOOL

  Turn insertion of the leading asterisk in doxygen comments on or off. This has no effect unless you use the cstyle auto-indenter.

    background-colorSTRING

  Set the document background color. The value must be something that can be evaluated to a valid color, for example "#ff0000".

    backspace-indentsBOOL

  Turn backspace indenting on or off.

    block-selectionBOOL

  Turn block selection on or off.

    bracket-highlight-colorSTRING

  Set the color for the bracket highlight. The value must be something that can be evaluated to a valid color, for example "#ff0000"

    current-line-colorSTRING

  Set the color for the current line. The value must be something that can be evaluated to a valid color, for example "#ff0000".

    dynamic-word-wrapBOOL

  Turns dynamic word wrap on or off.

    eol | end-of-lineSTRING

  Set the end of line mode. Valid settings are unix, mac and dos

    encodingSTRING

  Set the document encoding. The value must be a valid encoding name, like utf-8.

    font-sizeINT

  Set the point size of the document font.

    fontSTRING

  Set the font of the document. The value should be a valid font name, for example courier.

    icon-bar-colorSTRING

  Set the icon bar color. The value must be something that can be evaluated to a valid color, for example `#ff0000`.

    icon-borderBOOL

  Set the display of the icon border on or off.

    folding-markersBOOL

  Set the display of folding markers on or off.

    indent-modeSTRING

  Set the auto-indentation mode. The options none, normal, cstyle, csands, python, xml are recognized. See the section for details.

    indent-widthINT

  Set the indentation width.

    keep-extra-spacesBOOL

  Set wheather to keep extra spaces when calculating indentation width.

    keep-indent-profileBOOL

  If enabled, prevents unindenting a block if at least one line has no indentation.

    line-numbersBOOL

  Set the display of line numbers on or off.

    mixed-indentBOOL

  Set mixed indentation ala Emacs on or off.

    overwrite-modeBOOL

  Set overwrite mode on or off.

    persistent-selectionBOOL

  Set persistent selection on or off.

    remove-trailing-spaceBOOL

  Set dynamic end of line cleanup on or off.

    replace-tabs-saveBOOL

  Set tab->space conversion on save on or off.

    replace-tabsBOOL

  Set dynamic tab->space conversion on or off.

    replace-trailing-space-saveBOOL

  Set end of line cleanup on save on or off.

    schemeSTRING

  Set the color scheme. The string must be the name of a color scheme that exists in your configuration to have any effect.

    selection-colorSTRING

  Set the selection color. The value must be something that can be evaluated to a valid color, for example "#ff0000".

    show-tabsBOOL

  Set the visual TAB character on or off.

    smart-homeBOOL

  Set smart home navigation on or off.

    space-indentBOOL

  Set indentation with spaces on or off.

    tab-indentsBOOL

  Set the TAB key indentation on or off.

    tab-widthINT

  Set the tab display width.

    undo-stepsINT

  Set the number of undo steps to remember.

    word-wrap-columnINT

  Set the hard word wrap width.

    word-wrap-marker-colorSTRING

  Set the word wrap marker color. The value must be something that can be evaluated to a valid color, for example "#ff0000".

    word-wrapBOOL

  Set hard word wrapping on or off.

    wrap-cursorBOOL

  Set cursor wrapping on or off.