# Configure &kappname;

Selecting Settings Configure `Application`... from the menu brings up the Configure dialog box. This dialog can be used to alter a number of different settings. The settings available for change vary according to which category the user chooses from a vertical list on the left side of the dialog. By means of three buttons along the bottom of the box the user can control the process.

You may invoke the Help system, accept the current settings and close the dialog by means of the OK button, or Cancel the process. The categories Appearance, Fonts & Colors, Editing, Open/Save and Extensions are detailed below.

## The Editor Component Configuration

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

### Appearance

#### General

Editor font

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

  For more information about selecting a font, see the Choosing Fonts section of the &kde; Fundamentals documentation.

Show whitespace indicators

- Never

- The editor will never display dots to indicate the presence of whitespace.

At the end of a line

- The editor will display dots to indicate the presence of extra whitespace at the end of lines.

Always

- The editor will always display dots to indicate the presence of whitespace.

Whitespace indicator size

- Use the slider to change the size of the visible indicator marker.

Show tab indicators

- When checked the editor will display a » symbol to indicate the presence of a tab in the text.

Bracket matching

- Highlight range between selected brackets

- If this is enabled, the range between the selected matching brackets will be highlighted.

Show preview of matching open bracket

- When enabled, the editor will show a tooltip of the matching open bracket.

Flash matching bracket when cursor moves to other bracket in pair

- If enabled, moving on the brackets ({, [, ], },( or )) will quickly flash the matching bracket.

Show indentation lines

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

Counts

- Show word count

- Displays the number of words and characters in the document and in the current selection in the status bar. This option is also available in the status bar context menu.

Show line count

- Displays the number of total lines in the document in the status bar. This option is also available in the status bar context menu.

Fold first line

- If enabled, the first line is folded, if possible. This is useful, if the file starts with a comment, such as a copyright

Dynamic Word Wrap

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

  Wrap dynamically at static word wrap marker

- When checked, editor wraps lines dynamically at the static word wrap position.

Disregard word boundaries for dynamic wrapping

- When checked, the editor does not take into account word boundaries when wrapping text lines.

Dynamic word wrap indicators

- Choose when the Dynamic word wrap indicators should be displayed, either Off, Follow Line Numbers or Always on.

Indent wrapped lines

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

Line Height Multiplier

- This value will be multiplied by the font's default line height. A value of 1.0 means that the default height will be used.

#### Borders

Code block folding

- Show arrows to collapse code blocks

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

Show preview of folded blocks on hover

- If checked, hovering over a folded region shows a preview of the folded text in a popup.

Folding arrows visibility

- Switch the folding arrows between Show on Hover and Show Always.

Left side

- Show marks

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

Highlight changed and unsaved lines

- If this is checked, line modification markers will be visible. For more information, see kate-part-line-modification.

Scrollbars

- Show marks

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

Show preview when hovering over scrollbar

- If this option is checked, and you hover the scrollbar with the mouse cursor a small text preview with several lines of the current document around the cursor position will be displayed. This allows you to quickly switch to another part of the document.

Minimap

- Show minimap

- If this option is checked, every new view will show a minimap of the document on the vertical scrollbar.

  For more information on the scrollbar minimap, see kate-part-scrollbar-minimap.

Minimap Width

- Adjusts the width of the scrollbar mini-map, defined in pixels.

Scrollbars visibility

- Switch the scrollbar on, off or show the scrollbar only when needed. Click with the &LMB; on the blue rectangle to display the line number range of the document displayed on the screen. Keep the &LMB; pressed outside the blue rectangle to automatically scroll through the document.

Sort bookmarks menu

- By date created

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

By line number

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

### Color Themes

This section of the dialog lets you configure all colors in any color theme you have, and create new themes, delete existing ones or just Follow System Color Scheme. Each scheme has settings for colors and normal and highlighted text styles.

&kappname; will preselect the currently active theme for you, if you want to work on a different theme start by selecting that from the Select theme combobox. With the Copy and Delete buttons you can create a new theme (copying an existing one) or delete existing ones.

This is described in detail in color-themes-gui.

### Editing

#### General

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. &kappname; will automatically start a new line of text when the current line reaches the length specified by the Wrap words at: option.

  Wrap words at a fixed column

- Turns static word wrap on or off.

Draw vertical line at the word wrap column

- 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 Wrap words at a fixed column option is selected this entry determines the length (in characters) at which the editor will automatically start a new line.

Default input mode

- The selected input mode will be enabled when opening a new view. You can still toggle the vi input mode on/off for a particular view in the Edit menu.

Brackets

- If the Automatically close brackets when opening bracket is typed option is selected when the user types a left bracket ([, (, or {) &kappname; automatically enters the right bracket (}, ), or ]) to the right of the cursor.

Enclosing characters

