Chapter 7. Configure KatePart

Selecting SettingsConfigure 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 KatePart. 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

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 (if applicable)

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

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.

Whitespace Highlighting
Highlight tabulators

The editor will display a » symbol to indicate the presence of a tab in the text.

Highlight trailing spaces

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

Advanced

Show indentation lines

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

Highlight range between selected brackets

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

Animate bracket matching

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

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

Borders

Borders
Show folding markers

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

Show preview of folded code

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

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 line modification markers

If this is checked, line modification markers will be visible. For more information, see the section called “Line Modification Indicators”.

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.

Show text preview on 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.

Show scrollbar mini-map

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

For more information on the scrollbar minimap, see the section called “The 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 left mouse button on the blue rectangle to display the line number range of the document displayed on the screen. Keep the left mouse button pressed outside the blue rectangle to automatically scroll through the document.

Sort Bookmarks Menu
By creation

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

By position

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

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.

KatePart 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. With the New and Delete button you can create a new scheme or delete existing ones.

At the bottom of the page you can select the Default schema for KatePart.

By default, KatePart will base its color scheme on the current KDE color scheme. You can reset an individual color back to default by clicking the reset arrow to the right of the entry in the color editor, or you can reset all colors back to default by clicking the Use KDE Color Scheme at the bottom of the panel.

Tip

You can adjust the KDE color scheme in the Colors module in System Settings.

Colors

Editor Background Colors
Text Area

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.

Search Highlight

Set the color for the text that matches your last search.

Replace Highlight

Set the color for the text that matches your last replace operation.

Icon Border
Background Area

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.

Word Wrap Marker

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.

Code Folding

This color is used to highlight the section of code that would be folded when you click on the code folding arrow to the left of a document. For more information, see the code folding documentation.

Modified Lines

This color is used to highlight to the left of a document lines that have been modified but not yet saved. For more information, see the section called “Line Modification Indicators”

Saved Lines

This color is used to highlight to the left of a document lines that have been modified this session and saved. For more information, see the section called “Line Modification Indicators”

Text Decorations
Spelling Mistake Line

This color is used to indicate spelling mistakes.

Tab and Space Markers

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

Indentation Line

This color is used to draw a line to the left of indented blocks, if that feature is enabled.

Bracket Highlight

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

Marker Colors
Bookmark

This color is used to indicate bookmarks. For more information, see the section called “Using Bookmarks”.

Active Breakpoint

This color is used by the GDB plugin to indicate an active breakpoint. For more information, see the GDB Plugin documentation.

Reached Breakpoint

This color is used by the GDB plugin to indicate a breakpoint you have reached while debugging. For more information, see the GDB Plugin documentation.

Disabled Breakpoint

This color is used by the GDB plugin to indicate an inactive breakpoint. For more information, see the GDB Plugin documentation.

Execution

This color is used by the GDB plugin the line presently being executed. For more information, see the GDB Plugin documentation.

Warning

This color is used by the build plugin to indicate a line that has caused a compiler warning. For more information, see the Build Plugin documentation.

Error

This color is used by the build plugin to indicate a line that has caused a compiler error. For more information, see the Build Plugin documentation.

Text Templates & Snippets
Background

This color is used by the Kate Snippets plugin to mark the background of a snippet.

Editable Placeholder

This color is used by the Kate Snippets plugin to mark a placeholder that you can click in to edit manually.

Focused Editable Placeholder

This color is used by the Kate Snippets plugin to mark the placeholder that you are presently editing.

Not Editable Placeholder

This color is used by the Kate Snippets plugin to mark a placeholder that cannot be edited manually, such as one that is automatically populated. For more information, see the Kate Snippets documentation.

Use KDE Color Scheme

Clicking this button will set all the above defined colors to match the current color scheme defined in KDE's System Settings. For more information, see the documentation for the Colors KDE Control Module.

If you do not use the KDE Plasma™ Workspaces, this button will have no effect, and may not be present.

Font

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.

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

Default Text Styles

The default 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 almost all of the text formats that KatePart 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, right-click 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, right-click 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.

Editing

General

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. KatePart 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 marker (if applicable)

If this option is checked, a vertical line will be drawn at the word wrap column as defined in the SettingsConfigure 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 Enable static word wrap option is selected this entry determines the length (in characters) at which the editor will automatically start a new line.

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.

Auto brackets

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

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

Copy and Paste
Copy/Cut the current line if no selection

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.

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 Page Up or Page Down key. If unselected the text cursor will maintain its relative position within the visible text in KatePart 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:

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.

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

Tabulators and Spaces

When this is enabled, the editor will insert spaces as describe above when indenting or pressing Tab at the beginning of a line, but insert tabulators when the Tab 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 Tab to align the current line in the current code block like in emacs, make Tab a shortcut to the action Align.

Always advance to the next tab position

If this option is selected, the Tab 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 Tab 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 Tab 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.

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 System Settings module Spell Checker.

Vi Input Mode

General
Let Vi commands override Kate shortcuts

When selected, Vi commands will override KatePart'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™, KatePart experiences poor performance when working with extremely long lines. For that reason, KatePart 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.

Advanced

Backup on Save

Backing up on save will cause KatePart 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.

Swap file options

KatePart is able to recover (most of) what was written after last save in case of a crash or power failure. A swap file (.swp.<filename>) is created after the first editing action on a document. If the user doesn’t save the changes and KatePart crashes, the swap file remains on the disk. When opening a file, KatePart 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.

KatePart 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 enabled, the swap files are saved in the same folder as the file. When Alternative Folder is chosen, swap files are created in the specified folder. This is useful for network file systems to avoid unnecessary network traffic.

Modes & 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 ToolsFiletypes

Section:

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

Variables:

This string allows you to configure KatePart's settings for the files selected by this mimetype using KatePart 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 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.

Download Highlighting Files...

Click this button to download new or updated syntax highlight descriptions from the KatePart website.