- It is possible to select the enclosing characters using the corresponding drop-down list.

  When text is selected, typing one of these characters wraps the selected text.

Copy and paste

- Move selected text when dragged

- This option enables drag-and-drop of the selected text inside the editor window.

Copy/cut the current line if invoked without any text selected

- If this option is enabled and the text selection is empty, copy and cut action are performed for the line of text at the actual cursor position.

Don't move the text cursor when pasting by mouse

- If this option is enabled and you paste some text in the editor window with the &MMB; clicking, &kappname; will not move the text cursor into the clicked position.

#### Text Navigation

Text Cursor Movement

- Smart home and smart end

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

PageUp/PageDown moves cursor

- This option changes the behavior of the cursor when the user presses the &PgUp; or &PgDn; key. If unselected the text cursor will maintain its relative position within the visible text in &kappname; 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.

Enable camel case cursor movement

- This option changes the behavior of the cursor when the user presses the &Ctrl;Left arrow or &Ctrl;Right arrow shortcut. If unselected the text cursor jumps over the full words. With this option selected, the cursor jumps break at camel case humps.

Autocenter cursor:

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

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

Allow scrolling past the end of the document

- This option lets you scroll past the end of the document. This can be used to vertically centre the bottom of the document, or put it on top of the current view.

Backspace key removes character’s base with its diacritics

- When selected, composed characters are removed with their diacritics instead of only removing the base character. This is useful for Indic locales.

Multicursor modifier

- This option lets you set the modifier that will be used to create multiple cursors with &LMB; click. You need to press the modifiers and click &LMB; to create a cursor at the desired location. See Creating multiple cursors to discover other ways to create multiple cursors.

#### Indentation

Default 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;.

Indent using

- Tabulators

- When this is enabled the editor will insert tabulator characters when you press the key or use automatic indentation.

Spaces

- 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 key or use automatic indentation.

Tabulators and Spaces

- When this is enabled, the editor will insert spaces as describe above when indenting or pressing at the beginning of a line, but insert tabulators when the key is pressed in the middle or end of a line.

Tab width:

- This configures the number of spaces that are displayed in place of a tabulator character.

Indentation width:

- The indentation width is the number of spaces which is used to indent a line. If configured to indent using tabulators, a tabulator character is inserted if the indentation is divisible by the tab width.

Indentation Properties

- Keep extra spaces

- If this option is disabled, changing the indentation level aligns a line to a multiple of the width specified in Indentation width.

Adjust indentation of text pasted from the clipboard

- If this option is selected, text pasted from the clipboard is indented. Triggering the Undo action removes the indentation.

Indentation Actions

- Backspace key in leading blank space unindents

- If this option is selected, the &Backspace; key decreases the indentation level if the cursor is located in the leading blank space of a line.

Tab key action (if no selection exists)

- If you want to align the current line in the current code block like in &Emacs;, make a shortcut to the action Format Indentation.

  Always advance to the next tab position

- If this option is selected, the key always inserts white space so that the next tab position is reached. If the option Insert spaces instead of tabulators on the General tab in the Editing page is enabled, spaces are inserted; otherwise, a single tabulator is inserted.

Always increase indentation level

- If this option is selected, the key always indents the current line by the number of character positions specified in Indentation width.

Increase indentation level if in leading blank space

- If this option is selected, the key either indents the current line or advances to the next tab position. If the insertion point is at or before the first non-space character in the line, or if there is a selection, the current line is indented by the number of character positions specified in Indentation width. If the insertion point is located after the first non-space character in the line and there is no selection, white space is inserted so that the next tab position is reached: if the option Insert spaces instead of tabulators on the General tab in the Editing page is enabled, spaces are inserted; otherwise, a single tabulator is inserted.

#### Auto Completion

General

- Enable auto completion

- If enabled, a word completion box automatically pops up during typing showing a list of text entries to complete the current text under the cursor.

Auto select first completion entry

- If enabled, the first auto completion item is always preselected so you can insert it with &Enter;. If you do not want such behavior, ⪚ if you want pressing &Enter; to only insert a newline, then disable this item.

Minimal word length to complete

- While typing text, the word completion searches for words in the document starting with the already typed text. This option configures the minimal amount of characters that are needed to make the word completion active and pop up a completion box.

Remove tail on complete

- Remove the tail of a previous word when the completion item is chosen from a list.

Keyword completion

- If enabled, the built-in autocompletion uses the keywords defined by the syntax highlighting.

#### Spellcheck

These configuration options are described in the documentation for the &systemsettings; module Spell Checker.

#### Vi Input Mode

General

- Let Vi commands override Kate shortcuts

- When selected, Vi commands will override &kappname;'s built-in commands. For example: &Ctrl;R will redo, and override the standard action (showing the search and replace dialog).

Display relative line numbers

- if this is enabled, the current line always refers to line 0. Lines above and below increase the line number relatively.

Key Mapping

- Key mapping is used to change the meaning of typed keys. This allows you to move commands to other keys or make special keypresses for doing a series of commands.

  Example:

  F2 -> `I--` &Esc;

  This will prepend `I--` to a line when pressing F2.

### Open/Save

#### General

File Format

- Encoding

- This defines the standard encoding to use to open/save files, if not changed in the open/save dialog or by using a command line option.

Encoding Detection

- Select an item from the drop down box, either to disable autodetection or use Universal to enable autodetection for all encodings. But as this may probably only detect utf-8/utf-16, selecting a region will use custom heuristics for better results. If neither the encoding chosen as standard above, nor the encoding specified in the open/save dialog, nor the encoding specified on command line match the content of the file, this detection will be run.

Fallback Encoding

- This defines the fallback encoding to try for opening files if neither the encoding chosen as standard above, nor the encoding specified in the open/ save dialog, nor the encoding specified on command line match the content of the file. Before this is used, an attempt will be made to determine the encoding to use by looking for a byte order mark at start of file: if one is found, the right unicode encoding will be chosen; otherwise encoding detection will run, if both fail fallback encoding will be tried.

End of line

- Choose your preferred 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.

Enable byte order mark (BOM)

- The byte order mark is a special sequence at the beginning of unicode encoded documents. It helps editors to open text documents with the correct unicode encoding. For more information see Byte Order Mark.

Line Length Limit

- Unfortunately, due to deficiencies in &Qt;, &kappname; experiences poor performance when working with extremely long lines. For that reason, &kappname; will automatically wrap lines when they are longer than the number of characters specified here. To disable this, set this to `0`.

Automatic Cleanups on Save

- Remove trailing spaces

- The editor will automatically eliminate extra spaces at the ends of lines of text while saving the file. You can select Never to disable this functionality, On Modified Lines to do so only on lines that you have modified since you last saved the document, or In Entire Document to remove them unconditionally from the entire document.

Append newline at end of file on save

- The editor will automatically append a newline to the end of the file if one is not already present upon saving the file.

Enable Auto Save (local files only)

- Check this if you want the editor to autosave documents while you are working on them.

  Auto save document when focus leaves the editor

- The editor will automatically save documents when you switch to something outside the editor, ⪚, the terminal panel in &kate;.

Auto save interval

- You can determine the autosave interval in seconds here. If the interval is 0, the document will not be autosaved after intervals.

#### Advanced

Write a backup file on save for

- Backing up on save will cause &kappname; to copy the disk file (the previously saved version of the file) to <prefix><filename><suffix> before saving the new changes. A backup file can help you recover work if something goes wrong while saving or if you later want to recover the previous version of the file. 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 for backup files

- Enter the prefix to prepend to the backup file names.

Suffix for backup files

- Enter the suffix to add to the backup file names.

Swap file mode

- &kappname; is able to recover (most) unsaved work in the case of a crash or power failure. A swap file (.<filename>.kate-swp) is created when a document is edited. If the user doesn’t save the changes and &kappname; crashes, the swap file remains on the disk. When opening a file, &kappname; checks if there is a swap file for the document and if it is, it asks the user whether he wants to recover the lost data or not. The user has the possibility to view the differences between the original file and the recovered one, too. The swap file is deleted after every save and on normal exit.

  &kappname; syncs the swap files on the disk every 15 seconds, but only if they have changed since the last sync. The user can disable the swap files syncing if he wants, by selecting Disable, but this can lead to more data loss.

  When the swap file is enabled, it is possible to switch between two modes, namely Enabled, Store in Default Directory and Enabled, Store in Custom Directory.

Store swap files in

- By default, the swap files are saved in the same folder as the file. When Enabled, Store in Custom Directory is chosen for the swap file mode, swap files are created in the specified folder. This is useful for network file systems to avoid unnecessary network traffic.

Save swap files every

- &kappname; syncs the swap files on the disk every 15 seconds, but only if they have changed since the last sync. You can change the sync interval as you like.

#### Modes & Filetypes

This page allows you to override the default configuration for documents of specified &MIME; types. When the editor loads a document, it will try if it matches the file masks or &MIME; types 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 menu.

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 &kappname;'s settings for the files selected by this &MIME; type using &kappname; variables. You can set almost any configuration option, such as highlight, indent-mode, &etc;

  Press Edit to see a list of all available variables and their descriptions. Select the checkbox on the left to enable a particular variable and then set the value of the variable on the right. Some variables provide a drop-down box to select possible values from while others require you to enter a valid value manually.

  For complete information on these variables, see Configuring with Document Variables.

Highlighting:

- If you create a new file type, this drop down box allows you to select a filetype for highlighting.

Indentation Mode:

- The drop down box specifies the indentation mode for new documents.

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 &MIME; types.

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.

## Configuring With Document Variables

&kappname; variables is &kappname;'s implementation of document variables, similar to &Emacs; and vi modelines. In katepart, the lines have the following 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: replace-tabs on; indent-width 4; indent-mode cstyle;

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

Additionally, document variables can be placed in a file called `.kateconfig` in any directory, and the configured settings will be applied as if the modelines were entered on every file in the directory and its subdirectories. Document variables in `.kateconfig` use the same syntax as in modelines, but with extended options.

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

&kappname; has support for reading configurations from `.editorconfig` files, when the editorconfig library is installed. &kappname; automatically searches for a `.editorconfig` whenever you open a file. It gives priority to `.kateconfig` files, though.

### How &kappname; 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 `.kateconfig`.

- Document variables in the document itself.

- Settings made during editing from menu or command line.

As you can see, document variables are only overridden by changes made at runtime. 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 &kappname; version 5.38. 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

- Enable automatic insertion of brackets.

    auto-center-linesINT

- Set the number of autocenter lines.

    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

- Enable or disable unindenting when &Backspace; is pressed.

    block-selectionBOOL

- Turn block selection on or off.

    bom | byte-order-mark | byte-order-markerBOOL

- Enable/disable the byte order mark (BOM) when saving files in Unicode format (utf8, utf16, utf32).

  Since: &kate; 3.4 (&kde; 4.4)

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

    default-dictionarySTRING

- Sets the default dictionary used for spellchecking.

  Since: &kate; 3.4 (&kde; 4.4)

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

    folding-markersBOOL

- Set the display of folding markers on or off.

    folding-previewBOOL

- Enable folding preview in the editor border.

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

    hl | syntaxSTRING

- Set the syntax highlighting. Valid strings are all the names available in the menus. For instance, for C++ simply write `C++`.

    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.

    indent-modeSTRING

- Set the auto-indentation mode. The options `none`, `normal`, `cstyle`, `haskell`, `lilypond`, `lisp`, `python`, `ruby` and `xml` are recognized. See the section kate-part-autoindent for details.

    indent-pasted-textBOOL

- Enable/disable adjusting indentation of text pasted from the clipboard.

  Since: &kate; 3.11 (&kde; 4.11)

    indent-widthINT

- Set the indentation width.

    keep-extra-spacesBOOL

- Set whether to keep extra spaces when calculating indentation width.

    line-numbersBOOL

- Set the display of line numbers on or off.

    newline-at-eofBOOL

- Add an empty line at the end of the file (EOF) when saving the document.

  Since: &kate; 3.9 (&kde; 4.9)

    overwrite-modeBOOL

- Set overwrite mode on or off.

    persistent-selectionBOOL

- Set persistent selection on or off.

    replace-tabs-saveBOOL

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

    replace-tabsBOOL

- Set dynamic tab to space conversion on or off.

    remove-trailing-spacesSTRING

- Removes trailing spaces when saving the document. Valid options are:

  - `none`, `-` or `0`: never remove trailing spaces.

  - `modified`, `mod`, `+` or `1`: remove trailing spaces only in modified lines. The modified lines are marked by the line modification system.

  - `all`, `*` or `2`: remove trailing spaces in the entire document.

    scrollbar-minimapBOOL

- Show scrollbar minimap.

    scrollbar-previewBOOL

- Show scrollbar preview.

    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.

    tab-indentsBOOL

- Set key indentation on or off.

    tab-widthINT

- Set the tab character display width.

    undo-stepsINT

- Set the number of undo steps to remember.

  Note: Deprecated since &kate; 3 in &kde;4. This variable is ignored. The maximal count of undo steps is unlimited.

    word-wrap-columnINT

- Set the static 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 static word wrapping on or off.

### Extended Options in `.kateconfig` files

&kappname; always search for a `.kateconfig` file for local files (not remote files). In addition, it is possible to set options based on wildcards (file extensions) as follows:

    kate: tab-width 4; indent-width 4; replace-tabs on;
    kate-wildcard(*.xml): indent-width 2;
    kate-wildcard(Makefile): replace-tabs off;

In this example, all files use a tab-width of 4 spaces, an indent-width of 4 spaces, and tabs are replaced expanded to spaces. However, for all `*.xml` files, the indent width is set to 2 spaces. And Makefiles use tabs, &ie; tabs are not replaced with spaces.

Wildcards are semicolon separated, &ie; you can also specify multiple file extensions as follows:

    kate-wildcard(*.json;*.xml): indent-width 2;

Further, you can also use the &MIME; type to match certain files, ⪚ to indent all C++ source files with 4 spaces, you can write:

    kate-mimetype(text/x-c++src): indent-width 4;

Next to the support in `.kateconfig` files, wildcard and &MIME; type dependent document variables are also supported in the files itself as comments.