dwww Home | Show directory contents | Find package

<FILENAME filename="index.html"><html><head><title>The KatePart Handbook</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="description" content="KatePart is a fully featured editor component by KDE."><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="next" href="introduction.html" title="Chapter 1. Introduction"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> The <span class="application">KatePart</span> Handbook</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"></td><td class="upCell"> </td><td class="nextCell"><a accesskey="n" href="introduction.html">Next</a></td></tr></table></div><div id="contentBody"><div lang="en" class="book"><div class="titlepage"><div><div><h1 class="title"><a name="katepart"></a>The <span class="application">KatePart</span> Handbook</h1></div><div><div class="authorgroup"><p class="author"><span class="firstname">Thad</span> <span class="surname">McGinnis</span> <code class="email">&lt;ctmcginnis@compuserve.com&gt;</code></p><p class="author"><span class="firstname">Anne-Marie</span> <span class="surname">Mahfouf</span> <code class="email">&lt;annma@kde.org&gt;</code></p><p class="author"><span class="firstname">Anders</span> <span class="surname">Lund</span> <code class="email">&lt;anders@alweb.dk&gt;</code></p><p class="author"><span class="firstname">T.C.</span> <span class="surname">Hollingsworth</span> <code class="email">&lt;tchollingsworth@gmail.com&gt;</code></p><span class="othercredit"><span style="text-transform: capitalize">developer</span>: <span class="firstname">Christoph</span> <span class="surname">Cullmann</span><br></span><span class="othercredit"><span style="text-transform: capitalize">reviewer</span>: <span class="firstname">Lauri</span> <span class="surname">Watts</span><br></span></div></div><div>Revision <span class="releaseinfo"><span class="productname">Frameworks<br></span> 5.94 (<span class="date">2022-05-02</span>)</span></div><div><p class="copyright">Copyright © 2000, 2001 <span class="firstname">Thad</span> <span class="surname">McGinnis</span></p></div><div><p class="copyright">Copyright © 2005 <span class="firstname">Anne-Marie</span> <span class="surname">Mahfouf</span> <code class="email">&lt;annma@kde.org&gt;</code>, <span class="firstname">Anders</span> <span class="surname">Lund</span> <code class="email">&lt;anders@alweb.dk&gt;</code></p></div><div><p class="copyright">Copyright © 2011, 2012, 2013, 2014 <span class="firstname">T.C.</span> <span class="surname">Hollingsworth</span> <code class="email">&lt;tchollingsworth@gmail.com&gt;</code></p></div><div><p><a href="help:/kdoctools5-common/fdl-notice.html">Legal Notice</a></p></div><div><div><div class="abstract"><p><span class="application">KatePart</span> is a fully featured editor component by <span class="orgname">KDE</span>.</p></div></div></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="chapter"><a href="introduction.html">1. Introduction</a></span></dt><dt><span class="chapter"><a href="on-screen-fundamentals.html">2. Some Fundamentals</a></span></dt><dd><dl><dt><span class="sect1"><a href="on-screen-fundamentals.html#drag-and-drop">Drag and Drop</a></span></dt><dt><span class="sect1"><a href="keybindings.html">Shortcuts</a></span></dt></dl></dd><dt><span class="chapter"><a href="kate-part.html">3. Working with the <span class="application">KatePart</span> editor</a></span></dt><dd><dl><dt><span class="sect1"><a href="kate-part.html#kate-part-overview">Overview</a></span></dt><dt><span class="sect1"><a href="kate-part-navigation.html">Navigating in the Text</a></span></dt><dt><span class="sect1"><a href="kate-part-selection.html">Working with the Selection</a></span></dt><dd><dl><dt><span class="sect2"><a href="kate-part-selection.html#kate-part-selection-block">Using Block Selection</a></span></dt><dt><span class="sect2"><a href="kate-part-selection.html#kate-part-selection-overwrite">Using Overwrite Selection</a></span></dt><dt><span class="sect2"><a href="kate-part-selection.html#kate-part-selection-persistent">Using Persistent Selection</a></span></dt></dl></dd><dt><span class="sect1"><a href="kate-part-copy-and-paste.html">Copying and Pasting Text</a></span></dt><dt><span class="sect1"><a href="kate-part-find-replace.html">Finding and Replacing Text</a></span></dt><dd><dl><dt><span class="sect2"><a href="kate-part-find-replace.html#find-replace-bars">The Search and Replace Bars</a></span></dt><dt><span class="sect2"><a href="kate-part-find-replace.html#finding-text">Finding Text</a></span></dt><dt><span class="sect2"><a href="kate-part-find-replace.html#replacing-text">Replacing Text</a></span></dt></dl></dd><dt><span class="sect1"><a href="kate-part-bookmarks.html">Using Bookmarks</a></span></dt><dt><span class="sect1"><a href="kate-part-auto-wrap.html">Automatically Wrapping text</a></span></dt><dt><span class="sect1"><a href="kate-part-autoindent.html">Using automatic indenting</a></span></dt><dt><span class="sect1"><a href="kate-part-line-modification.html">Line Modification Indicators</a></span></dt><dt><span class="sect1"><a href="kate-part-scrollbar-minimap.html">The Scrollbar Minimap</a></span></dt><dt><span class="sect1"><a href="kate-part-multiple-cursors.html">Multiple cursors</a></span></dt><dd><dl><dt><span class="sect2"><a href="kate-part-multiple-cursors.html#kate-part-create-multiple-cursors">Creating multiple cursors</a></span></dt><dt><span class="sect2"><a href="kate-part-multiple-cursors.html#idm1460">Working with multiple cursors</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="the-menu-entries.html">4. The Menu Entries</a></span></dt><dd><dl><dt><span class="sect1"><a href="the-menu-entries.html#file-menu">The File Menu</a></span></dt><dt><span class="sect1"><a href="edit-menu.html">The Edit Menu</a></span></dt><dt><span class="sect1"><a href="selection-menu.html">The Selection Menu</a></span></dt><dt><span class="sect1"><a href="view-menu.html">The View Menu</a></span></dt><dt><span class="sect1"><a href="go-menu.html">The Go Menu</a></span></dt><dt><span class="sect1"><a href="tools-menu.html">The Tools Menu</a></span></dt><dt><span class="sect1"><a href="settings-help-menu.html">The Settings and Help Menu</a></span></dt></dl></dd><dt><span class="chapter"><a href="advanced-editing-tools.html">5. Advanced Editing Tools</a></span></dt><dd><dl><dt><span class="sect1"><a href="advanced-editing-tools.html#advanced-editing-tools-comment">Comment/Uncomment</a></span></dt><dt><span class="sect1"><a href="advanced-editing-tools-commandline.html">The Editor Component Command Line</a></span></dt><dd><dl><dt><span class="sect2"><a href="advanced-editing-tools-commandline.html#advanced-editing-tools-commandline-commands">Standard Command Line Commands</a></span></dt></dl></dd><dt><span class="sect1"><a href="advanced-editing-tools-code-folding.html">Using Code Folding</a></span></dt></dl></dd><dt><span class="chapter"><a href="dev.html">6. Extending <span class="application">KatePart</span></a></span></dt><dd><dl><dt><span class="sect1"><a href="dev.html#dev-intro">Introduction</a></span></dt><dt><span class="sect1"><a href="highlight.html">Working with Syntax Highlighting</a></span></dt><dd><dl><dt><span class="sect2"><a href="highlight.html#highlight-overview">Overview</a></span></dt><dt><span class="sect2"><a href="highlight.html#katehighlight-system">The <span class="application">KatePart</span> Syntax Highlight System</a></span></dt><dt><span class="sect2"><a href="highlight.html#katehighlight-xml-format">The Highlight Definition <acronym class="acronym">XML</acronym> Format</a></span></dt><dt><span class="sect2"><a href="highlight.html#kate-highlight-rules-detailled">Highlight Detection Rules</a></span></dt></dl></dd><dt><span class="sect1"><a href="color-themes.html">Working with Color Themes</a></span></dt><dd><dl><dt><span class="sect2"><a href="color-themes.html#color-themes-overview">Overview</a></span></dt><dt><span class="sect2"><a href="color-themes.html#color-themes-ksyntaxhighlighting">The KSyntaxHighlighting Color Themes</a></span></dt><dt><span class="sect2"><a href="color-themes.html#color-themes-json">The Color Themes <acronym class="acronym">JSON</acronym> Format</a></span></dt><dt><span class="sect2"><a href="color-themes.html#color-themes-editing">Colors in Detail</a></span></dt><dt><span class="sect2"><a href="color-themes.html#color-themes-gui">The Color Themes <acronym class="acronym">GUI</acronym></a></span></dt><dt><span class="sect2"><a href="color-themes.html#color-themes-tips-and-tricks">Tips &amp; Tricks</a></span></dt></dl></dd><dt><span class="sect1"><a href="dev-scripting.html">Scripting with <span class="application">JavaScript</span></a></span></dt><dd><dl><dt><span class="sect2"><a href="dev-scripting.html#dev-scripting-indentation">Indentation Scripts</a></span></dt><dt><span class="sect2"><a href="dev-scripting.html#dev-scripting-command-line">Command Line Scripts</a></span></dt><dt><span class="sect2"><a href="dev-scripting.html#dev-scripting-api">Scripting API</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="config-dialog.html">7. Configure <span class="application">KatePart</span></a></span></dt><dd><dl><dt><span class="sect1"><a href="config-dialog.html#config-dialog-editor">The Editor Component Configuration</a></span></dt><dd><dl><dt><span class="sect2"><a href="config-dialog.html#appearance">Appearance</a></span></dt><dt><span class="sect2"><a href="config-dialog.html#prefcolors">Color Themes</a></span></dt><dt><span class="sect2"><a href="config-dialog.html#pref-edit">Editing</a></span></dt><dt><span class="sect2"><a href="config-dialog.html#pref-open-save">Open/Save</a></span></dt></dl></dd><dt><span class="sect1"><a href="config-variables.html">Configuring With Document Variables</a></span></dt><dd><dl><dt><span class="sect2"><a href="config-variables.html#config-variables-howto">How <span class="application">KatePart</span> uses Variables</a></span></dt><dt><span class="sect2"><a href="config-variables.html#config-variables-list">Available Variables</a></span></dt><dt><span class="sect2"><a href="config-variables.html#kateconfig-extended-options">Extended Options in <code class="filename">.kateconfig</code> files</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="credits.html">8. Credits and License</a></span></dt><dt><span class="chapter"><a href="vi-input-mode-chapter.html">9. The VI Input Mode</a></span></dt><dd><dl><dt><span class="sect1"><a href="vi-input-mode-chapter.html#vi-mode-sect1">VI Input Mode</a></span></dt><dd><dl><dt><span class="sect2"><a href="vi-input-mode-chapter.html#vi-incompatibilities">Incompatibilities with Vim</a></span></dt><dt><span class="sect2"><a href="vi-input-mode-chapter.html#vi-switching-modes">Switching Modes</a></span></dt><dt><span class="sect2"><a href="vi-input-mode-chapter.html#vi-integration">Integration with <span class="application">Kate</span> features</a></span></dt><dt><span class="sect2"><a href="vi-input-mode-chapter.html#vi-normal-visual-mode-commands">Supported normal/visual mode commands</a></span></dt><dt><span class="sect2"><a href="vi-input-mode-chapter.html#vi-supported-motions">Supported motions</a></span></dt><dt><span class="sect2"><a href="vi-input-mode-chapter.html#vi-supported-text-objects">Supported text objects</a></span></dt><dt><span class="sect2"><a href="vi-input-mode-chapter.html#vi-insert-mode-commands">Supported insert mode commands</a></span></dt><dt><span class="sect2"><a href="vi-input-mode-chapter.html#vi-text-object">The Comma Text Object</a></span></dt><dt><span class="sect2"><a href="vi-input-mode-chapter.html#vi-missing-features">Missing Features</a></span></dt></dl></dd></dl></dd><dt><span class="appendix"><a href="regular-expressions.html">A. Regular Expressions</a></span></dt><dd><dl><dt><span class="sect1"><a href="regular-expressions.html#idm10001">Introduction</a></span></dt><dt><span class="sect1"><a href="regex-patterns.html">Patterns</a></span></dt><dd><dl><dt><span class="sect2"><a href="regex-patterns.html#idm10059">Escaping characters</a></span></dt><dt><span class="sect2"><a href="regex-patterns.html#idm10070">Character Classes and abbreviations</a></span></dt><dt><span class="sect2"><a href="regex-patterns.html#idm10240">Alternatives: matching <span class="quote">“<span class="quote">one of</span>”</span></a></span></dt><dt><span class="sect2"><a href="regex-patterns.html#idm10249">Sub Patterns</a></span></dt><dt><span class="sect2"><a href="regex-patterns.html#special-characters-in-patterns">Characters with a special meaning inside patterns</a></span></dt></dl></dd><dt><span class="sect1"><a href="quantifiers.html">Quantifiers</a></span></dt><dd><dl><dt><span class="sect2"><a href="quantifiers.html#idm10425">Greed</a></span></dt><dt><span class="sect2"><a href="quantifiers.html#idm10432">In context examples</a></span></dt></dl></dd><dt><span class="sect1"><a href="assertions.html">Assertions</a></span></dt></dl></dd></dl></div><div class="list-of-examples"><p><b>List of Examples</b></p><dl><dt>5.1. <a href="advanced-editing-tools-commandline.html#idm3302"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command">char</span></span> examples</a></dt><dt>5.2. <a href="advanced-editing-tools-commandline.html#idm3336">Replacing text in the current line</a></dt><dt>5.3. <a href="advanced-editing-tools-commandline.html#idm3344">Replacing text in the whole file</a></dt><dt>5.4. <a href="advanced-editing-tools-commandline.html#idm3353">A More Advanced Example</a></dt><dt>5.5. <a href="advanced-editing-tools-commandline.html#idm3394"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command">sort</span></span> vs. <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command">natsort</span></span></a></dt><dt>5.6. <a href="advanced-editing-tools-commandline.html#idm3479">Join selected lines</a></dt><dt>5.7. <a href="advanced-editing-tools-commandline.html#idm3496">Remove blank lines</a></dt><dt>5.8. <a href="advanced-editing-tools-commandline.html#idm3513">Remove blank lines</a></dt></dl></div><FILENAME filename="introduction.html"><html><head><title>Chapter 1. Introduction</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="index.html" title="The KatePart Handbook"><link rel="prev" href="index.html" title="The KatePart Handbook"><link rel="next" href="on-screen-fundamentals.html" title="Chapter 2. Some Fundamentals"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Introduction</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="index.html">Prev</a></td><td class="upCell"> </td><td class="nextCell"><a accesskey="n" href="on-screen-fundamentals.html">Next</a></td></tr></table></div><div id="contentBody"><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="introduction"></a>Chapter 1. Introduction</h1></div></div></div><p>
<span class="application">KatePart</span> is a fully featured text editor component used by many <span class="trademark">Qt</span>™ and <span class="orgname">KDE</span>
applications.
<span class="application">KatePart</span> is more than a text editor; it is meant to be a programmer's editor,
and could be considered as at least a partial alternative to more powerful
editors. One of <span class="application">KatePart</span>'s main features is the colorized syntax, customized
for many different programming languages such as: C/C++, <span class="trademark">Java</span>™, Python, Perl,
Bash, Modula 2, <acronym class="acronym">HTML</acronym>, and Ada.
</p><p><span class="application">KWrite</span> is a simple text editor application based on <span class="application">KatePart</span>.  It has
a single document interface (<acronym class="acronym">SDI</acronym>) allowing you to edit one
file at the time per window.  Since <span class="application">KWrite</span> is a very simple implementation of
<span class="application">KatePart</span>, it does not require its own documentation.  If you know how to use
<span class="application">KWrite</span>, you can use <span class="application">KatePart</span> anywhere!
</p></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="index.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="on-screen-fundamentals.html">Next</a></td></tr><tr><td class="prevCell">The <span class="application">KatePart</span> Handbook </td><td class="upCell"> </td><td class="nextCell"> Some Fundamentals</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="on-screen-fundamentals.html"><html><head><title>Chapter 2. Some Fundamentals</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="index.html" title="The KatePart Handbook"><link rel="prev" href="introduction.html" title="Chapter 1. Introduction"><link rel="next" href="keybindings.html" title="Shortcuts"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Some Fundamentals</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="introduction.html">Prev</a></td><td class="upCell"> </td><td class="nextCell"><a accesskey="n" href="keybindings.html">Next</a></td></tr></table></div><div id="contentBody"><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="on-screen-fundamentals"></a>Chapter 2. Some Fundamentals</h1></div></div></div><p>
<span class="application">KWrite</span> and many other <span class="application">KatePart</span> users are very simple to use. Anyone that has
used a text editor should have no problems.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="drag-and-drop"></a>Drag and Drop</h2></div></div></div><p>
<span class="application">KatePart</span> uses the <span class="orgname">KDE</span> Drag and Drop protocol. Files may be dragged and
dropped onto <span class="application">KatePart</span> from the Desktop, the filemanager <span class="application">Dolphin</span>, or some
remote <acronym class="acronym">FTP</acronym> site opened in one of <span class="application">Dolphin</span>'s windows.
</p></div><FILENAME filename="keybindings.html"><html><head><title>Shortcuts</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="on-screen-fundamentals.html" title="Chapter 2. Some Fundamentals"><link rel="prev" href="on-screen-fundamentals.html" title="Chapter 2. Some Fundamentals"><link rel="next" href="kate-part.html" title="Chapter 3. Working with the KatePart editor"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Shortcuts</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="on-screen-fundamentals.html">Prev</a></td><td class="upCell">Some Fundamentals</td><td class="nextCell"><a accesskey="n" href="kate-part.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="keybindings"></a>Shortcuts</h2></div></div></div><p>Many of the shortcuts are configurable by way of the <a class="link" href="settings-help-menu.html" title="The Settings and Help Menu">Settings</a> menu.  By default <span class="application">KatePart</span> honors the
following shortcuts:</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col><col></colgroup><tbody><tr><td><p><span class="keycap"><strong>Ins</strong></span></p></td><td><p>
Toggle between Insert and Overwrite mode. When in insert mode the
editor will add any typed characters to the text while pushing along any data to
the right of the text cursor. Overwrite mode causes the entry of each character
to eliminate the character immediately to the right of the text
cursor.</p></td></tr><tr><td><p><span class="keysym">Left</span></p></td><td><p>Move the cursor one character to the left.</p></td></tr><tr><td><p><span class="keysym">Right</span></p></td><td><p>Move the cursor one character to the right.</p></td></tr><tr><td><p><span class="keysym">Up</span></p></td><td><p>Move the cursor up one line.</p></td></tr><tr><td><p><span class="keysym">Down</span></p></td><td><p>Move the cursor down one line.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>E</strong></span></p></td><td><p>Go to previous edit location in document.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>E</strong></span></p></td><td><p>Go to next edit location in document.</p></td></tr><tr><td><p><span class="keycap"><strong>Alt</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keysym">Up</span></p></td><td><p>Move cursor to previous matching indent.</p></td></tr><tr><td><p><span class="keycap"><strong>Alt</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keysym">Down</span></p></td><td><p>Move cursor to previous matching indent.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>6</strong></span></p></td><td><p>Move to Matching Bracket.</p></td></tr><tr><td><p><span class="keysym">PgUp</span></p></td><td><p>Move the cursor up one page.</p></td></tr><tr><td><p><span class="keysym">PgDn</span></p></td><td><p>Move the cursor down one page.</p></td></tr><tr><td><p><span class="keycap"><strong>Home</strong></span></p></td><td><p>Move the cursor to the beginning of the line.</p></td></tr><tr><td><p><span class="keycap"><strong>End</strong></span></p></td><td><p>Move the cursor to the end of the line.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Home</strong></span></p></td><td><p>Move to Beginning of Document.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>End</strong></span></p></td><td><p>Move to End of Document.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keysym">Up</span></p></td><td><p>Scroll Line Up.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keysym">Down</span></p></td><td><p>Scroll Line Down.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keysym">Right</span></p></td><td><p>Move Word Right.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keysym">Left</span></p></td><td><p>Move Word Left.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keysym">Up</span></p></td><td><p>Move Lines Up.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keysym">Down</span></p></td><td><p>Move Lines Down.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>.</strong></span></p></td><td><p>Duplicate Selected Lines Down.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>B</strong></span></p></td><td><p>Set a Bookmark.</p></td></tr><tr><td><p><span class="keycap"><strong>Alt</strong></span>+<span class="keysym">PgUp</span></p></td><td><p>Previous Bookmark.</p></td></tr><tr><td><p><span class="keycap"><strong>Alt</strong></span>+<span class="keysym">PgDn</span></p></td><td><p>Next Bookmark.</p></td></tr><tr><td><p><span class="keycap"><strong>Del</strong></span></p></td><td><p>Delete the character to the right of the cursor (or any selected
text).</p></td></tr><tr><td><p><span class="keysym">Backspace</span></p></td><td><p>Delete the character to the left of the cursor.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Del</strong></span></p></td><td><p>Delete Right Word.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keysym">Backspace</span></p></td><td><p>Delete Left Word.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>K</strong></span></p></td><td><p>Delete Line.</p></td></tr><tr><td><p><span class="keycap"><strong>Shift</strong></span>+<span class="keysym">Enter</span></p></td><td><p>Insert newline including leading characters of the current line which are not letters or numbers.
It is useful <abbr class="abbrev">e.g.</abbr> to write comments in the code: At the end of the line <span class="quote">“<span class="quote">// some text</span>”</span> press
this shortcut and the next line starts already with <span class="quote">“<span class="quote">// </span>”</span>. So you do not have to enter the comment
characters at the beginning of each new line with comments.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keysym">Enter</span></p></td><td><p>Create a new line below current line.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Alt</strong></span>+<span class="keysym">Enter</span></p></td><td><p>Create a new line above current line.</p></td></tr><tr><td><p><span class="keycap"><strong>Shift</strong></span>+<span class="keysym">Left</span></p></td><td><p>Mark text one character to the left.</p></td></tr><tr><td><p><span class="keycap"><strong>Shift</strong></span>+<span class="keysym">Right</span></p></td><td><p>Mark text one character to the right.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>F</strong></span></p></td><td><p><a class="link" href="edit-menu.html#edit-find">Find</a>.</p></td></tr><tr><td><p><span class="keycap"><strong>F3</strong></span></p></td><td><p><a class="link" href="edit-menu.html#edit-find-next">Find Next</a>.</p></td></tr><tr><td><p><span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>F3</strong></span></p></td><td><p><a class="link" href="edit-menu.html#edit-find-previous">Find Previous</a>.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>H</strong></span></p></td><td><p><a class="link" href="edit-menu.html#edit-find-selected">Find Selected</a>.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>H</strong></span></p></td><td><p><a class="link" href="edit-menu.html#edit-find-selected-backwards">Find Selected Backwards</a>.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keysym">Right</span></p></td><td><p>Select Word Right.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keysym">Left</span></p></td><td><p>Select Word Left.</p></td></tr><tr><td><p><span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>Home</strong></span></p></td><td><p>Select to Beginning of Line.</p></td></tr><tr><td><p><span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>End</strong></span></p></td><td><p>Select to End of Line.</p></td></tr><tr><td><p><span class="keycap"><strong>Shift</strong></span>+<span class="keysym">Up</span></p></td><td><p>Select to Previous Line.</p></td></tr><tr><td><p><span class="keycap"><strong>Shift</strong></span>+<span class="keysym">Down</span></p></td><td><p>Select to Next Line.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>6</strong></span></p></td><td><p>Select to Matching Bracket.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keysym">PgUp</span></p></td><td><p>Select to Top of View.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keysym">PgDn</span></p></td><td><p>Select to Bottom of View.</p></td></tr><tr><td><p><span class="keycap"><strong>Shift</strong></span>+<span class="keysym">PgUp</span></p></td><td><p>Select Page Up.</p></td></tr><tr><td><p><span class="keycap"><strong>Shift</strong></span>+<span class="keysym">PgDn</span></p></td><td><p>Select Page Down.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>Home</strong></span></p></td><td><p>Select to Beginning of Document.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>End</strong></span></p></td><td><p>Select to End of Document.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Home</strong></span></p></td><td><p>Select All.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>A</strong></span></p></td><td><p>Deselect.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>B</strong></span></p></td><td><p>Block Selection Mode.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>C</strong></span> / <span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Ins</strong></span></p></td><td><p>Copy the marked text to the clipboard.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>D</strong></span></p></td><td><p>Comment.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>D</strong></span></p></td><td><p>Uncomment.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>G</strong></span></p></td><td><p>Go to line...</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>I</strong></span></p></td><td><p>Indent selection.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>I</strong></span></p></td><td><p>Unindent selection.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>J</strong></span></p></td><td><p>Join Lines.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>P</strong></span></p></td><td><p><a class="link" href="the-menu-entries.html#file-print">Print</a>.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>R</strong></span></p></td><td><p><a class="link" href="edit-menu.html#edit-replace">Replace</a>.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>S</strong></span></p></td><td><p>Invokes the <a class="link" href="the-menu-entries.html#file-save"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Save</span></span></a> command.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>S</strong></span></p></td><td><p>Save As.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>U</strong></span></p></td><td><p>Uppercase.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>U</strong></span></p></td><td><p>Lowercase.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Alt</strong></span>+<span class="keycap"><strong>U</strong></span></p></td><td><p>Capitalize.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>V</strong></span> / <span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>Ins</strong></span></p></td><td><p>Paste the clipboard text into line edit.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>X</strong></span> / <span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>Ins</strong></span></p></td><td><p>Delete the marked text and copy it to the clipboard.
</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Z</strong></span></p></td><td><p><a class="link" href="edit-menu.html#edit-undo">Undo</a>.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>Z</strong></span></p></td><td><p><a class="link" href="edit-menu.html#edit-redo">Redo</a>.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>-</strong></span></p></td><td><p>Shrink Font.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>+</strong></span><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>=</strong></span></p></td><td><p>Enlarge Font.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>-</strong></span></p></td><td><p>Fold Toplevel Nodes.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>+</strong></span></p></td><td><p>Unfold Toplevel Nodes.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keysym">Space</span></p></td><td><p>Invoke Code Completion.</p></td></tr><tr><td><p><span class="keycap"><strong>F5</strong></span></p></td><td><p><a class="link" href="the-menu-entries.html#file-reload"> Reload</a>.</p></td></tr><tr><td><p><span class="keycap"><strong>F6</strong></span></p></td><td><p>Show/Hide Icon Border.</p></td></tr><tr><td><p><span class="keycap"><strong>F7</strong></span></p></td><td><p>Switch to Command Line.</p></td></tr><tr><td><p><span class="keycap"><strong>F9</strong></span></p></td><td><p>Show/Hide Folding Markers.</p></td></tr><tr><td><p><span class="keycap"><strong>F10</strong></span></p></td><td><p>Dynamic Word Wrap.</p></td></tr><tr><td><p><span class="keycap"><strong>F11</strong></span></p></td><td><p>Show/Hide Line Numbers.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>T</strong></span></p></td><td><p>Transpose Characters.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>O</strong></span></p></td><td><p>Automatic Spell Checking.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>V</strong></span></p></td><td><p>Switch to Next Input Mode.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>8</strong></span></p></td><td><p>Reuse Word Above.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>9</strong></span></p></td><td><p>Reuse Word Below.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Alt</strong></span>+<span class="keycap"><strong>#</strong></span></p></td><td><p>Expand Abbreviation.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Alt</strong></span>+<span class="keysym">Up</span></p></td><td><p>Add a cursor above current cursor.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Alt</strong></span>+<span class="keysym">Down</span></p></td><td><p>Add a cursor below current cursor.</p></td></tr><tr><td><p><span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>Alt</strong></span>+<span class="keycap"><strong>I</strong></span></p></td><td><p>Create a cursor at the end of each line in selection.</p></td></tr><tr><td><p><span class="keycap"><strong>Alt</strong></span>+<span class="keycap"><strong>J</strong></span></p></td><td><p>Find next occurrence of the word under cursor and select it.</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Alt</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>J</strong></span></p></td><td><p>Find all occurrences of the word under cursor and select them.</p></td></tr></tbody></table></div></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="on-screen-fundamentals.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="kate-part.html">Next</a></td></tr><tr><td class="prevCell">Some Fundamentals </td><td class="upCell">Some Fundamentals</td><td class="nextCell"> Working with the <span class="application">KatePart</span> editor</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="introduction.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="keybindings.html">Next</a></td></tr><tr><td class="prevCell">Introduction </td><td class="upCell"> </td><td class="nextCell"> Shortcuts</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="kate-part.html"><html><head><title>Chapter 3. Working with the KatePart editor</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="index.html" title="The KatePart Handbook"><link rel="prev" href="keybindings.html" title="Shortcuts"><link rel="next" href="kate-part-navigation.html" title="Navigating in the Text"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Working with the <span class="application">KatePart</span> editor</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="keybindings.html">Prev</a></td><td class="upCell"> </td><td class="nextCell"><a accesskey="n" href="kate-part-navigation.html">Next</a></td></tr></table></div><div id="contentBody"><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="kate-part"></a>Chapter 3. Working with the <span class="application">KatePart</span> editor</h1></div><div><div class="authorgroup"><p class="author"><span class="firstname">Anders</span> <span class="surname">Lund</span> <code class="email">&lt;anders@alweb.dk&gt;</code></p><p class="author"><span class="firstname">Dominik</span> <span class="surname">Haumann</span> <code class="email">&lt;dhdev@gmx.de&gt;</code></p></div></div></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="kate-part-overview"></a>Overview</h2></div></div></div><p>The <span class="application">KatePart</span> editor is the editing area of the <span class="application">KatePart</span> window. This
editor is shared between <span class="application">Kate</span> and <span class="application">KWrite</span>, and it can also be used in <span class="application">Konqueror</span>
for displaying text files from your local computer, or from the
network.</p><p>The editor is composed of the following components:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">The editing area</span></dt><dd><p>This is where the text of your document is located.</p></dd><dt><span class="term">The Scrollbars</span></dt><dd><p>The scrollbars indicate the  position of the visible part of
the document text, and can be used to move around the
document. Dragging the scrollbars will not cause the insertion cursor
to be moved.</p><p>The scrollbars are displayed and hidden as required.</p></dd><dt><span class="term">The Icon Border</span></dt><dd><p>The icon border is a small pane on the left side of the editor,
displaying a small icon next to marked lines.</p><p>You can set or remove a <a class="link" href="kate-part-bookmarks.html" title="Using Bookmarks">bookmark</a> in a visible line by
clicking the <span class="mousebutton">left</span> mouse button in the icon border next to that line.</p><p>The display of the icon border can be toggled using the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">View</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Show Icon
Border</span></span> menu item.</p></dd><dt><span class="term">The Line Numbers Pane</span></dt><dd><p>The Line numbers pane shows the line numbers of all visible
lines in the document.</p><p>The display of the Line Numbers Pane can be toggled using the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">View</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Show Line
Numbers</span></span> menu item.</p></dd><dt><span class="term">The Folding Pane</span></dt><dd><p>The folding pane allows you to collapse or expand foldable blocks
of lines. The calculation of the foldable regions is done according to
rules in the syntax highlight definition for the document.</p></dd></dl></div><div class="itemizedlist"><p class="title"><b>Also in this Chapter:</b></p><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><a class="link" href="kate-part-navigation.html" title="Navigating in the Text">Navigating in the
Text</a> </p></li><li class="listitem"><p><a class="link" href="kate-part-selection.html" title="Working with the Selection">Working with the
Selection</a></p></li><li class="listitem"><p><a class="link" href="kate-part-copy-and-paste.html" title="Copying and Pasting Text">Copying and
Pasting Text</a></p></li><li class="listitem"><p><a class="link" href="kate-part-find-replace.html" title="Finding and Replacing Text">Finding and
Replacing Text</a></p></li><li class="listitem"><p><a class="link" href="kate-part-bookmarks.html" title="Using Bookmarks">Using
Bookmarks</a></p></li><li class="listitem"><p><a class="link" href="kate-part-auto-wrap.html" title="Automatically Wrapping text">Automatically
Wrapping Text</a></p></li><li class="listitem"><p><a class="link" href="kate-part-autoindent.html" title="Using automatic indenting">Using automatic indenting</a></p></li></ul></div></div><FILENAME filename="kate-part-navigation.html"><html><head><title>Navigating in the Text</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="kate-part.html" title="Chapter 3. Working with the KatePart editor"><link rel="prev" href="kate-part.html" title="Chapter 3. Working with the KatePart editor"><link rel="next" href="kate-part-selection.html" title="Working with the Selection"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Navigating in the Text</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part.html">Prev</a></td><td class="upCell">Working with the <span class="application">KatePart</span> editor</td><td class="nextCell"><a accesskey="n" href="kate-part-selection.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="kate-part-navigation"></a>Navigating in the Text</h2></div></div></div><p>Moving around in the text in <span class="application">KatePart</span> is similar to most graphical text
editors. You move the cursor using the arrow keys and the
<span class="keysym">PgUp</span>, <span class="keysym">PgDn</span>, <span class="keycap"><strong>Home</strong></span> and <span class="keycap"><strong>End</strong></span> keys in combination with the <span class="keycap"><strong>Ctrl</strong></span> and
<span class="keycap"><strong>Shift</strong></span> modifiers. The <span class="keycap"><strong>Shift</strong></span> key is always used
to generate a selection, while the <span class="keycap"><strong>Ctrl</strong></span> key has different
effects on different keys:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>For the <span class="keysym">Up</span> and <span class="keysym">Down</span> keys it
means scroll rather than move the cursor.</p></li><li class="listitem"><p>For the <span class="keysym">Left</span> and <span class="keysym">Right</span>
keys it means skip words rather than characters.</p></li><li class="listitem"><p>For the <span class="keysym">PgUp</span> and <span class="keysym">PgDn</span>
keys it means move to the visible edge of the view rather than browse.</p></li><li class="listitem"><p>For the <span class="keycap"><strong>Home</strong></span> and <span class="keycap"><strong>End</strong></span> keys it means move to the beginning or
end of the document rather than the beginning or end of the line.</p></li></ul></div><p>
</p><p><span class="application">KatePart</span> also provides you with a way to quickly jump to a matching brace
or parenthesis: place the cursor on the inside of a parenthesis or brace
character, and press <span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>6</strong></span>
to jump to the matching parenthesis or brace.</p><p>In addition you can use
<a class="link" href="kate-part-bookmarks.html" title="Using Bookmarks">bookmarks</a> to quickly jump to
positions that you define on your own.</p></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="kate-part-selection.html">Next</a></td></tr><tr><td class="prevCell">Working with the <span class="application">KatePart</span> editor </td><td class="upCell">Working with the <span class="application">KatePart</span> editor</td><td class="nextCell"> Working with the Selection</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="kate-part-selection.html"><html><head><title>Working with the Selection</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="kate-part.html" title="Chapter 3. Working with the KatePart editor"><link rel="prev" href="kate-part-navigation.html" title="Navigating in the Text"><link rel="next" href="kate-part-copy-and-paste.html" title="Copying and Pasting Text"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Working with the Selection</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part-navigation.html">Prev</a></td><td class="upCell">Working with the <span class="application">KatePart</span> editor</td><td class="nextCell"><a accesskey="n" href="kate-part-copy-and-paste.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="kate-part-selection"></a>Working with the Selection</h2></div></div></div><p>There are two basic ways of selecting text in <span class="application">KatePart</span>: using the
mouse, and using the keyboard.</p><p>To select using the mouse, hold down the <span class="mousebutton">left</span> mouse button while dragging
the mouse cursor from where the selection should start, to the desired
end point. The text gets selected as you drag.</p><p>Double-clicking a word will select that word.</p><p>Triple-clicking in a line will select the entire line.</p><p>If <span class="keycap"><strong>Shift</strong></span> is held down while clicking, text will be
selected:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>If nothing is already selected, from the text cursor
position to the mouse cursor position.</p></li><li class="listitem"><p>If there is a selection, from and including that
selection to the mouse cursor position.</p></li></ul></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>When selecting text by dragging the mouse, the
selected text is copied to the clipboard, and can be pasted by
clicking the middle mouse button in the editor, or in any other
application to which you want to paste the text.
</p></div><p>To select using the keyboard, hold down the <span class="keycap"><strong>Shift</strong></span> key while
using the navigation keys (Arrow keys, <span class="keysym">PgUp</span>, <span class="keysym">PgDn</span>, <span class="keycap"><strong>Home</strong></span> and
<span class="keycap"><strong>End</strong></span>, possibly in combination with <span class="keycap"><strong>Ctrl</strong></span> to extend
the move of the text cursor).</p><p>See also the section <a class="link" href="kate-part-navigation.html" title="Navigating in the Text">Navigating in the Text</a> in this
chapter.</p><p>To <span class="action">Copy</span> the current selection, use the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Copy</span></span> menu item or the keyboard
shortcut (defaults to <span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>C</strong></span>).</p><p>To <span class="action">Deselect</span> the current selection, use the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Deselect</span></span> menu item, or the
keyboard shortcut (default is <span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>A</strong></span>), or click
with the <span class="mousebutton">left</span> mouse button in the editor.</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="kate-part-selection-block"></a>Using Block Selection</h3></div></div></div><p>When Block Selection is enabled, you can make <span class="quote">“<span class="quote">vertical
selections</span>”</span> in the text, meaning selecting limited columns from
multiple lines. This is handy for working with tab separated lines for
example.</p><p>Block Selection can be toggled using the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Block
Selection Mode</span></span> menu item. The default keyboard
shortcut is <span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>B</strong></span>.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="kate-part-selection-overwrite"></a>Using Overwrite Selection</h3></div></div></div><p>If Overwrite Selection is enabled, typing or pasting text into
the selection will cause the selected text to be replaced. If not
enabled, new text will be added at the position of the text
cursor.</p><p>Overwrite Selection is enabled by default.</p><p>To change the setting for this option, use the <a class="link" href="config-dialog.html#pref-edit-cursor-selection" title="Text Navigation">Cursor &amp; Selection</a> page of the <a class="link" href="config-dialog.html" title="Chapter 7. Configure KatePart">Configuration Dialog</a>.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="kate-part-selection-persistent"></a>Using Persistent Selection</h3></div></div></div><p>When Persistent Selection is enabled, typing characters or
moving the cursor will not cause the Selection to become
deselected. This means that you can move the cursor away from the
selection and type text.</p><p>Persistent Selection is disabled by default.</p><p>Persistent Selection can be enabled in the <a class="link" href="config-dialog.html#pref-edit-cursor-selection" title="Text Navigation">Cursor &amp; Selection</a> page of the <a class="link" href="config-dialog.html" title="Chapter 7. Configure KatePart">Configuration Dialog</a>.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>If Persistent Selection and Overwrite Selection are both
enabled, typing or pasting text when the text cursor is inside the
selection will cause it to be replaced and deselected.</p></div></div></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part-navigation.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="kate-part-copy-and-paste.html">Next</a></td></tr><tr><td class="prevCell">Navigating in the Text </td><td class="upCell">Working with the <span class="application">KatePart</span> editor</td><td class="nextCell"> Copying and Pasting Text</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="kate-part-copy-and-paste.html"><html><head><title>Copying and Pasting Text</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="kate-part.html" title="Chapter 3. Working with the KatePart editor"><link rel="prev" href="kate-part-selection.html" title="Working with the Selection"><link rel="next" href="kate-part-find-replace.html" title="Finding and Replacing Text"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Copying and Pasting Text</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part-selection.html">Prev</a></td><td class="upCell">Working with the <span class="application">KatePart</span> editor</td><td class="nextCell"><a accesskey="n" href="kate-part-find-replace.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="kate-part-copy-and-paste"></a>Copying and Pasting Text</h2></div></div></div><p>To copy text, select it and use the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Copy</span></span> menu item. Additionally,
selecting text with the mouse will cause selected text to be copied to
the X selection.</p><p>To paste the text currently in the clipboard, use the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Paste</span></span>
menu item.</p><p>Additionally, text selected with the mouse may be pasted by
clicking the <span class="mousebutton">middle</span> mouse button at the desired position.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><p>If you are using the <span class="orgname">KDE</span> desktop, you can retrieve earlier
copied text from any application using the <span class="application">Klipper</span> icon in the
system tray.</p></div></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part-selection.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="kate-part-find-replace.html">Next</a></td></tr><tr><td class="prevCell">Working with the Selection </td><td class="upCell">Working with the <span class="application">KatePart</span> editor</td><td class="nextCell"> Finding and Replacing Text</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="kate-part-find-replace.html"><html><head><title>Finding and Replacing Text</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="kate-part.html" title="Chapter 3. Working with the KatePart editor"><link rel="prev" href="kate-part-copy-and-paste.html" title="Copying and Pasting Text"><link rel="next" href="kate-part-bookmarks.html" title="Using Bookmarks"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Finding and Replacing Text</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part-copy-and-paste.html">Prev</a></td><td class="upCell">Working with the <span class="application">KatePart</span> editor</td><td class="nextCell"><a accesskey="n" href="kate-part-bookmarks.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="kate-part-find-replace"></a>Finding and Replacing Text</h2></div></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="find-replace-bars"></a>The Search and Replace Bars</h3></div></div></div><p><span class="application">KatePart</span> has an incremental search bar and a power search and
replace bar, which  offers the means of entering a
replacement string along with a few extra options.</p><p>The bars offer the following common options:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Find</span></span></span></dt><dd><p>This is where to enter the search string. The interpretation of the string
depends on some of the options described below.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Match case</span></span></span></dt><dd><p>If enabled, the search will be limited to entries that match the
case (upper or lower) of each of the characters in the search pattern.</p></dd></dl></div><p>The power search and replace bar offers some
additional options:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Plain Text</span></span></span></dt><dd><p>Literally match any occurrence of the search string.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Whole Words</span></span></span></dt><dd><p>If selected, the search will only match if there is a word
boundary at both ends of the string matching, meaning not an
alphanumeric character - either some other visible character or a line
end.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Escape Sequences</span></span></span></dt><dd><p>If selected, the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Add</span></span> menuitem at the
bottom of the context menu of the text boxes will be enabled
and allows you to add escape sequences to the
search pattern from a predefined list.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Regular Expression</span></span></span></dt><dd><p>If selected, the search string is interpreted as a regular
expression. The <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Add</span></span> menuitem at the
bottom of the context menu of the text boxes will be enabled
and allows you to add regular expression items to the
search pattern from a predefined list.</p><p>See <a class="link" href="regular-expressions.html" title="Appendix A. Regular Expressions">Regular
Expressions</a> for more on these.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Search in the selection only</span></span></span></dt><dd><p>If checked, the search and replace will be performed within
the selected text only.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Find all</span></span></span></dt><dd><p>Clicking this button highlights
all matches in the document and shows the number of found matches in a small popup.
</p></dd></dl></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="finding-text"></a>Finding Text</h3></div></div></div><p>To find text, launch the incremental search bar
with <span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>F</strong></span> or
from the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Find...</span></span> menu item.</p><p>This opens the incremental search bar at the bottom of the editor window.
On the left side of the bar is a button with an icon to close the bar, followed by a small text 
box for entering the search pattern.</p><p>When you start entering the characters of your search pattern, the search starts
immediately. If there is a match in the text this is highlighted and the background color
of the entry field changes to light green. If the search pattern does not match any
string in the text, this is indicated by a light red background color of the entry field.</p><p>Use the 
<span class="inlinemediaobject"><img src="arrow-up-double-22.png"></span> or
<span class="inlinemediaobject"><img src="arrow-down-double-22.png"></span> button
to jump to the next or previous match in the document.</p><p>Matches in the document are highlighted even when you close the search bar. To clear
this highlighting, press the <span class="keycap"><strong>Esc</strong></span> key.</p><p>You can choose whether the search should be case sensitive.
Selecting <span class="inlinemediaobject"><img src="format-text-superscript-22.png"></span>
will limit finds to entries that match the
case (upper or lower) of each of the characters in the search  pattern.</p><p>Click on the <span class="inlinemediaobject"><img src="configure-shortcuts-22.png"></span>
button at the right side of the incremental search bar to
switch to the power search and replace bar.
</p><p>
To repeat the last find operation, if any, without calling the incremental
search bar, use <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Find Next</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>F3</strong></span></strong></span>)
or
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Find Previous</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>F3</strong></span></strong></span>).
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="replacing-text"></a>Replacing Text</h3></div></div></div><p>To replace text, launch the power search and replace bar
using the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Replace</span></span> command, or the
<span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>R</strong></span> shortcut.</p><p>On the upper left side of the bar is a button with an icon to close the bar, followed by a small combo
box for entering the search pattern. The box remembers recently used patterns.</p><p>You can control the search mode by selecting the options <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Plain Text</span></span>,
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Whole Words</span></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Escape Sequences</span></span> or
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Regular Expression</span></span> from the drop down box.
</p><p>If <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Escape sequences</span></span> or <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Regular expression</span></span> are
selected, the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Add...</span></span> menuitem at the bottom of the context menu of the text boxes will be enabled
and allows you to add escape sequences or regular expression items to the
search or replace pattern from predefined lists.</p><p>Use the
<span class="inlinemediaobject"><img src="arrow-up-double-22.png"></span> or
<span class="inlinemediaobject"><img src="arrow-down-double-22.png"></span> button
to jump to the next or previous match in the document.</p><p>Enter the text to replace with in the text box labeled <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Replace</span></span>
and click the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Replace</span></span> button to replace only the highlighted text or
the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Replace All</span></span> button to replace the search text in the whole document.
</p><p>You can modify the search and replace behavior by selecting different
options at the bottom of the bar.
Selecting <span class="inlinemediaobject"><img src="format-text-superscript-22.png"></span>
will limit finds to entries that match the
case (upper or lower) of each of the characters in the search  pattern.
<span class="inlinemediaobject"><img src="edit-select-all-22.png"></span>
will search and replace within the current selection only.
The <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Find All</span></span> button highlights
all matches in the document and shows the number of found matches in a small popup.
</p><p>Click on the <span class="inlinemediaobject"><img src="configure-shortcuts-22.png"></span>
button at the right side of the power search and replace bar to
switch to the incremental search bar.
</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><p>If you are using a regular expression to find the text to replace, you can
employ backreferences to reuse text captured in parenthesized subpatterns of the expression.</p><p>See <a class="link" href="regular-expressions.html" title="Appendix A. Regular Expressions">Regular Expressions</a> for more
on those.</p></div><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><p>You can do <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>find</strong></span></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>replace</strong></span></span> and
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>ifind</strong></span></span> (incremental search) from the
<a class="link" href="advanced-editing-tools-commandline.html" title="The Editor Component Command Line">command line</a>.</p></div></div></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part-copy-and-paste.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="kate-part-bookmarks.html">Next</a></td></tr><tr><td class="prevCell">Copying and Pasting Text </td><td class="upCell">Working with the <span class="application">KatePart</span> editor</td><td class="nextCell"> Using Bookmarks</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="kate-part-bookmarks.html"><html><head><title>Using Bookmarks</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="kate-part.html" title="Chapter 3. Working with the KatePart editor"><link rel="prev" href="kate-part-find-replace.html" title="Finding and Replacing Text"><link rel="next" href="kate-part-auto-wrap.html" title="Automatically Wrapping text"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Using Bookmarks</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part-find-replace.html">Prev</a></td><td class="upCell">Working with the <span class="application">KatePart</span> editor</td><td class="nextCell"><a accesskey="n" href="kate-part-auto-wrap.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="kate-part-bookmarks"></a>Using Bookmarks</h2></div></div></div><p>The bookmarks feature allows you to mark certain lines, to be
able to easily find them again.</p><p>You can set or remove a bookmark in a line in two ways:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>Move the insertion cursor to the line and activate the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Bookmarks</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Set
Bookmark</span></span> (<span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>B</strong></span>) command.</p></li><li class="listitem"><p>Click in the Icon Border next to the line.</p></li></ul></div><p>Bookmarks are available in the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Bookmarks</span></span>
menu. The individual bookmarks are available as menu items, labeled
with the line number of the line with the bookmark, and the first few
characters of the text in the line. To move the insertion cursor to
the beginning of a bookmarked line, open the menu and select the
bookmark.</p><p>To quickly move between bookmarks or to the next/previous bookmark,
use the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Bookmarks</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Next</span></span> (<span class="keycap"><strong>Alt</strong></span>+<span class="keysym">PgDn</span>) or <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Bookmarks</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Previous</span></span>
(<span class="keycap"><strong>Alt</strong></span>+<span class="keysym">PgUp</span>) commands.</p></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part-find-replace.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="kate-part-auto-wrap.html">Next</a></td></tr><tr><td class="prevCell">Finding and Replacing Text </td><td class="upCell">Working with the <span class="application">KatePart</span> editor</td><td class="nextCell"> Automatically Wrapping text</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="kate-part-auto-wrap.html"><html><head><title>Automatically Wrapping text</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="kate-part.html" title="Chapter 3. Working with the KatePart editor"><link rel="prev" href="kate-part-bookmarks.html" title="Using Bookmarks"><link rel="next" href="kate-part-autoindent.html" title="Using automatic indenting"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Automatically Wrapping text</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part-bookmarks.html">Prev</a></td><td class="upCell">Working with the <span class="application">KatePart</span> editor</td><td class="nextCell"><a accesskey="n" href="kate-part-autoindent.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="kate-part-auto-wrap"></a>Automatically Wrapping text</h2></div></div></div><p>This feature allows you to have the text formatted in a very simple way: the text will be wrapped,
so that no lines exceed a maximum number of characters per line, unless there is a longer string of
non-whitespace characters.</p><p>To enable/disable it, check/uncheck the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Static Word Wrap</span></span> checkbox in the
<a class="link" href="config-dialog.html#pref-word-wrap">edit page</a> of the <a class="link" href="config-dialog.html" title="Chapter 7. Configure KatePart">configuration dialog</a>.</p><p>To set the maximum line width (maximum characters per line), use the
<a class="link" href="config-dialog.html#pref-wrap-words-at"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Wrap Words At</span></span></a>
option in the <a class="link" href="config-dialog.html#pref-edit" title="Editing">Editing</a> page of the <a class="link" href="config-dialog.html" title="Chapter 7. Configure KatePart">configuration
dialog</a>.</p><p>If enabled,
it has the following effects:

</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>While typing, the editor will automatically insert a hard line break after
the last whitespace character at a position before the maximum line width is reached.</p></li><li class="listitem"><p>While loading a document, the editor will wrap the text in a similar way, so that
no lines are longer than the maximum line width, if they contain any whitespace allowing that.</p></li></ul></div><p>

</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>There is currently no way to set word wrap for document types, or even to enable or disable
the feature on a per document level. This will be fixed in a future version of <span class="application">KatePart</span>.</p></div></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part-bookmarks.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="kate-part-autoindent.html">Next</a></td></tr><tr><td class="prevCell">Using Bookmarks </td><td class="upCell">Working with the <span class="application">KatePart</span> editor</td><td class="nextCell"> Using automatic indenting</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="kate-part-autoindent.html"><html><head><title>Using automatic indenting</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="kate-part.html" title="Chapter 3. Working with the KatePart editor"><link rel="prev" href="kate-part-auto-wrap.html" title="Automatically Wrapping text"><link rel="next" href="kate-part-line-modification.html" title="Line Modification Indicators"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Using automatic indenting</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part-auto-wrap.html">Prev</a></td><td class="upCell">Working with the <span class="application">KatePart</span> editor</td><td class="nextCell"><a accesskey="n" href="kate-part-line-modification.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="kate-part-autoindent"></a>Using automatic indenting</h2></div></div></div><p><span class="application">KatePart</span>s editor component supports a variety of autoindenting modes,
designed for different text formats. You can pick from the available modes using
the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Indentation</span></span>
menu. The autoindent modules also provide a function
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Format Indentation</span></span>
which will recalculate the indentation of the selected or current line. Thus,
you may reindent your entire document by selecting all the text and activating
that action.</p><p>All the indent modes use the indentation related settings in the active
document.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><p>You can set all sorts of configuration variables, including
those related to indentation using
<a class="link" href="config-variables.html" title="Configuring With Document Variables">Document Variables</a> and
<a class="link" href="config-dialog.html#pref-open-save-modes-filetypes" title="Modes &amp; Filetypes">File types</a>.</p></div><div class="variablelist"><p class="title"><b>Available Autoindent Modes</b></p><dl class="variablelist"><dt><span class="term">None</span></dt><dd><p>Selecting this mode turns automatic indenting off entirely.</p></dd><dt><span class="term">Normal</span></dt><dd><p>This indenter simply keeps the indentation similar to the
previous line with any content other than whitespace. You can combine this
with using the indent and unindent actions for indenting to your own taste.
</p></dd><dt><span class="term">C Style</span></dt><dd><p>An indenter for C and similar languages, such as
C++, C#, <span class="trademark">Java</span>™, <span class="application">JavaScript</span> and so on. This indenter will not work with scripting
languages such as Perl or PHP.</p></dd><dt><span class="term">Haskell</span></dt><dd><p>An indenter for the functional programming language Haskell.
</p></dd><dt><span class="term">Lilypond</span></dt><dd><p>An indenter for the Lilypond notation language for music.
</p></dd><dt><span class="term">Lisp</span></dt><dd><p>An indenter specifically for the Lisp scripting language and
Lisp dialects.
</p></dd><dt><span class="term">Python</span></dt><dd><p>An indenter specifically for the python scripting language.
</p></dd><dt><span class="term">XML Style</span></dt><dd><p>An indenter specifically for XML like languages.
</p></dd></dl></div></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part-auto-wrap.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="kate-part-line-modification.html">Next</a></td></tr><tr><td class="prevCell">Automatically Wrapping text </td><td class="upCell">Working with the <span class="application">KatePart</span> editor</td><td class="nextCell"> Line Modification Indicators</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="kate-part-line-modification.html"><html><head><title>Line Modification Indicators</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="kate-part.html" title="Chapter 3. Working with the KatePart editor"><link rel="prev" href="kate-part-autoindent.html" title="Using automatic indenting"><link rel="next" href="kate-part-scrollbar-minimap.html" title="The Scrollbar Minimap"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Line Modification Indicators</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part-autoindent.html">Prev</a></td><td class="upCell">Working with the <span class="application">KatePart</span> editor</td><td class="nextCell"><a accesskey="n" href="kate-part-scrollbar-minimap.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="kate-part-line-modification"></a>Line Modification Indicators</h2></div></div></div><p><span class="application">KatePart</span>'s line modification indicators let you easily see what you have
recently changed in a file.  By default, saved changes are indicated by a green
bar to the left of a document, while unsaved changes are indicated by an orange
bar.</p><p>
</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="line-modification-system.png"><div class="caption"><p>Line Modification Indicators in action.</p></div></div><p>
</p><p>You can change the colors used in the
<a class="link" href="config-dialog.html#prefcolors" title="Color Themes"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Fonts &amp; Colors</span></span> configuration
panel</a>, or you can disable this feature completely in the
<a class="link" href="config-dialog.html#appearance-borders" title="Borders"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Borders</span></span> tab of the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Appearance</span></span> configuration panel</a>.</p></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part-autoindent.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="kate-part-scrollbar-minimap.html">Next</a></td></tr><tr><td class="prevCell">Using automatic indenting </td><td class="upCell">Working with the <span class="application">KatePart</span> editor</td><td class="nextCell"> The Scrollbar Minimap</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="kate-part-scrollbar-minimap.html"><html><head><title>The Scrollbar Minimap</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="kate-part.html" title="Chapter 3. Working with the KatePart editor"><link rel="prev" href="kate-part-line-modification.html" title="Line Modification Indicators"><link rel="next" href="kate-part-multiple-cursors.html" title="Multiple cursors"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> The Scrollbar Minimap</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part-line-modification.html">Prev</a></td><td class="upCell">Working with the <span class="application">KatePart</span> editor</td><td class="nextCell"><a accesskey="n" href="kate-part-multiple-cursors.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="kate-part-scrollbar-minimap"></a>The Scrollbar Minimap</h2></div></div></div><p><span class="application">KatePart</span>'s Scrollbar Minimap displays a preview of documents in place of
the scrollbar.  The currently visible portion of the document is highlighted.
</p><p>
</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="minimap.png"><div class="caption"><p>The Scrollbar Minimap shows a preview of the <span class="application">Kate</span> source code.
</p></div></div><p>
</p><p>You can temporarily enable or disable the minimap by selecting
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">View</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">View Scrollbar Minimap</span></span>
or permanently in <a class="link" href="config-dialog.html#appearance-borders" title="Borders">the Appearance section of
<span class="application">KatePart</span>'s configuration</a>.</p></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part-line-modification.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="kate-part-multiple-cursors.html">Next</a></td></tr><tr><td class="prevCell">Line Modification Indicators </td><td class="upCell">Working with the <span class="application">KatePart</span> editor</td><td class="nextCell"> Multiple cursors</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="kate-part-multiple-cursors.html"><html><head><title>Multiple cursors</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="kate-part.html" title="Chapter 3. Working with the KatePart editor"><link rel="prev" href="kate-part-scrollbar-minimap.html" title="The Scrollbar Minimap"><link rel="next" href="the-menu-entries.html" title="Chapter 4. The Menu Entries"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Multiple cursors</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part-scrollbar-minimap.html">Prev</a></td><td class="upCell">Working with the <span class="application">KatePart</span> editor</td><td class="nextCell"><a accesskey="n" href="the-menu-entries.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="kate-part-multiple-cursors"></a>Multiple cursors</h2></div></div></div><p>Multiple cursor support was introduced with version 5.93 of katepart.</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="kate-part-create-multiple-cursors"></a>Creating multiple cursors</h3></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>To create them via mouse, use <span class="keycap"><strong>Alt</strong></span> + <span class="mousebutton">left</span> mouse button. The modifier is configurable, see <a class="link" href="config-dialog.html#multicursor-modifier-configure">Configure multicursor modifier</a></p></li><li class="listitem"><p>To create via keyboard, press <span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Alt</strong></span>+<span class="keysym">Up</span> to create cursor above primary cursor and <span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Alt</strong></span>+<span class="keysym">Down</span> to create cursor below. These shortcuts are also configurable</p></li><li class="listitem"><p>To create cursors out of a selection, first select some text and then press <span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>Alt</strong></span>+<span class="keycap"><strong>I</strong></span>. This will create a cursor at the end of each line in selection.</p></li><li class="listitem"><p>Use <span class="keycap"><strong>Alt</strong></span>+<span class="keycap"><strong>J</strong></span> to find the next occurrence of the word under cursor and select it + create a cursor. If you want to skip the current word under cursor, press <span class="keycap"><strong>Alt</strong></span>+<span class="keycap"><strong>K</strong></span> and it will mark the currently selected word as skipped. When you press <span class="keycap"><strong>Alt</strong></span>+<span class="keycap"><strong>J</strong></span> again it will unselect the current word and move to the next word.</p></li><li class="listitem"><p>Use <span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Alt</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>J</strong></span> to find all occurrences of the word under cursor and select them with a cursor at the end of each selection. You can use <span class="keycap"><strong>Alt</strong></span>+<span class="keycap"><strong>J</strong></span> to cycle through the selected words and use <span class="keycap"><strong>Alt</strong></span>+<span class="keycap"><strong>K</strong></span> to unselect any word as mentioned in the previous paragraph.</p></li></ul></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="idm1460"></a>Working with multiple cursors</h3></div></div></div><p>Once you have created a few cursors, you can perform most of the editing operations on them as you would on a single cursor.
For example, typing a letter will type it for each cursor. Similarly you can perform text transforms <abbr class="abbrev">e.g.</abbr>, capitalization
for all the positions or selections.</p><p>Sometimes you will want to remove cursors. To do so, you can <span class="keycap"><strong>Alt</strong></span> + <span class="mousebutton">left</span> mouse button on the cursor that you want to remove. If you just want to remove cursors on lines that are empty, there is a ready-made action for it that will do it for you. To invoke the action, open the Command Bar using <span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Alt</strong></span>+<span class="keycap"><strong>I</strong></span> and look for <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Remove cursors from empty lines</span></span> and hit <span class="keysym">Enter</span>. You can also configure a shortcut for this action.</p></div></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part-scrollbar-minimap.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="the-menu-entries.html">Next</a></td></tr><tr><td class="prevCell">The Scrollbar Minimap </td><td class="upCell">Working with the <span class="application">KatePart</span> editor</td><td class="nextCell"> The Menu Entries</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="keybindings.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="kate-part-navigation.html">Next</a></td></tr><tr><td class="prevCell">Shortcuts </td><td class="upCell"> </td><td class="nextCell"> Navigating in the Text</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="the-menu-entries.html"><html><head><title>Chapter 4. The Menu Entries</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="index.html" title="The KatePart Handbook"><link rel="prev" href="kate-part-multiple-cursors.html" title="Multiple cursors"><link rel="next" href="edit-menu.html" title="The Edit Menu"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> The Menu Entries</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part-multiple-cursors.html">Prev</a></td><td class="upCell"> </td><td class="nextCell"><a accesskey="n" href="edit-menu.html">Next</a></td></tr></table></div><div id="contentBody"><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="the-menu-entries"></a>Chapter 4. The Menu Entries</h1></div></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="file-menu"></a>The File Menu</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a name="file-new"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">File</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">New</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>N</strong></span></strong></span>)</span></dt><dd><p>
This starts a new document in a new and independent editor window.
</p></dd><dt><a name="file-open"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">File</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Open...</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>O</strong></span></strong></span>)</span></dt><dd><p>Displays a standard <span class="orgname">KDE</span> <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Open File</span></span>
dialog. Use the file view to select the file you want to open, and
click on <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Open</span></span> to open it.</p></dd><dt><a name="file-open-recent"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">File</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Open Recent</span></span></span></dt><dd><p>
This is a shortcut to open recently saved documents. Clicking on this
item opens a list to the side of the menu with several of the most
recently saved files. Clicking on a specific file will open it in
<span class="application">KatePart</span> - if the file still resides at the same
location.
</p></dd><dt><a name="file-save"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">File</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Save</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>S</strong></span></strong></span>)</span></dt><dd><p>
This saves the current document.  If there has already been a save of
the document then this will overwrite the previously saved file without
asking for the user's consent.  If it is the first save of a new
document the save as dialog (described below) will be invoked.
</p></dd><dt><a name="file-save-as"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">File</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Save As...</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>S</strong></span></strong></span>)</span></dt><dd><p>
This allows a document to be saved with a new file name. This is done by
means of the file dialog box described above in the <a class="link" href="the-menu-entries.html#file-open">Open</a> section of this help file.
</p></dd><dt><a name="file-save-as-encoding"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">File</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Save As with Encoding</span></span>
</span></dt><dd><p>
Save a document with a new file name in a different encoding.</p></dd><dt><a name="file-save-copy-as"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">File</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Save Copy As</span></span></span></dt><dd><p>
Save a copy of the document with a new file name and continue editing the original document.</p></dd><dt><a name="file-reload"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">File</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Reload</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>F5</strong></span></strong></span>)
</span></dt><dd><p>
Reloads the active file from disk. This command is useful if another program or
process has changed the file while you have it open in <span class="application">KatePart</span>.
</p></dd><dt><a name="file-print"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">File</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Print...</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>P</strong></span></strong></span>)</span></dt><dd><p>
Opens a simple print dialog allowing the user to specify what, where,
and how to print.
</p></dd><dt><a name="file-export-as-html"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">File</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Export as HTML</span></span></span></dt><dd><p>Save the currently open document as an <acronym class="acronym">HTML</acronym> file, which will be
formatted using the current syntax highlighting and color scheme settings.</p></dd><dt><a name="file-close"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">File</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Close</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>W</strong></span></strong></span>)</span></dt><dd><p>
Close the active file with this command. If you have made unsaved changes, you
will be prompted to save the file before <span class="application">KatePart</span> closes it.
</p></dd><dt><a name="file-quit"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">File</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Quit</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Q</strong></span></strong></span>)</span></dt><dd><p>
This will close the editor window, if you have more than one instance of
<span class="application">KatePart</span> running, through the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">New</span></span> or
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">New Window</span></span> menu items, those instances will
not be closed.
</p></dd></dl></div></div><FILENAME filename="edit-menu.html"><html><head><title>The Edit Menu</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="the-menu-entries.html" title="Chapter 4. The Menu Entries"><link rel="prev" href="the-menu-entries.html" title="Chapter 4. The Menu Entries"><link rel="next" href="selection-menu.html" title="The Selection Menu"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> The Edit Menu</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="the-menu-entries.html">Prev</a></td><td class="upCell">The Menu Entries</td><td class="nextCell"><a accesskey="n" href="selection-menu.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="edit-menu"></a>The Edit Menu</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a name="edit-undo"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Undo</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Z</strong></span></strong></span>)</span></dt><dd><p>Undo the last editing command (typing, copying, cutting <abbr class="abbrev">etc.</abbr>)</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This may undo several editing commands of the same type, like typing
in characters.</p></div></dd><dt><a name="edit-redo"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Redo</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>Z</strong></span></strong></span>)</span></dt><dd><p>This will reverse the most recent change (if any) made using Undo.</p></dd><dt><a name="edit-cut"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Cut</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>X</strong></span></strong></span>)</span></dt><dd><p>This command deletes the current selection and places it on the
clipboard. The clipboard works invisibly and provides a way to
transfer data between applications.</p></dd><dt><a name="edit-copy"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Copy</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>C</strong></span></strong></span>)</span></dt><dd><p>This copies the currently selected text to the clipboard so that it may
be pasted elsewhere. The clipboard works invisibly and provides a way to
transfer data between applications.</p></dd><dt><a name="edit-paste"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Paste</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>V</strong></span></strong></span>)</span></dt><dd><p>This will insert the first item in the clipboard at the cursor position.
The clipboard works invisibly and provides a way to
transfer data between applications.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If Overwrite Selection is enabled, the pasted text will overwrite the selection, if any.</p></div></dd><dt><a name="edit-paste-selection"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Paste Selection</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>Ins</strong></span></strong></span>)</span></dt><dd><p>This will paste the <a class="ulink" href="https://en.wikipedia.org/wiki/Clipboard_(computing)#X_Window_System" target="_top">mouse selection</a> contents that were chosen previously. Mark some text with the mouse pointer to paste it in the currently open file using this menu item.</p></dd><dt><a name="edit-swap-with-clipboard-contents"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Swap with clipboard contents</span></span></span></dt><dd><p>This will swap the selected text with the <a class="ulink" href="https://en.wikipedia.org/wiki/Clipboard_(computing)#X_Window_System" target="_top">clipboard</a> contents.</p></dd><dt><a name="edit-clipboard-history"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Clipboard History</span></span></span></dt><dd><p>This submenu will display the beginning of portions of text recently
copied to the clipboard.  Select an item from this menu to paste it in the
currently open file.</p></dd><dt><a name="edit-copy-as-html"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Copy as HTML</span></span></span></dt><dd><p>Copy the selection as <acronym class="acronym">HTML</acronym>, formatted using the current syntax
highlighting and color scheme settings.</p></dd><dt><a name="edit-input-modes"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Input Modes</span></span></span></dt><dd><p>Switch between a normal and a vi-like, modal editing mode. The vi input mode supports the most used commands
and motions from vim's normal and visual mode and has an optional vi mode statusbar.
This status bar shows commands while they are being entered, output from commands and
the current mode. The behavior of this mode can be configured in the
<a class="link" href="config-dialog.html#pref-edit-vi-input-mode" title="Vi Input Mode">Vi Input Mode</a> tab of the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Editing</span></span> page in <span class="application">KatePart</span>'s settings dialog.</p></dd><dt><a name="edit-overwrite-mode"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Overwrite Mode</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ins</strong></span></strong></span>)</span></dt><dd><p>Toggles the Insert/Overwrite modes. When the mode is <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">INS</span></span>, you
insert characters where the cursor is. When the mode is <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">OVR</span></span>, writing
characters will replace the current characters if your cursor is positioned
before any character. The status bar shows the current state of the Overwrite
Mode, either <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">INS</span></span> or <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">OVR</span></span>.</p></dd><dt><a name="edit-find"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Find...</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>F</strong></span></strong></span>)</span></dt><dd><p>This opens the incremental search bar at the bottom of the editor window.
On the left side of the bar is a button with an icon to close the bar, followed by a small text
box for entering the search pattern.</p><p>When you start entering characters of your search pattern, the search starts
immediately. If there is a match in the text this is highlighted and the background color
of the entry field changes to light green. If the search pattern does not match any
string in the text, this is indicated by a light red background color of the entry field.</p><p>Use the
<span class="inlinemediaobject"><img src="arrow-up-double-22.png"></span> or
<span class="inlinemediaobject"><img src="arrow-down-double-22.png"></span> button
to jump to the next or previous match in the document.</p><p>Matches in the document are highlighted even when you close the search bar. To clear
this highlighting, press the <span class="keycap"><strong>Esc</strong></span> key.</p><p>You can choose whether the search should be case sensitive.
Selecting <span class="inlinemediaobject"><img src="format-text-superscript-22.png"></span>
will limit finds to entries that match the
case (upper or lower) of each of the characters in the search  pattern.
</p><p>Click on the <span class="inlinemediaobject"><img src="configure-shortcuts-22.png"></span>
button at the right side of the incremental search bar to
switch to the power search and replace bar.
</p></dd><dt><a name="edit-find-next"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Find Variants</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Find Next</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>F3</strong></span></strong></span>)</span></dt><dd><p>This repeats the last find operation, if any, without calling the incremental
search bar, and searching forwards through the document starting from the cursor position.
</p></dd><dt><a name="edit-find-previous"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Find Variants</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Find Previous</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>F3</strong></span></strong></span>)</span></dt><dd><p>
This repeats the last find operation, if any, without calling the incremental
search bar, and searching backwards instead of forwards through the
document.
</p></dd><dt><a name="edit-find-selected"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Find Variants</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Find Selected</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>H</strong></span></strong></span>)</span></dt><dd><p>Finds next occurrence of selected text.</p></dd><dt><a name="edit-find-selected-backwards"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Find Variants</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Find Selected Backwards</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>H</strong></span></strong></span>)</span></dt><dd><p>Finds previous occurrence of selected text.</p></dd><dt><a name="edit-replace"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Replace...</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>R</strong></span></strong></span>)</span></dt><dd><p>This command opens the power search and replace bar.
On the upper left side of the bar is a button with an icon to close the bar, followed by a small text
box for entering the search pattern.</p><p>You can control the search mode by selecting <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Plain text</span></span>,
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Whole words</span></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Escape sequences</span></span> or
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Regular expression</span></span> from the drop down box.
</p><p>If <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Escape sequences</span></span> or <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Regular expression</span></span> are
selected, the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Add...</span></span> menuitem at the bottom of the context menu of the text boxes will be enabled
and allows you to add escape sequences or regular expression items to the
search or replace pattern from predefined lists.</p><p>Use the
<span class="inlinemediaobject"><img src="arrow-up-double-22.png"></span> or
<span class="inlinemediaobject"><img src="arrow-down-double-22.png"></span> button
to jump to the next or previous match in the document.</p><p>Enter the text to replace with in the text box labeled <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Replace</span></span>
and click the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Replace</span></span> button to replace only the highlighted text or
the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Replace All</span></span> button to replace the search text in the whole document.
</p><p>You can modify the search and replace behavior by selecting different
options at the bottom of the bar.
Selecting <span class="inlinemediaobject"><img src="format-text-superscript-22.png"></span>
will limit finds to entries that match the
case (upper or lower) of each of the characters in the search  pattern.
<span class="inlinemediaobject"><img src="edit-select-all-22.png"></span>
will search and replace within the current selection only.
The <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Find All</span></span> button highlights all matches in the document and shows the
number of found matches in a small popup.
</p><p>Click on the <span class="inlinemediaobject"><img src="configure-shortcuts-22.png"></span>
button at the right side of the power search and replace bar to
switch to the incremental search bar.
</p></dd><dt><a name="edit-go-to-matching-bracket"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Go To</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Go to Matching Bracket</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>6</strong></span></strong></span>)</span></dt><dd><p>Move the cursor to the associated opening or closing bracket.</p></dd></dl></div></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="the-menu-entries.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="selection-menu.html">Next</a></td></tr><tr><td class="prevCell">The Menu Entries </td><td class="upCell">The Menu Entries</td><td class="nextCell"> The Selection Menu</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="selection-menu.html"><html><head><title>The Selection Menu</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="the-menu-entries.html" title="Chapter 4. The Menu Entries"><link rel="prev" href="edit-menu.html" title="The Edit Menu"><link rel="next" href="view-menu.html" title="The View Menu"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> The Selection Menu</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="edit-menu.html">Prev</a></td><td class="upCell">The Menu Entries</td><td class="nextCell"><a accesskey="n" href="view-menu.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="selection-menu"></a>The Selection Menu</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a name="selection-select-all"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Selection</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Select All</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>A</strong></span></strong></span>)</span></dt><dd><p>This will select the entire document. This could be very useful for
copying the entire file to another application.</p></dd><dt><a name="selection-deselect"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Selection</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Deselect</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>A</strong></span></strong></span>)</span></dt><dd><p>Deselects the selected text in the editor if any.</p></dd><dt><a name="selection-toggle-block-selection"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Selection</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Block Selection Mode</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>B</strong></span></strong></span>)</span></dt><dd><p>Toggles Selection Mode. When the Selection Mode is <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">BLOCK</span></span>,
the status bar contains the string <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">[BLOCK]</span></span> and
you can make vertical selections, <abbr class="abbrev">e.g.</abbr> select column 5 to 10 in lines 9 to 15.</p></dd><dt><a name="selection-comment"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Selection</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Comment</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>D</strong></span></strong></span>)</span></dt><dd><p>This adds one space to the beginning of the line
where the text cursor is located or to the beginning of any
selected lines.</p></dd><dt><a name="selection-uncomment"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Selection</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Uncomment</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>D</strong></span></strong></span>)</span></dt><dd><p>This removes one space (if any exist) from the beginning of the
line where the text cursor is located or from the beginning of any
selected lines.</p></dd><dt><a name="selection-join-lines"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Selection</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Join Lines</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>J</strong></span></strong></span>)</span></dt><dd><p>Joins the selected lines, or the current line and the line below
with one white space character as a separator. Leading/trailing white space on
joined lines is removed in the affected ends.</p></dd><dt><a name="selection-capitalization"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Selection</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Capitalization</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Alt</strong></span>+<span class="keycap"><strong>U</strong></span></strong></span>)</span></dt><dd><p>Capitalize the selected text or the current
word.</p></dd><dt><a name="selection-uppercase"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Selection</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Uppercase</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>U</strong></span></strong></span>)</span></dt><dd><p>Put the selected text or the letter after the cursor in
uppercase.</p></dd><dt><a name="selection-lowercase"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Selection</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Lowercase</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>U</strong></span></strong></span>)</span></dt><dd><p>Put the selected text or the letter after the cursor in
lowercase.</p></dd><dt><a name="selection-cleanindent"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Selection</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Clean Indentation</span></span></span></dt><dd><p>This cleans the indentation for the current selection or for the
line the cursor is currently in. Cleaning the indentation ensures that
all your selected text follows the indentation mode you choose.</p></dd><dt><a name="selection-formatindent"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Selection</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Format Indent</span></span></span></dt><dd><p>Causes a realign of the current line or selected lines using the
indentation mode and indentation settings in the document.</p></dd><dt><a name="selection-alignon"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Selection</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Align On...</span></span></span></dt><dd><p>This command aligns lines in the selected block or whole document on the column given by a regular expression that you will be prompted for.</p><p>If you give an empty pattern it will align on the first non-blank character by default.</p><p>If the pattern has a capture it will indent on the captured match.</p><p><span class="emphasis"><em>Examples:</em></span></p><p>With '<strong class="userinput"><code>-</code></strong>' it will insert spaces before the first '-' of each lines to align them all on the same column.</p><p>With '<strong class="userinput"><code>alignon :\\s+(.)</code></strong>' it will insert spaces before the first non-blank character that occurs after a colon to align them all on the same column.</p></dd><dt><a name="selection-word-wrap-document"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Selection</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Apply Word Wrap</span></span></span></dt><dd><p>Apply static word wrapping on all the document. That means that
a new line of text will automatically start when the current
line exceeds the length specified by the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Wrap words at</span></span> option
in the Editing tab in <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Settings</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Configure
Editor...</span></span> menu.</p></dd></dl></div></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="edit-menu.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="view-menu.html">Next</a></td></tr><tr><td class="prevCell">The Edit Menu </td><td class="upCell">The Menu Entries</td><td class="nextCell"> The View Menu</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="view-menu.html"><html><head><title>The View Menu</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="the-menu-entries.html" title="Chapter 4. The Menu Entries"><link rel="prev" href="selection-menu.html" title="The Selection Menu"><link rel="next" href="go-menu.html" title="The Go Menu"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> The View Menu</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="selection-menu.html">Prev</a></td><td class="upCell">The Menu Entries</td><td class="nextCell"><a accesskey="n" href="go-menu.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="view-menu"></a>The View Menu</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a name="view-new-window"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">View</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">New Window</span></span></span></dt><dd><p>Create another window containing the current document. All changes to the
document in one window are reflected in the other window and vice versa.</p></dd><dt><a name="view-command-line"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">View</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Switch to Command Line</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>F7</strong></span></strong></span>)</span></dt><dd><p>Displays the <span class="application">KatePart</span> command line at the bottom of the window.
In the command line, type <strong class="userinput"><code>help</code></strong> to get help and <strong class="userinput"><code>help list</code></strong>
to get a list of commands.  For more information on the command line, see
<a class="link" href="advanced-editing-tools-commandline.html" title="The Editor Component Command Line">The Editor
Component Command Line</a>.</p></dd><dt><a name="view-enlarge-font"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">View</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Enlarge Font</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>+</strong></span></strong></span>)</span></dt><dd><p>This increases the display font size.</p></dd><dt><a name="view-shrink-font"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">View</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Shrink Font</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>-</strong></span></strong></span>)</span></dt><dd><p>This decreases the display font size.</p></dd><dt><a name="view-dynamic-word-wrap"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">View</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Word Wrap</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Dynamic Word Wrap</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>F10</strong></span></strong></span>)</span></dt><dd><p>Toggles dynamic word wrap in the current view. Dynamic word
wrap makes all the text in a view visible without the need for horizontal
scrolling by rendering one actual line on more visual lines as needed.</p></dd><dt><a name="view-dynamic-word-wrap-indicators"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">View</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Word Wrap</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Dynamic Word Wrap Indicators</span></span></span></dt><dd><p>Choose when and how the dynamic word wrap indicators should be
displayed. This is only available if the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Dynamic Word
Wrap</span></span> option is checked.</p></dd><dt><a name="view-show-statik-word-wrap-markers"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">View</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Word Wrap</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Show Static Word Wrap Marker</span></span></span></dt><dd><p>If this option is checked, a vertical line will be drawn at the
word wrap column as defined in the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Settings</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Configure Editor...</span></span> in the
Editing tab. Please note that the word wrap marker is only drawn if you
use a fixed pitch font.</p></dd><dt><a name="view-show-icon-border"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">View</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Borders</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Show Icon Border</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>F6</strong></span></strong></span>)</span></dt><dd><p>This is a toggle item. Setting it on checked will make the Icon Border
visible in the left side of the active editor, and vice versa. The Icon Border
indicates the positions of the marked lines in the editor.</p></dd><dt><a name="view-show-line-numbers"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">View</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Borders</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Show Line Numbers</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>F11</strong></span></strong></span>)</span></dt><dd><p>This is a toggle Item. Setting it on checked will make a pane displaying
the line numbers of the document visible in the left border of the active
editor, and vice versa.</p></dd><dt><a name="view-scrollbar-marks"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">View</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Borders</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Show Scrollbar Marks</span></span></span></dt><dd><p>If this option is checked, the view will show marks on the vertical
scrollbar. The marks are equivalent to the marks on the <a class="link" href="view-menu.html#view-show-icon-border">Icon Border</a>.</p></dd><dt><a name="view-border-show-scrollbar-minimap"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">View</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Borders</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Show Scrollbar Mini-Map</span></span></span></dt><dd><p>This will replace the scrollbar with a visualization of the
current document. For more information on the scrollbar minimap, see
<a class="xref" href="kate-part-scrollbar-minimap.html" title="The Scrollbar Minimap">the section called “The Scrollbar Minimap”</a>.</p></dd><dt><a name="view-code-folding"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">View</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Code Folding</span></span></span></dt><dd><p>These options pertain to
<a class="ulink" href="help:/katepart/advanced-editing-tools-code-folding.html" target="_top">code
folding</a>:</p><div class="variablelist"><dl class="variablelist"><dt><a name="view-show-folding-markers"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Show Folding Markers</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>F9</strong></span></strong></span>)</span></dt><dd><p>Toggles the display of the folding marker pane in the left
side of the view.</p></dd><dt><a name="view-fold-current-node"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Fold Current Node</span></span></span></dt><dd><p>Collapse the region that contains the cursor.</p></dd><dt><a name="view-unfold-current-node"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Unfold Current Node</span></span></span></dt><dd><p>Expand the region that contains the cursor.</p></dd><dt><a name="view-fold-toplevel-nodes"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Fold Toplevel Nodes</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>-</strong></span></strong></span>)</span></dt><dd><p>Collapse all toplevel regions in the document.
Click on the right pointing triangle to expand all toplevel regions.</p></dd><dt><a name="view-unfold-toplevel-nodes"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Unfold Toplevel Nodes</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>+</strong></span></strong></span>)</span></dt><dd><p>Expand all toplevel regions in the document.</p></dd></dl></div></dd><dt><a name="view-show-non-printable-spaces"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Show Non-Printable Spaces</span></span></span></dt><dd><p>Show/hide bounding box around non-printable spaces.</p></dd></dl></div></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="selection-menu.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="go-menu.html">Next</a></td></tr><tr><td class="prevCell">The Selection Menu </td><td class="upCell">The Menu Entries</td><td class="nextCell"> The Go Menu</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="go-menu.html"><html><head><title>The Go Menu</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="the-menu-entries.html" title="Chapter 4. The Menu Entries"><link rel="prev" href="view-menu.html" title="The View Menu"><link rel="next" href="tools-menu.html" title="The Tools Menu"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> The Go Menu</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="view-menu.html">Prev</a></td><td class="upCell">The Menu Entries</td><td class="nextCell"><a accesskey="n" href="tools-menu.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="go-menu"></a>The Go Menu</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a name="go-go-to-line"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Go</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Go to Line...</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>G</strong></span></strong></span>)</span></dt><dd><p>
This opens the goto line bar at the bottom of the window which is used to have the cursor
jump to a particular line (specified by number) in the document.  The
line number may be entered directly into the text box or graphically by
clicking on the up or down arrow spin controls at the side of the text
box. The little up arrow will increase the line number and the down
arrow decrease it. Close the bar with a click on the button with an icon on the left side of the bar.
</p></dd><dt><a name="go-go-to-previous-editing-line"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Go</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Go to Previous Editing Line</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>E</strong></span></strong></span>)</span></dt><dd><p>This action jumps the previous editing line in the <a class="link" href="config-dialog.html#multicursor-modifier-configure">multicursor configuration</a>.
</p></dd><dt><a name="go-go-to-next-editing-line"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Go</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Go to Next Editing Line</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>E</strong></span></strong></span>)</span></dt><dd><p>This action jumps the next editing line in the <a class="link" href="config-dialog.html#multicursor-modifier-configure">multicursor configuration</a>.
</p></dd><dt><a name="go-go-to-previous-modified-line"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Go</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Go to Previous Modified Line</span></span></span></dt><dd><p>Lines that were changed since opening the file are called modified lines. This action jumps the previous modified line.
</p></dd><dt><a name="go-go-to-next-modified-line"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Go</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Go to Next Modified Line</span></span></span></dt><dd><p>Lines that were changed since opening the file are called modified lines. This action jumps the next modified line.
</p></dd><dt><a name="go-select-to-matching-bracket"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Go</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Select to Matching Bracket</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>6</strong></span></strong></span>)</span></dt><dd><p>Selects the text between associated opening and closing brackets.</p></dd><dt><a name="go-bookmarks-menu"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Go</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Bookmarks</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>6</strong></span></strong></span>)</span></dt><dd><p>Below the entries described here, one entry for each bookmark in
the active document will be available. The text will be the first few
words of the marked line. Choose an item to move the cursor to the
start of that line. The editor will scroll as necessary to make that
line visible.</p></dd><dt><a name="go-bookmarks-set-bookmark"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Go</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Bookmarks</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Set Bookmark</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>B</strong></span></strong></span>)</span></dt><dd><p>Sets or removes a bookmark in the current line of the active document.
(If it's there, it is removed, otherwise one is set.)</p></dd><dt><a name="go-bookmarks-clear-bookmarks"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Go</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Bookmarks</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Clear All Bookmarks</span></span></span></dt><dd><p>
This command will remove all the markers from the document as well as
the list of markers which is appended at the bottom of this menu item.
</p></dd><dt><a name="go-bookmarks-bookmarks-previous"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Go</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Bookmarks</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Previous</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Alt</strong></span>+<span class="keysym">PgUp</span></strong></span>)</span></dt><dd><p>This will move the cursor to beginning of the first above line
with a bookmark. The menuitem text will include the line number and the first
piece of text on the line. This item is only available when there is a bookmark
in a line above the cursor.</p></dd><dt><a name="go-bookmarks-bookmarks-next"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Go</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Bookmarks</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Next</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Alt</strong></span>+<span class="keysym">PgDn</span></strong></span>)</span></dt><dd><p>This will move the cursor to beginning of the next line with a
bookmark. The menuitem text will include the line number and the first piece of
text on the line. This item is only available when there is a bookmark in a line
below the cursor.</p></dd></dl></div></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="view-menu.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="tools-menu.html">Next</a></td></tr><tr><td class="prevCell">The View Menu </td><td class="upCell">The Menu Entries</td><td class="nextCell"> The Tools Menu</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="tools-menu.html"><html><head><title>The Tools Menu</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="the-menu-entries.html" title="Chapter 4. The Menu Entries"><link rel="prev" href="go-menu.html" title="The Go Menu"><link rel="next" href="settings-help-menu.html" title="The Settings and Help Menu"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> The Tools Menu</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="go-menu.html">Prev</a></td><td class="upCell">The Menu Entries</td><td class="nextCell"><a accesskey="n" href="settings-help-menu.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="tools-menu"></a>The Tools Menu</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a name="tools-read-only"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Read Only Mode</span></span></span></dt><dd><p>Set the current document to Read Only mode. This prevents any text
addition and any changes in the document formatting.</p></dd><dt><a name="tools-filetype"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Mode</span></span></span></dt><dd><p>Choose the filetype scheme you prefer for the active document. This
overwrites the global filetype mode set in <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Settings</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Configure Editor...</span></span>
in the Filetypes tab for your current document only.</p></dd><dt><a name="tools-highlighting"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Highlighting</span></span></span></dt><dd><p>Choose the Highlighting scheme you prefer for the active document. This
overwrites the global highlighting mode set in <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Settings</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Configure Editor...</span></span> for your current document only.</p></dd><dt><a name="tools-indentation"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Indentation</span></span></span></dt><dd><p>Choose the style of indentation you want for your active document.
This overwrites the global indentation mode set in <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Settings</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Configure Editor...</span></span> for your current document only.</p></dd><dt><a name="tools-encoding"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Encoding</span></span></span></dt><dd><p>You can overwrite the default encoding set in <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Settings</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Configure Editor...</span></span> in the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Open/Save</span></span> page
to set a different encoding for your current document. The encoding you
set here will be only valid for your current document.</p></dd><dt><a name="tools-end-of-line"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">End of Line</span></span></span></dt><dd><p>Choose your preferred end of line mode for your active
document. This overwrites the global end of line mode set in <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Settings</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Configure Editor...</span></span> for your current document only.</p></dd><dt><a name="tools-add-byte-mark-order"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Add Byte Mark Order (BOM)</span></span></span></dt><dd><p>Checking this action you can explicitly add a byte order mark for unicode
encoded documents. The byte order mark (BOM) is a Unicode character used to signal
the endianness (byte order) of a text file or stream, for more information see
<a class="ulink" href="https://en.wikipedia.org/wiki/Byte_order_mark" target="_top">Byte Order Mark</a>.</p></dd><dt><a name="tools-scripts"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span></span></dt><dd><p>This submenu contains a list of all scripted actions. The list can easily be
modified by <a class="link" href="dev-scripting.html#dev-scripting-command-line" title="Command Line Scripts">writing your
own scripts</a>. This way, <span class="application">KatePart</span> can be extended with user-defined tools.
</p><div class="variablelist"><dl class="variablelist"><dt><a name="tools-scripts-navigation"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Navigation</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><a name="tools-scripts-navigation-previous-indent"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Navigation</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Move cursor to previous matching indent</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Alt</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keysym">Up</span></strong></span>)</span></dt><dd><p>
Moves the cursor to the first line above the current line that is indented at
the same level as the current line.
</p></dd><dt><a name="tools-scripts-navigation-next-indent"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Navigation</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Move cursor to next matching indent</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Alt</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keysym">Down</span></strong></span>)</span></dt><dd><p>
Moves the cursor to the first line below the current line that is indented at
the same level as the current line.
</p></dd></dl></div></dd><dt><a name="tools-scripts-editing"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Editing</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><a name="tools-scripts-editing-sort"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Editing</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Sort Selected Text</span></span></span></dt><dd><p>
Sorts the selected text or whole document in ascending order.
</p></dd><dt><a name="tools-scripts-editing-move-down"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Editing</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Move Lines Down</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keysym">Down</span></strong></span>)</span></dt><dd><p>
Move selected lines down.
</p></dd><dt><a name="tools-scripts-editing-move-up"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Editing</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Move Lines Up</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keysym">Up</span></strong></span>)</span></dt><dd><p>
Move selected lines up.
</p></dd><dt><a name="tools-scripts-editing-dupe-down"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Editing</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Duplicate Selected Lines Down</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Alt</strong></span>+<span class="keysym">Down</span></strong></span>)</span></dt><dd><p>
Duplicates the selected lines down.
</p></dd><dt><a name="tools-scripts-editing-dupe-up"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Editing</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Duplicate Selected Lines Up</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Alt</strong></span>+<span class="keysym">Up</span></strong></span>)</span></dt><dd><p>
Duplicates the selected lines up.
</p></dd><dt><a name="tools-scripts-editing-uri-encode"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Editing</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">URI-encode selected text</span></span></span></dt><dd><p>
Encodes the selected text so that it can be used as part of a query string in a
<acronym class="acronym">URL</acronym>, replacing the selection with the encoded text.
</p></dd><dt><a name="tools-scripts-editing-uri-decode"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Editing</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">URI-decode selected text</span></span></span></dt><dd><p>
If part of the query string of a <acronym class="acronym">URL</acronym> is selected, this will decode it and
replace the selection with the original raw text.
</p></dd></dl></div></dd><dt><a name="tools-scripts-emmet"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Emmet</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><a name="tools-scripts-emmet-expand-abbreviation"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Emmet</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Expand abbreviation</span></span></span></dt><dd><p>
Converts the selected text to a pair of opening and closing <acronym class="acronym">HTML</acronym> or <acronym class="acronym">XML</acronym> tags.
For example, if <strong class="userinput"><code>div</code></strong> is selected, this item will replace
that with  <code class="computeroutput">&lt;div&gt;&lt;/div&gt;</code>.
</p></dd><dt><a name="tools-scripts-emmet-wrap-with-tag"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Emmet</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Wrap with tag</span></span></span></dt><dd><p>
Wraps the selected text with the tag provided on the
<a class="link" href="dev-scripting.html#dev-scripting-command-line" title="Command Line Scripts">command line</a>.
</p></dd><dt><a name="tools-scripts-emmet-move-cursor-to-matching-tag"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Emmet</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Move cursor to matching tag</span></span></span></dt><dd><p>
If the cursor is inside an opening <acronym class="acronym">HTML</acronym>/<acronym class="acronym">XML</acronym> tag, this item will move it to the
closing tag.  If the cursor is inside the closing tag, it will instead move it
to the opening tag.
</p></dd><dt><a name="tools-scripts-emmet-select-tag-inwards"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Emmet</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Select <acronym class="acronym">HTML</acronym>/<acronym class="acronym">XML</acronym> tag contents inwards</span></span></span></dt><dd><p>
When the cursor is inside a pair of <acronym class="acronym">HTML</acronym>/<acronym class="acronym">XML</acronym> tags, this option will change the
selection to include the contents of those <acronym class="acronym">HTML</acronym>/<acronym class="acronym">XML</acronym> tags, without selecting the
tags themselves.
</p></dd><dt><a name="tools-scripts-emmet-select-tag-outwards"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Emmet</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Select <acronym class="acronym">HTML</acronym>/<acronym class="acronym">XML</acronym> tag contents outwards</span></span></span></dt><dd><p>
When the cursor is inside a pair of <acronym class="acronym">HTML</acronym>/<acronym class="acronym">XML</acronym> tags, this item will change the
selection to include the contents of those <acronym class="acronym">HTML</acronym>/<acronym class="acronym">XML</acronym> tags, including the tags
themselves.
</p></dd><dt><a name="tools-scripts-emmet-toggle-comment"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Emmet</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Toggle Comment</span></span></span></dt><dd><p>
If the selected portion is not a comment, this item will enclose that portion
in <acronym class="acronym">HTML</acronym>/<acronym class="acronym">XML</acronym> comments (<abbr class="abbrev">e.g.</abbr>
<code class="computeroutput">&lt;!-- selected text --&gt;</code>). If the selected
portion is a comment, the comment tags will be removed instead.
</p></dd><dt><a name="tools-scripts-emmet-toggle-delete-tag"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Emmet</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Delete tag under cursor</span></span></span></dt><dd><p>
If the cursor is presently inside a <acronym class="acronym">HTML</acronym>/<acronym class="acronym">XML</acronym> tag, this item will delete the
entire tag.
</p></dd><dt><a name="tools-scripts-emmet-decrement-number-by-1"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Emmet</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Decrement number by 1</span></span></span></dt><dd><p>
This item will subtract one from the currently selected text, if it is a number.
For example, if <strong class="userinput"><code>5</code></strong> is selected, it will become
<code class="computeroutput">4</code>.
</p></dd><dt><a name="tools-scripts-emmet-decrement-number-by-10"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Emmet</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Decrement number by 10</span></span></span></dt><dd><p>
This item will subtract 10 from the currently selected text, if it is a number.
For example, if <strong class="userinput"><code>15</code></strong> is selected, it will become
<code class="computeroutput">5</code>.
</p></dd><dt><a name="tools-scripts-emmet-decrement-number-by-0_1"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Emmet</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Decrement number by 0.1</span></span></span></dt><dd><p>
This item will subtract 0.1 from the currently selected text, if it is a number.
For example, if <strong class="userinput"><code>4.5</code></strong> is selected, it will become
<code class="computeroutput">4.4</code>.
</p></dd><dt><a name="tools-scripts-emmet-increment-number-by-1"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Emmet</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Increment number by 1</span></span></span></dt><dd><p>
This item will add one to the currently selected text, if it is a number.
For example, if <strong class="userinput"><code>5</code></strong> is selected, it will become
<code class="computeroutput">6</code>.
</p></dd><dt><a name="tools-scripts-emmet-increment-number-by-10"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Emmet</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Increment number by 10</span></span></span></dt><dd><p>
This item will add 10 to the currently selected text, if it is a number.
For example, if <strong class="userinput"><code>5</code></strong> is selected, it will become
<code class="computeroutput">15</code>.
</p></dd><dt><a name="tools-scripts-emmet-increment-number-by-0_1"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Emmet</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Increment number by 0.1</span></span></span></dt><dd><p>
This item will add 0.1 to the currently selected text, if it is a number.
For example, if <strong class="userinput"><code>4.5</code></strong> is selected, it will become
<code class="computeroutput">4.6</code>.
</p></dd></dl></div></dd></dl></div></dd><dt><a name="tools-invoke-code-completition"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Invoke Code Completion</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keysym">Space</span></strong></span>)</span></dt><dd><p>Manually invoke command completion, usually by using a shortcut bound to this action.</p></dd><dt><a name="tools-word-completition"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Word Completion</span></span></span></dt><dd><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Reuse Word Below</span></span> (<span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>9</strong></span>) and <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Reuse Word Above</span></span>
(<span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>8</strong></span>) complete the
currently typed text by searching for similar
words backward or forward from the current cursor position. <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Shell
Completion</span></span> pops up a completion box with matching entries.</p></dd><dt><a name="spelling-automatic-spell-checking"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Spelling</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Automatic Spell Checking</span></span> (<span class="shortcut"><strong><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>O</strong></span></strong></span>)</span></dt><dd><p>When <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Automatic Spell Checking</span></span> is enabled, wrongly spelled text
is underlined in the document on-the-fly.</p></dd><dt><a name="spelling-spelling"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Spelling</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Spelling...</span></span></span></dt><dd><p><span class="action">This initiates the spellchecking program - a program
designed to help the user catch and correct any spelling errors.</span>
Clicking on this entry will start the checker and bring up the speller dialog
box through which the user can control the process.  There are four settings
lined up vertically in the center of the dialog with their corresponding labels
just to the left.  Starting at the top they are:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Unknown word:</span></span></span></dt><dd><p>Here, the spellchecker indicates the word currently under
consideration.  This happens when the checker encounters a word not in its
dictionary - a file containing a list of correctly spelled words against which
it compares each word in the editor.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Replace with:</span></span></span></dt><dd><p> If the checker has any similar words in its dictionary the
first one will be listed here.  The user can accept the suggestion, type in his
or her own correction, or choose a different suggestion from the next
box.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Language:</span></span></span></dt><dd><p> If you have installed multiple dictionaries, here you can
select which dictionary/language should be used.</p></dd></dl></div><p>On the right side of the dialog box are 6 buttons that allow the user to
control the spellcheck process.  They are:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Add to Dictionary</span></span></span></dt><dd><p>Pressing this button adds the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Unknown word
</span></span> to the checker's dictionary. This means that in the future
the checker will always consider this word to be correctly
spelled.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Suggest</span></span></span></dt><dd><p> The checker may list here a number of possible replacements for
the word under consideration.  Clicking on any one of the suggestions will cause
that word to be entered in the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Replace with</span></span> box,
above.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Replace</span></span></span></dt><dd><p> This button has the checker replace the word under
consideration in the document with the word in the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Replace with</span></span> box.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Replace All</span></span></span></dt><dd><p> This button causes the checker to replace not only the current
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Unknown word:</span></span> but to automatically make the same
substitution for any other occurrences of this <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Unknown word</span></span>
in the document.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Ignore</span></span></span></dt><dd><p>Activating this button will have the checker move on without
making any changes.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Ignore All</span></span></span></dt><dd><p> This button tells the checker to do nothing with the current
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Unknown word:</span></span> and to pass over any other instances of
the same word.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This only applies to the current spellcheck
run.  If the checker is run again later it will stop on this same
word.</p></div></dd></dl></div><p>Three more buttons are located horizontally along the bottom of the
spellcheck dialog.  They are:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Help</span></span></span></dt><dd><p> This invokes the <span class="orgname">KDE</span> help system with the help page
for this dialog.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Finished</span></span></span></dt><dd><p> This button ends the spellcheck process, and returns to the
document.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Cancel</span></span></span></dt><dd><p> This button cancels the spellcheck process, all modifications
are reverted, and you will return to your document.</p></dd></dl></div></dd><dt><a name="tools-spelling-from-cursor"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Spelling</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Spelling (from cursor)...</span></span></span></dt><dd><p>This initiates the spellchecking program but it starts where your cursor
is instead of at the beginning of the document.</p></dd><dt><a name="tools-spellcheck-selection"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Spelling</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Spellcheck Selection...</span></span></span></dt><dd><p>Spellchecks the current selection.</p></dd><dt><a name="tools-change-dictionary"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Spelling</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Change Dictionary</span></span></span></dt><dd><p>Displays a drop down box with all available dictionaries for spellchecking
at the bottom of the editor window. This allows easy switching of the spellcheck
dictionary <abbr class="abbrev">e.g.</abbr> for automatic spellcheck of text in different languages.</p></dd></dl></div></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="go-menu.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="settings-help-menu.html">Next</a></td></tr><tr><td class="prevCell">The Go Menu </td><td class="upCell">The Menu Entries</td><td class="nextCell"> The Settings and Help Menu</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="settings-help-menu.html"><html><head><title>The Settings and Help Menu</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="the-menu-entries.html" title="Chapter 4. The Menu Entries"><link rel="prev" href="tools-menu.html" title="The Tools Menu"><link rel="next" href="advanced-editing-tools.html" title="Chapter 5. Advanced Editing Tools"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> The Settings and Help Menu</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="tools-menu.html">Prev</a></td><td class="upCell">The Menu Entries</td><td class="nextCell"><a accesskey="n" href="advanced-editing-tools.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="settings-help-menu"></a>The Settings and Help Menu</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a name="settings-color-theme"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Settings</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Editor Color Theme</span></span></span></dt><dd><p>This menu lists the available color schemes. You can change the
schema for the current view here, to change the default schema you need to
use the <a class="ulink" href="help:/katepart/config-dialog-editor.html#prefcolors" target="_top">Fonts
&amp; Colors</a> page of the config dialog.</p></dd></dl></div><p>
<span class="application">KatePart</span> has the common <span class="orgname">KDE</span> <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Settings</span></span> and <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Help</span></span>
menu items, for more information read the sections about the <a class="ulink" href="help:/fundamentals/menus.html#menus-settings" target="_top">Settings Menu</a> and <a class="ulink" href="help:/fundamentals/menus.html#menus-help" target="_top">Help Menu</a>
of the <span class="orgname">KDE</span> Fundamentals.
</p></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="tools-menu.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="advanced-editing-tools.html">Next</a></td></tr><tr><td class="prevCell">The Tools Menu </td><td class="upCell">The Menu Entries</td><td class="nextCell"> Advanced Editing Tools</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="kate-part-multiple-cursors.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="edit-menu.html">Next</a></td></tr><tr><td class="prevCell">Multiple cursors </td><td class="upCell"> </td><td class="nextCell"> The Edit Menu</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="advanced-editing-tools.html"><html><head><title>Chapter 5. Advanced Editing Tools</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="index.html" title="The KatePart Handbook"><link rel="prev" href="settings-help-menu.html" title="The Settings and Help Menu"><link rel="next" href="advanced-editing-tools-commandline.html" title="The Editor Component Command Line"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Advanced Editing Tools</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="settings-help-menu.html">Prev</a></td><td class="upCell"> </td><td class="nextCell"><a accesskey="n" href="advanced-editing-tools-commandline.html">Next</a></td></tr></table></div><div id="contentBody"><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="advanced-editing-tools"></a>Chapter 5. Advanced Editing Tools</h1></div><div><div class="authorgroup"><p class="author"><span class="firstname">Anders</span> <span class="surname">Lund</span> <code class="email">&lt;anders@alweb.dk&gt;</code></p><p class="author"><span class="firstname">Dominik</span> <span class="surname">Haumann</span> <code class="email">&lt;dhdev@gmx.de&gt;</code></p></div></div></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="advanced-editing-tools-comment"></a>Comment/Uncomment</h2></div></div></div><p>The <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Comment</span></span> and <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Uncomment</span></span> commands, available from the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> menu allow you to add or remove comment
markers to the selection, or the current line if no text is selected,
if comments are supported by the format of the text you are
editing.</p><p>The rules for how commenting is done are defined in the syntax
definitions, so if syntax highlighting is not used, commenting/uncommenting
is not possible. </p><p>Some formats define single line comment markers, some multiline
markers and some both.  If multiline markers are not available,
commenting out a selection that does not fully include its last line
is not possible.</p><p>If a single line marker is available, commenting single lines is
preferred where applicable, as this helps to avoid problems with
nested comments.</p><p>When removing comment markers, no uncommented text should be
selected. When removing multiline comment markers from a selection,
any whitespace outside the comment markers is ignored.</p><p><a class="indexterm" name="idm2869"></a>
To place comment markers, use the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Comment</span></span>
menu item or the related keyboard shortcut sequence, the default is
<span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>D</strong></span>.</p><p><a class="indexterm" name="idm2878"></a>
To remove comment markers, use the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Uncomment</span></span>
menu item or the related keyboard shortcut, the default is <span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>D</strong></span>.</p></div><FILENAME filename="advanced-editing-tools-commandline.html"><html><head><title>The Editor Component Command Line</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="advanced-editing-tools.html" title="Chapter 5. Advanced Editing Tools"><link rel="prev" href="advanced-editing-tools.html" title="Chapter 5. Advanced Editing Tools"><link rel="next" href="advanced-editing-tools-code-folding.html" title="Using Code Folding"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> The Editor Component Command Line</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="advanced-editing-tools.html">Prev</a></td><td class="upCell">Advanced Editing Tools</td><td class="nextCell"><a accesskey="n" href="advanced-editing-tools-code-folding.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="advanced-editing-tools-commandline"></a>The Editor Component Command Line</h2></div></div></div><p><span class="application">KatePart</span>'s editor component has an internal command line, allowing you to
perform various actions from a minimal <acronym class="acronym">GUI</acronym>. The command line is a text entry
at the bottom of the editor area; to show it select
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">View</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Switch to Command Line</span></span>
or use the shortcut (default is
<span class="keycap"><strong>F7</strong></span>). The editor provides
a set of commands as documented below, and additional commands can be provided
by plugins.</p><p>To execute a command, type the command then press the return key. The
command line will indicate whether it succeeded and possibly display a message. If
you entered the command line by pressing <span class="keycap"><strong>F7</strong></span> it will
automatically hide after a few seconds. To clear the message and enter a new
command, press <span class="keycap"><strong>F7</strong></span> again.</p><p>The command line has a built-in help system; issue the command
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>help</strong></span></span> to get started. To see a list of all available commands
issue <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>help list</strong></span></span>; to view help for a specific command, do
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>help <span class="replaceable"><em class="replaceable"><code>command</code></em></span></strong></span></span>.</p><p>The command line has a built in history, so you can reuse commands already
typed. To navigate the history, use the <span class="keysym">Up</span> and
<span class="keysym">Down</span> keys. When showing historical commands, the argument part
of the command will be selected, allowing you to easily overwrite the
arguments.</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="advanced-editing-tools-commandline-commands"></a>Standard Command Line Commands</h3></div></div></div><div class="variablelist"><p class="title"><b>Argument types</b></p><dl class="variablelist"><dt><span class="term">BOOLEAN</span></dt><dd><p>This is used with commands that turns things on or off.
Legal values are <strong class="userinput"><code>on</code></strong>, <strong class="userinput"><code>off</code></strong>,
<strong class="userinput"><code>true</code></strong>, <strong class="userinput"><code>false</code></strong>,
<strong class="userinput"><code>1</code></strong> or <strong class="userinput"><code>0</code></strong>.</p></dd><dt><span class="term">INTEGER</span></dt><dd><p>An integer number.</p></dd><dt><span class="term">STRING</span></dt><dd><p>A string, surrounded by single quotes (') or double quotes (") when it contains spaces.</p></dd></dl></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="advanced-editing-tools-commandline-commands-configure"></a>Commands for Configuring the Editor</h4></div></div></div><p>These commands are provided by the editor component, and allow you to
configure the active document and view only. This is handy if you want to use
a setting different from the default settings, for example for indentation.
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>set-tab-width</strong></span></span> {INTEGER width}</p></div></span></dt><dd><p>Sets the tab width to the number <strong class="userinput"><code>width</code></strong>.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>set-indent-width</strong></span></span> {INTEGER width}</p></div></span></dt><dd><p>Sets the indentation width to the number
<strong class="userinput"><code>width</code></strong>. Used only if you are indenting with
spaces.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>set-word-wrap-column</strong></span></span> {INTEGER width}</p></div></span></dt><dd><p>Sets the line width for hard wrapping to
<strong class="userinput"><code>width</code></strong>. This is used if you are having your text wrapped
automatically.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>set-icon-border</strong></span></span> {BOOLEAN enable}</p></div></span></dt><dd><p>Sets the visibility of the icon border.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>set-folding-markers</strong></span></span> {BOOLEAN enable}</p></div></span></dt><dd><p>Sets the visibility of the folding markers pane.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>set-line-numbers</strong></span></span> {BOOLEAN enable}</p></div></span></dt><dd><p>Sets the visibility of the line numbers pane.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>set-replace-tabs</strong></span></span> {BOOLEAN enable}</p></div></span></dt><dd><p>If enabled, tabs are replaced with spaces as you type.
</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>set-remove-trailing-space</strong></span></span> {BOOLEAN enable}</p></div></span></dt><dd><p>If enabled, trailing whitespace is removed whenever the cursor
leaves a line.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>set-show-tabs</strong></span></span> {BOOLEAN enable}</p></div></span></dt><dd><p>If enabled, TAB characters and trailing whitespace will be
visualized by a small dot.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>set-show-indent</strong></span></span> {BOOLEAN enable}</p></div></span></dt><dd><p>If enabled, indentation will be visualized by a vertical dotted
line.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>set-indent-spaces</strong></span></span> {BOOLEAN enable}</p></div></span></dt><dd><p>If enabled, the editor will indent with
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="option"><code class="option">indent-width</code></span> spaces for each indentation level, rather than
with one TAB character.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>set-mixed-indent</strong></span></span> {BOOLEAN enable}</p></div></span></dt><dd><p>If enabled, <span class="application">KatePart</span> will use a mix of TAB and spaces for
indentation. Each indentation level will be <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="option"><code class="option">indent-width</code></span> wide,
and more indentation levels will be optimized to use as many TAB characters as
possible.</p><p>When executed, this command will additionally set space indentation enabled,
and if the indent width is unspecified it will be set to half of the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="option"><code class="option">tab-width</code></span> for the document at the time of execution.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>set-word-wrap</strong></span></span> {BOOLEAN
enable}</p></div></span></dt><dd><p>Enables dynamic word wrap according to
<strong class="userinput"><code>enable</code></strong>.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>set-replace-tabs-save</strong></span></span> {BOOLEAN enable
}</p></div></span></dt><dd><p>When enabled, tabs will be replaced with whitespace whenever
 the document is saved.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>set-remove-trailing-space-save</strong></span></span> {BOOLEAN enable}</p></div></span></dt><dd><p>When enabled, trailing space will be removed from each line
whenever the document is saved.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>set-indent-mode</strong></span></span> {STRING name}</p></div></span></dt><dd><p>Sets the autoindentation mode to <strong class="userinput"><code>name</code></strong>.
If <strong class="userinput"><code>name</code></strong> is not known, the mode is set to 'none'. Valid
modes are 'none', 'normal', 'cstyle', 'haskell', 'lilypond', 'lisp', 'python',
'ruby' and 'xml'.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>set-auto-ident</strong></span></span> {BOOLEAN script}</p></div></span></dt><dd><p>Enable or disable autoindentation.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>set-highlight</strong></span></span> {STRING highlight}</p></div></span></dt><dd><p>Sets the syntax highlighting system for the document. The
argument must be a valid highlight name, as seen in the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Highlighting</span></span>
menu. This command provides an autocompletion list for its
argument.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>reload-scripts</strong></span></span></p></div></span></dt><dd><p>Reload all <a class="link" href="dev-scripting.html" title="Scripting with JavaScript"><span class="application">JavaScript</span>
scripts</a> used by <span class="application">Kate</span>, including indenters and command line scripts.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>set-mode</strong></span></span> {STRING mode}</p></div></span></dt><dd><p>Choose the filetype scheme for the current document.
</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>nn[oremap]</strong></span></span> {STRING original} {STRING mapped}</p></div></span></dt><dd><p>Map the key sequence <strong class="userinput"><code>original</code></strong> to 
<strong class="userinput"><code>mapped</code></strong>.</p></dd></dl></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="advanced-editing-tools-commandline-commands-edit"></a>Commands for editing</h4></div></div></div><p>These commands modify the current document.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>indent</strong></span></span></p></div></span></dt><dd><p>Indents the selected lines or the current line.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>unindent</strong></span></span></p></div></span></dt><dd><p>Unindents the selected lines or current line.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>cleanindent</strong></span></span></p></div></span></dt><dd><p>Cleans up the indentation of the selected lines or current line
according to the indentation settings in the document.
</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>comment</strong></span></span></p></div></span></dt><dd><p>Inserts comment markers to make the selection or selected lines
or current line a comment according to the text format as defined by the syntax
highlight definition for the document.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>uncomment</strong></span></span></p></div></span></dt><dd><p>Removes comment markers from the selection or selected lines
or current line according to the text format as defined by the syntax highlight
definition for the document.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>kill-line</strong></span></span></p></div></span></dt><dd><p>Deletes the current line.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>replace</strong></span></span> { STRING pattern} {STRING replacement}</p></div></span></dt><dd><p>Replaces text matching <strong class="userinput"><code>pattern</code></strong> with
<strong class="userinput"><code>replacement</code></strong>. If you want to include whitespace in the
<strong class="userinput"><code>pattern</code></strong>, you must quote both the <strong class="userinput"><code>pattern</code></strong>
and <strong class="userinput"><code>replacement</code></strong> with single or double quotes. If the
arguments are unquoted, the first word is used as <strong class="userinput"><code>pattern</code></strong>
and the rest for <strong class="userinput"><code>replacement</code></strong>. If
<strong class="userinput"><code>replacement</code></strong> is empty, each occurrence of
<strong class="userinput"><code>pattern</code></strong> is removed.</p><p>You can set flags to configure the search by adding a colon, followed
by one or more letters each representing a configuration, giving the form
<strong class="userinput"><code>replace:options pattern replacement</code></strong>. Available options
are:

</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><strong class="userinput"><code>b</code></strong></span></dt><dd><p>Search backwards.</p></dd><dt><span class="term"><strong class="userinput"><code>c</code></strong></span></dt><dd><p>Search from cursor position.</p></dd><dt><span class="term"><strong class="userinput"><code>e</code></strong></span></dt><dd><p>Search in the selection only.</p></dd><dt><span class="term"><strong class="userinput"><code>r</code></strong></span></dt><dd><p>Do regular expression search. If set, you may use
<strong class="userinput"><code>\N</code></strong> where N is a number to represent captures in the
replacement string.</p></dd><dt><span class="term"><strong class="userinput"><code>s</code></strong></span></dt><dd><p>Do case sensitive search.</p></dd><dt><span class="term"><strong class="userinput"><code>p</code></strong></span></dt><dd><p>Prompt for permission to replace the next occurrence.</p></dd><dt><span class="term"><strong class="userinput"><code>w</code></strong></span></dt><dd><p>Match whole words only.</p></dd></dl></div><p>

</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>date</strong></span></span> {STRING format}</p></div></span></dt><dd><p>Inserts a date/time string as defined by the specified
<strong class="userinput"><code>format</code></strong>, or the format <span class="quote">“<span class="quote">yyyy-MM-dd hh:mm:ss</span>”</span>
if none is specified. The following translations are done when interpreting
<strong class="userinput"><code>format</code></strong>:

</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col><col></colgroup><tbody><tr><td><code class="literal">d</code></td><td>The day as number without a leading zero (1-31).</td></tr><tr><td><code class="literal">dd</code></td><td>The day as number with a leading zero (01-31).</td></tr><tr><td><code class="literal">ddd</code></td><td>The abbreviated localized day name (<abbr class="abbrev">e.g.</abbr> 'Mon'..'Sun').</td></tr><tr><td><code class="literal">dddd</code></td><td>The long localized day name (<abbr class="abbrev">e.g.</abbr> 'Monday'..'Sunday').</td></tr><tr><td><code class="literal">M</code></td><td>The month as number without a leading zero (1-12).</td></tr><tr><td><code class="literal">MM</code></td><td>The month as number with a leading zero (01-12).</td></tr><tr><td><code class="literal">MMMM</code></td><td>The long localized month name (<abbr class="abbrev">e.g.</abbr> 'January'..'December').</td></tr><tr><td><code class="literal">MMM</code></td><td>The abbreviated localized month name (<abbr class="abbrev">e.g.</abbr> 'Jan'..'Dec').</td></tr><tr><td><code class="literal">yy</code></td><td>The year as two digit number
(00-99).</td></tr><tr><td><code class="literal">yyyy</code></td><td>The year as four digit number (1752-8000).</td></tr><tr><td><code class="literal">h</code></td><td>The hour without a leading zero (0..23 or 1..12 if AM/PM display).</td></tr><tr><td><code class="literal">hh</code></td><td>The hour with a leading zero (00..23 or 01..12 if AM/PM display).</td></tr><tr><td><code class="literal">m</code></td><td>The minute without a leading zero (0..59).</td></tr><tr><td><code class="literal">mm</code></td><td>The minute with a leading zero (00..59).</td></tr><tr><td><code class="literal">s</code></td><td>The second without a leading zero (0..59).</td></tr><tr><td><code class="literal">ss</code></td><td>The second with a leading zero (00..59).</td></tr><tr><td><code class="literal">z</code></td><td>The milliseconds without leading zeroes (0..999).</td></tr><tr><td><code class="literal">zzz</code></td><td>The milliseconds with leading zeroes (000..999).</td></tr><tr><td><code class="literal">AP</code></td><td>Use AM/PM display. AP will be replaced by either "AM" or "PM".</td></tr><tr><td><code class="literal">ap</code></td><td>Use am/pm display. ap will be replaced by either "am" or "pm".</td></tr></tbody></table></div><p>

</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>char</strong></span></span> {STRING identifier}</p></div></span></dt><dd><p>This command allows you to insert literal characters by their
numerical identifier, in decimal, octal or hexadecimal form.
To use it launch the Editing Command dialog and type <strong class="userinput"><code>char:
[number]</code></strong> in the entry box, then hit
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">OK</span></span>.</p><div class="example"><a name="idm3302"></a><p class="title"><b>Example 5.1. <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command">char</span></span> examples</b></p><div class="example-contents"><p>Input: <strong class="userinput"><code>char:234</code></strong></p><p>Output: <code class="computeroutput">ê</code></p><p>Input: <strong class="userinput"><code>char:0x1234</code></strong></p><p>Output: <code class="computeroutput">ሴ</code></p></div></div><br class="example-break"></dd><dt><span class="term">
<a class="indexterm" name="idm3315"></a>
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>s///[ig]</strong></span></span> <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>%s///[ig]</strong></span></span></span></dt><dd><p>This command does a sed-like search/replace operation on the
current line, or on the whole file (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>%s///</strong></span></span>).</p><p>In short, the text is searched for text matching the
<span class="emphasis"><em>search pattern</em></span>, the regular expression between
the first and the second slash, and when a match is found, the
matching part of the text is replaced with the expression between the
second and last slash. Parentheses in the search pattern
create <span class="emphasis"><em>back references</em></span>, that is the command
remembers which part of the string matched in the parentheses; these
strings can be reused in the replace pattern, referred to as
<strong class="userinput"><code>\1</code></strong> for the first set of parentheses,
<strong class="userinput"><code>\2</code></strong> for the second and so on.</p><p>To search for a literal <code class="literal">(</code> or
<code class="literal">)</code>, you need to <span class="emphasis"><em>escape</em></span> it using
a backslash character: <strong class="userinput"><code>\(\)</code></strong></p><p>If you put an <strong class="userinput"><code>i</code></strong> at the end of the
expression, the matching will be case insensitive. If you put a
<strong class="userinput"><code>g</code></strong> at the end, all occurrences of the pattern will be
replaced, otherwise only the first occurrence is replaced.</p><div class="example"><a name="idm3336"></a><p class="title"><b>Example 5.2. Replacing text in the current line</b></p><div class="example-contents"><p>Your friendly compiler just stopped, telling you that the class
<code class="classname">myClass</code> mentioned in line 3902 in your source file
is not defined.</p><p>"Buckle!" you think, it is of course
<code class="classname">MyClass</code>. You go to line 3902, and instead of trying
to find the word in the text, you launch the Editing Command Dialog,
enter <strong class="userinput"><code>s/myclass/MyClass/i</code></strong>, hit the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">OK</span></span> button, save the file and compile –
successfully without the error.</p></div></div><br class="example-break"><div class="example"><a name="idm3344"></a><p class="title"><b>Example 5.3. Replacing text in the whole file</b></p><div class="example-contents"><p>Imagine that you have a file, in which you mention a <span class="quote">“<span class="quote">Miss
Jensen</span>”</span> several times, when someone comes in and tells you that
she just got married to <span class="quote">“<span class="quote">Mr Jones</span>”</span>. You want, of course,
to replace each and every occurrence of <span class="quote">“<span class="quote">Miss Jensen</span>”</span>
with <span class="quote">“<span class="quote">Ms Jones</span>”</span>.</p><p>Enter the command line and issue the command
<strong class="userinput"><code>%s/Miss Jensen/Ms Jones/</code></strong> and hit return, you
are done.</p></div></div><br class="example-break"><div class="example"><a name="idm3353"></a><p class="title"><b>Example 5.4. A More Advanced Example</b></p><div class="example-contents"><p>This example makes use of <span class="emphasis"><em>back references</em></span>
as well as a <span class="emphasis"><em>character class</em></span> (if you do not know what
that is, please refer to the related documentation mentioned
below).</p><p>Suppose you have the following line:

</p><pre class="programlisting">void MyClass::DoStringOps( String      &amp;foo, String &amp;bar, String *p, int  &amp;a, int &amp;b )</pre><p>
</p><p>Now you realize that this is not nice code, and decide that you
want to use the <code class="constant">const</code> keyword for all
<span class="quote">“<span class="quote">address of</span>”</span> arguments, those characterized by the &amp;
operator in front of the argument name. You would also like to
simplify the white space, so that there is only 1 whitespace character
between each word.</p><p>Launch the Editing Command Dialog, and enter:
<strong class="userinput"><code>s/\s+(\w+)\s+(&amp;)/ const \1 \2/g</code></strong> and hit the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">OK</span></span> button. The <strong class="userinput"><code>g</code></strong> at the end of the expression makes
the regular expression recompile for each match to save the <span class="emphasis"><em>backreferences</em></span>.</p><p>Output:

<code class="computeroutput">void MyClass::DoStringOps( const String &amp;foo, const String &amp;bar, String *p, const int &amp;a, const int &amp;b )</code></p><p>Mission completed! Now, what happened? Well, we looked for some
white space (<code class="literal">\s+</code>) followed by one or more
alphabetic characters (<code class="literal">\w+</code>) followed by some more
whitespace (<code class="literal">\s+</code>) followed by an ampersand, and in
the process saved the alphabetic chunk and the ampersand for reuse in
the replace operation. Then we replaced the matching part of our line
with one whitespace followed by <span class="quote">“<span class="quote">const</span>”</span> followed by one
whitespace followed by our saved alphabetical chunk
(<code class="literal">\1</code>) followed by one whitespace followed by our
saved ampersand (<code class="literal">\2</code>)</p><p>Now in some cases the alphabetical chunk was
<span class="quote">“<span class="quote">String</span>”</span>, in some <span class="quote">“<span class="quote">int</span>”</span>, so using the
character class <code class="literal">\w</code> and the <code class="literal">+</code>
quantifier proved a valuable asset.</p></div></div><br class="example-break"></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>sort</strong></span></span></p></div></span></dt><dd><p>Sorts the selected text or entire document.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>natsort</strong></span></span></p></div></span></dt><dd><p>Sort the selected lines or entire document naturally.</p><div class="example"><a name="idm3394"></a><p class="title"><b>Example 5.5. <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command">sort</span></span> vs. <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command">natsort</span></span></b></p><div class="example-contents"><p><strong class="userinput"><code><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>sort</strong></span></span>(a10, a1, a2)</code></strong> results in
                            <code class="computeroutput">a1, a10, a2</code></p><p><strong class="userinput"><code><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>natsort</strong></span></span>(a10, a1, a2)</code></strong> results in
                            <code class="computeroutput">a1, a2, a10</code></p></div></div><br class="example-break"></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>moveLinesDown</strong></span></span></p></div></span></dt><dd><p>Move selected lines down.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>moveLinesUp</strong></span></span></p></div></span></dt><dd><p>Move selected lines up.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>uniq</strong></span></span></p></div></span></dt><dd><p>Remove duplicated lines from the selected text or the whole
document.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>rtrim</strong></span></span></p></div></span></dt><dd><p>Remove trailing space from the selected text or the whole
document.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>ltrim</strong></span></span></p></div></span></dt><dd><p>Remove leading space from the selected text or the whole
document.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>join</strong></span></span> [STRING separator]</p></div></span></dt><dd><p>Join selected lines or whole document.  Optionally takes a parameter
defining a separator, for example:  <strong class="userinput"><code><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>join</strong></span></span> ', '</code></strong>
</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>rmblank</strong></span></span></p></div></span></dt><dd><p>Remove all blank spaces from the selected text or the whole
document.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>alignon</strong></span></span></p></div></span></dt><dd><p>This command aligns lines in the selected block or whole document on the column given by a regular expression given as an argument.</p><p>If you give an empty pattern it will align on the first non-blank character by default.</p><p>If the pattern has a capture it will indent on the captured match.</p><p><span class="emphasis"><em>Examples:</em></span></p><p><strong class="userinput"><code>alignon -</code></strong> will insert spaces before the first '-' of each lines to align them all on the same column.</p><p><strong class="userinput"><code>alignon :\\s+(.)</code></strong> will insert spaces before the first non-blank character that occurs after a colon to align them all on the same column.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>unwrap</strong></span></span></p></div></span></dt><dd><p>Unwrap the selected text or the whole document.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>each</strong></span></span> {STRING script}</p></div></span></dt><dd><p>Given a <span class="application">JavaScript</span> function as an argument, call that for the list of
selected lines and replace them with the return value of that callback.</p><div class="example"><a name="idm3479"></a><p class="title"><b>Example 5.6. Join selected lines</b></p><div class="example-contents"><p><strong class="userinput"><code><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>each</strong></span></span> 'function(lines){return lines.join(", ")}'
</code></strong></p><p>Or, more briefly:</p><p><strong class="userinput"><code><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>each</strong></span></span> 'lines.join(", ")'</code></strong></p></div></div><br class="example-break"></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>filter</strong></span></span> {STRING script}</p></div></span></dt><dd><p>Given a <span class="application">JavaScript</span> function as an argument, call that for the list of
selected lines and remove those where the callback returns false.</p><div class="example"><a name="idm3496"></a><p class="title"><b>Example 5.7. Remove blank lines</b></p><div class="example-contents"><p><strong class="userinput"><code><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>filter</strong></span></span> 'function(1){return 1.length &gt; 0;}'
</code></strong></p><p>Or, more briefly:</p><p><strong class="userinput"><code><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>filter</strong></span></span> 'line.length &gt; 0'</code></strong></p></div></div><br class="example-break"></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>map</strong></span></span> {STRING script}</p></div></span></dt><dd><p>Given a <span class="application">JavaScript</span> function as an argument, call that for the list of
selected lines and replace the line with the value of the callback.</p><div class="example"><a name="idm3513"></a><p class="title"><b>Example 5.8. Remove blank lines</b></p><div class="example-contents"><p><strong class="userinput"><code><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>map</strong></span></span> 'function(line){return
line.replace(/^s+/,"");}'
</code></strong></p><p>Or, more briefly:</p><p><strong class="userinput"><code><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>map</strong></span></span> 'line.replace(/^s+/,"")'</code></strong></p></div></div><br class="example-break"></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>duplicateLinesUp</strong></span></span></p></div></span></dt><dd><p>Duplicate the selected lines above the current selection.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>duplicateLinesDown</strong></span></span></p></div></span></dt><dd><p>Duplicate the selected lines below the current selection.</p></dd></dl></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="advanced-editing-tools-commandline-commands-navigation"></a>Commands for navigation</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>goto</strong></span></span> {INT line}</p></div></span></dt><dd><p>This command navigates to the specified line.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>grep</strong></span></span> {STRING pattern}</p></div></span></dt><dd><p>Search the document for the regular expression
<strong class="userinput"><code>pattern</code></strong>. For more information, see
<a class="xref" href="regular-expressions.html" title="Appendix A. Regular Expressions">Appendix A, <i>Regular Expressions</i></a>.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>find</strong></span></span> {STRING pattern}</p></div></span></dt><dd><p>This command navigates to the first occurrence of
<strong class="userinput"><code>pattern</code></strong> according to the configuration. Following
occurrences can be found using
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Find Next</span></span>
(the default shortcut is <span class="keycap"><strong>F3</strong></span>).</p><p>The find command can be configured by appending a colon followed by one or
more options, the form is
<strong class="userinput"><code>find:options pattern</code></strong>. The
    following options are supported:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><strong class="userinput"><code>b</code></strong></span></dt><dd><p>Search backwards.</p></dd><dt><span class="term"><strong class="userinput"><code>c</code></strong></span></dt><dd><p>Search from cursor position.</p></dd><dt><span class="term"><strong class="userinput"><code>e</code></strong></span></dt><dd><p>Search in the selection only.</p></dd><dt><span class="term"><strong class="userinput"><code>r</code></strong></span></dt><dd><p>Do regular expression search. If set, you may use
<strong class="userinput"><code>\N</code></strong> where N is a number to represent captures in the
replacement string.</p></dd><dt><span class="term"><strong class="userinput"><code>s</code></strong></span></dt><dd><p>Do case sensitive search.</p></dd><dt><span class="term"><strong class="userinput"><code>w</code></strong></span></dt><dd><p>Match whole words only.</p></dd></dl></div></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>ifind</strong></span></span> {STRING pattern}</p></div></span></dt><dd><p>This command provides <span class="quote">“<span class="quote">as-you-type</span>”</span> searching. You
can configure the behavior of the search by appending a colon
followed by one or more options, like this:
<strong class="userinput"><code>ifind:options pattern</code></strong>. Allowed options are:

</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><strong class="userinput"><code>b</code></strong></span></dt><dd><p>Search backwards.</p></dd><dt><span class="term"><strong class="userinput"><code>r</code></strong></span></dt><dd><p>Do regular expression search.</p></dd><dt><span class="term"><strong class="userinput"><code>s</code></strong></span></dt><dd><p>Do case sensitive search.</p></dd><dt><span class="term"><strong class="userinput"><code>c</code></strong></span></dt><dd><p>Search from cursor position.</p></dd></dl></div><p>
</p></dd></dl></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="advanced-editing-tools-commandline-commands-basic"></a>Commands for Basic Editor Functions (These depend on the application the editor component is used in)</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>w</strong></span></span></p></div></span></dt><dd><p>Save the current document.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>wa</strong></span></span></p></div></span></dt><dd><p>Save all currently open documents.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>q</strong></span></span></p></div></span></dt><dd><p>Close the current document.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>qa</strong></span></span></p></div></span></dt><dd><p>Close all open documents.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>wq</strong></span></span></p></div></span></dt><dd><p>Save and close the current document.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>wqa</strong></span></span></p></div></span></dt><dd><p>Save and close all currently open documents.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>x</strong></span></span></p></div></span></dt><dd><p>Save and close the current document only if it has changed.
</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>x</strong></span></span></p></div></span></dt><dd><p>Save and close all currently open documents only if they have
changed.</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>bp</strong></span></span></p></div></span></dt><dd><p>Go to the previous document in the documents list.
</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>bn</strong></span></span></p></div></span></dt><dd><p>Go to the next document in the documents list.
</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>new</strong></span></span></p></div></span></dt><dd><p>Open a new document in horizontal split view.
</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>vnew</strong></span></span></p></div></span></dt><dd><p>Open a new document in vertical split view.
</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>e</strong></span></span></p></div></span></dt><dd><p>Reload the current document if it has changed on disk.
</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>enew</strong></span></span></p></div></span></dt><dd><p>Edit a new document.
</p></dd><dt><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>print</strong></span></span></p></div></span></dt><dd><p>Open the Print dialog to print the current document.
</p></dd></dl></div></div></div></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="advanced-editing-tools.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="advanced-editing-tools-code-folding.html">Next</a></td></tr><tr><td class="prevCell">Advanced Editing Tools </td><td class="upCell">Advanced Editing Tools</td><td class="nextCell"> Using Code Folding</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="advanced-editing-tools-code-folding.html"><html><head><title>Using Code Folding</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="advanced-editing-tools.html" title="Chapter 5. Advanced Editing Tools"><link rel="prev" href="advanced-editing-tools-commandline.html" title="The Editor Component Command Line"><link rel="next" href="dev.html" title="Chapter 6. Extending KatePart"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Using Code Folding</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="advanced-editing-tools-commandline.html">Prev</a></td><td class="upCell">Advanced Editing Tools</td><td class="nextCell"><a accesskey="n" href="dev.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="advanced-editing-tools-code-folding"></a>Using Code Folding</h2></div></div></div><p>Code folding allows you to hide parts of a document in the editor, making
it easier to overview large documents. In <span class="application">KatePart</span> the foldable regions are
calculated using rules defined in the syntax highlight definitions, and
therefore it is only available in some formats - typically program source code,
XML markup and similar. Most highlight definitions supporting code folding
also lets you manually define foldable regions, typically using the
<strong class="userinput"><code>BEGIN</code></strong> and <strong class="userinput"><code>END</code></strong> keywords.</p><p>To use the code folding feature, activate the folding markers using
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">View</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Show Folding
Markers</span></span> menu item if they are not already visible.
The Folding Markers Pane on the left side of the screen displays a graphical
view of the foldable regions, with triangle symbols to indicate the possible operation
on a given region: a top down triangle means that the region is expanded, clicking it will
collapse the region and a right pointing triangle will be displayed instead.</p><p>Three commands are provided to manipulate the state of folding regions,
 see the <a class="link" href="view-menu.html#view-code-folding">menu documentation</a>.
 </p><p>The folded lines are remembered when a file is closed, so when you reopen
the file the folded nodes will still be folded. This applies to reload operations
as well.</p><p>If you do not want to use the code folding feature, you can disable
the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Show folding markers (if available)</span></span> option in the
<a class="link" href="config-dialog.html#appearance" title="Appearance">Appearance</a> page of the editor
configuration.</p></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="advanced-editing-tools-commandline.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="dev.html">Next</a></td></tr><tr><td class="prevCell">The Editor Component Command Line </td><td class="upCell">Advanced Editing Tools</td><td class="nextCell"> Extending <span class="application">KatePart</span></td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="settings-help-menu.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="advanced-editing-tools-commandline.html">Next</a></td></tr><tr><td class="prevCell">The Settings and Help Menu </td><td class="upCell"> </td><td class="nextCell"> The Editor Component Command Line</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="dev.html"><html><head><title>Chapter 6. Extending KatePart</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="index.html" title="The KatePart Handbook"><link rel="prev" href="advanced-editing-tools-code-folding.html" title="Using Code Folding"><link rel="next" href="highlight.html" title="Working with Syntax Highlighting"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Extending <span class="application">KatePart</span></div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="advanced-editing-tools-code-folding.html">Prev</a></td><td class="upCell"> </td><td class="nextCell"><a accesskey="n" href="highlight.html">Next</a></td></tr></table></div><div id="contentBody"><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="dev"></a>Chapter 6. Extending <span class="application">KatePart</span></h1></div><div><div class="authorgroup"><p class="author"><span class="firstname">T.C.</span> <span class="surname">Hollingsworth</span> <code class="email">&lt;tchollingsworth@gmail.com&gt;</code></p></div></div></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dev-intro"></a>Introduction</h2></div></div></div><p>Like any advanced text editor component, <span class="application">KatePart</span> offers a variety of
ways to extend its functionality.  You can <a class="link" href="dev-scripting.html" title="Scripting with JavaScript">write
simple scripts to add functionality with <span class="application">JavaScript</span></a>.
Finally, once you have extended <span class="application">KatePart</span>, you are
welcome to <a class="ulink" href="https://kate-editor.org/join-us/" target="_top">join us</a>
and share your enhancements with the world!</p></div><FILENAME filename="highlight.html"><html><head><title>Working with Syntax Highlighting</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="dev.html" title="Chapter 6. Extending KatePart"><link rel="prev" href="dev.html" title="Chapter 6. Extending KatePart"><link rel="next" href="color-themes.html" title="Working with Color Themes"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Working with Syntax Highlighting</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="dev.html">Prev</a></td><td class="upCell">Extending <span class="application">KatePart</span></td><td class="nextCell"><a accesskey="n" href="color-themes.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="highlight"></a>Working with Syntax Highlighting</h2></div></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="highlight-overview"></a>Overview</h3></div></div></div><p>Syntax Highlighting is what makes the editor automatically
display text in different styles/colors, depending on the function of
the string in relation to the purpose of the file.  In program source
code for example, control statements may be rendered bold, while data
types and comments get different colors from the rest of the
text. This greatly enhances the readability of the text, and thus
helps the author to be more efficient and productive.</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="highlighted.png" alt="A C++ function, rendered with syntax highlighting."><div class="caption"><p>A C++ function, rendered with syntax highlighting.</p></div></div><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="unhighlighted.png" alt="The same C++ function, without highlighting."><div class="caption"><p>The same C++ function, without highlighting.</p></div></div><p>Of the two examples, which is easiest to read?</p><p><span class="application">KatePart</span> comes with a flexible, configurable and capable system
for doing syntax highlighting, and the standard distribution provides
definitions for a wide range of programming, scripting and markup
languages and other text file formats. In addition you can
provide your own definitions in simple <acronym class="acronym">XML</acronym> files.</p><p><span class="application">KatePart</span> will automatically detect the right syntax rules when you
open a file, based on the <acronym class="acronym">MIME</acronym> Type of the file, determined by its
extension, or, if it has none, the contents. Should you experience a
bad choice, you can manually set the syntax to use from the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Highlighting
</span></span> menu.</p><p>The styles and colors used by each syntax highlight definition
can be configured using the <a class="link" href="color-themes.html#prefcolors-highlighting-text-styles" title="Highlighting Text Styles">Highlighting Text Styles</a> tab of the
<a class="link" href="config-dialog.html" title="Chapter 7. Configure KatePart">Config Dialog</a>, while the <acronym class="acronym">MIME</acronym> Types and
file extensions it should be used for are handled by the <a class="link" href="config-dialog.html#pref-open-save-modes-filetypes" title="Modes &amp; Filetypes">Modes &amp; Filetypes</a>
tab.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Syntax highlighting is there to enhance the readability of
correct text, but you cannot trust it to validate your text. Marking
text for syntax is difficult depending on the format you are using,
and in some cases the authors of the syntax rules will be proud if 98%
of text gets correctly rendered, though most often you need a rare
style to see the incorrect 2%.</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="katehighlight-system"></a>The <span class="application">KatePart</span> Syntax Highlight System</h3></div></div></div><p>This section will discuss the <span class="application">KatePart</span> syntax highlighting
mechanism in more detail. It is for you if you want to know about
it, or if you want to change or create syntax definitions.</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="katehighlight-howitworks"></a>How it Works</h4></div></div></div><p>Whenever you open a file, one of the first things the <span class="application">KatePart</span>
editor does is detect which syntax definition to use for the
file. While reading the text of the file, and while you type away in
it, the syntax highlighting system will analyze the text using the
rules defined by the syntax definition and mark in it where different
contexts and styles begin and end.</p><p>When you type in the document, the new text is analyzed and marked on the
fly, so that if you delete a character that is marked as the beginning or end
of a context, the style of surrounding text changes accordingly.</p><p>The syntax definitions used by the <span class="application">KatePart</span> Syntax Highlighting System are
<acronym class="acronym">XML</acronym> files, containing
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>Rules for detecting the role of text, organized into context blocks</p></li><li class="listitem"><p>Keyword lists</p></li><li class="listitem"><p>Style Item definitions</p></li></ul></div><p>
</p><p>When analyzing the text, the detection rules are evaluated in
the order in which they are defined, and if the beginning of the
current string matches a rule, the related context is used. The start
point in the text is moved to the final point at which that rule
matched and a new loop of the rules begins, starting in the context
set by the matched rule.</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="highlight-system-rules"></a>Rules</h4></div></div></div><p>The detection rules are the heart of the highlighting detection
system. A rule is a string, character or <a class="link" href="regular-expressions.html" title="Appendix A. Regular Expressions">regular expression</a> against which
to match the text being analyzed. It contains information about which
style to use for the matching part of the text. It may switch the
working context of the system either to an explicitly mentioned
context or to the previous context used by the text.</p><p>Rules are organized in context groups. A context group is used
for main text concepts within the format, for example quoted text
strings or comment blocks in program source code. This ensures that
the highlighting system does not need to loop through all rules when
it is not necessary, and that some character sequences in the text can
be treated differently depending on the current context.
</p><p>Contexts may be generated dynamically to allow the usage of instance
specific data in rules.</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="highlight-context-styles-keywords"></a>Context Styles and Keywords</h4></div></div></div><p>In some programming languages, integer numbers are treated
differently from floating point ones by the compiler (the program that
converts the source code to a binary executable), and there may be
characters having a special meaning within a quoted string. In such
cases, it makes sense to render them differently from the surroundings
so that they are easy to identify while reading the text. So even if
they do not represent special contexts, they may be seen as such by
the syntax highlighting system, so that they can be marked for
different rendering.</p><p>A syntax definition may contain as many styles as required to
cover the concepts of the format it is used for.</p><p>In many formats, there are lists of words that represent a
specific concept. For example, in programming languages, control
statements are one concept, data type names another, and built in
functions of the language a third. The <span class="application">KatePart</span> Syntax Highlighting
System can use such lists to detect and mark words in the text to
emphasize concepts of the text formats.</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="kate-highlight-system-default-styles"></a>Default Styles</h4></div></div></div><p>If you open a C++ source file, a <span class="trademark">Java</span>™ source file and an
<acronym class="acronym">HTML</acronym> document in <span class="application">KatePart</span>, you will see that even
though the formats are different, and thus different words are chosen
for special treatment, the colors used are the same. This is because
<span class="application">KatePart</span> has a predefined list of Default Styles which are employed by
the individual syntax definitions.</p><p>This makes it easy to recognize similar concepts in different
text formats. For example, comments are present in almost any
programming, scripting or markup language, and when they are rendered
using the same style in all languages, you do not have to stop and
think to identify them within the text.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><p>All styles in a syntax definition use one of the default
styles. A few syntax definitions use more styles than there are
defaults, so if you use a format often, it may be worth launching the
configuration dialog to see if some concepts use the same
style. For example, there is only one default style for strings, but as
the Perl programming language operates with two types of strings, you
can enhance the highlighting by configuring those to be slightly
different. All <a class="link" href="highlight.html#kate-highlight-default-styles" title="Available Default Styles">available default styles</a>
will be explained later.</p></div></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="katehighlight-xml-format"></a>The Highlight Definition <acronym class="acronym">XML</acronym> Format</h3></div></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="idm3839"></a>Overview</h4></div></div></div><p><span class="application">KatePart</span> uses the Syntax-Highlighting framework from <span class="productname"><span class="orgname">KDE</span> Frameworks</span>.
The default highlighting <acronym class="acronym">XML</acronym> files shipped with <span class="application">KatePart</span> are compiled
into the Syntax-Highlighting library by default.
</p><p>This section is an overview of the Highlight Definition <acronym class="acronym">XML</acronym>
format. Based on a small example it will describe the main components
and their meaning and usage. The next section will go into detail with
the highlight detection rules.</p><p>The formal definition, also known as the <acronym class="acronym">XSD</acronym> you
find in <a class="ulink" href="https://commits.kde.org/syntax-highlighting?path=data/schema" target="_top">Syntax
Highlighting repository</a> in the file <code class="filename">language.xsd</code>
</p><p>Custom <code class="filename">.xml</code> highlight definition files are
located in <code class="filename">org.kde.syntax-highlighting/syntax/</code> in
your user folder found with <strong class="userinput"><code><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>qtpaths</strong></span></span><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="option"><code class="option"> --paths
GenericDataLocation</code></span></code></strong> which usually are
<code class="filename"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="envar"><code class="envar">$HOME</code></span>/.local/share/</code>
and <code class="filename">/usr/share/</code>.
</p><p>In Flatpak and Snap packages, the above directory will not work
as the data location is different for each application.
In a Flatpak application, the location of custom <acronym class="acronym">XML</acronym> files is usually
<code class="filename"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="envar"><code class="envar">$HOME</code></span>/.var/app/<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>flatpak-package-name</code></em></span>/data/org.kde.syntax-highlighting/syntax/</code>
and in a Snap application that location is
<code class="filename"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="envar"><code class="envar">$HOME</code></span>/snap/<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>snap-package-name</code></em></span>/current/.local/share/org.kde.syntax-highlighting/syntax/</code>.
</p><p>On <span class="trademark">Windows</span>® these files are located <code class="filename">%USERPROFILE%\AppData\Local\org.kde.syntax-highlighting\syntax</code>.
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>%USERPROFILE%</code></em></span> usually expands to <code class="filename">C:\Users\<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>user</code></em></span></code>.</p><p>In summary, for most configurations the directory of custom <acronym class="acronym">XML</acronym>
files is as follows:</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col><col></colgroup><tbody><tr><td>For local user</td><td><code class="filename"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="envar"><code class="envar">$HOME</code></span>/.local/share/org.kde.syntax-highlighting/syntax/</code></td></tr><tr><td>For all users</td><td><code class="filename">/usr/share/org.kde.syntax-highlighting/syntax/</code></td></tr><tr><td>For Flatpak packages</td><td><code class="filename"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="envar"><code class="envar">$HOME</code></span>/.var/app/<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>flatpak-package-name</code></em></span>/data/org.kde.syntax-highlighting/syntax/</code></td></tr><tr><td>For Snap packages</td><td><code class="filename"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="envar"><code class="envar">$HOME</code></span>/snap/<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>snap-package-name</code></em></span>/current/.local/share/org.kde.syntax-highlighting/syntax/</code></td></tr><tr><td>On <span class="trademark">Windows</span>®</td><td><code class="filename">%USERPROFILE%\AppData\Local\org.kde.syntax-highlighting\syntax</code></td></tr></tbody></table></div><p>If multiple files exist for the same language, the file with the highest <strong class="userinput"><code>version</code></strong> attribute in the <strong class="userinput"><code>language</code></strong> element will be loaded.</p><div class="variablelist"><p class="title"><b>Main sections of <span class="application">KatePart</span> Highlight Definition files</b></p><dl class="variablelist"><dt><span class="term">A highlighting file contains a header that sets the <acronym class="acronym">XML</acronym> version:</span></dt><dd><pre class="programlisting">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
</pre></dd><dt><span class="term">The root of the definition file is the element <strong class="userinput"><code>language</code></strong>.
Available attributes are:</span></dt><dd><p>Required attributes:</p><p><strong class="userinput"><code>name</code></strong> sets the name of the language. It appears in the menus and dialogs afterwards.</p><p><strong class="userinput"><code>section</code></strong> specifies the category.</p><p><strong class="userinput"><code>extensions</code></strong> defines file extensions, such as "*.cpp;*.h"</p><p><strong class="userinput"><code>version</code></strong> specifies the current revision of the definition file in terms of an integer number. Whenever you change a highlighting definition file, make sure to increase this number.</p><p><strong class="userinput"><code>kateversion</code></strong> specifies the latest supported <span class="application">KatePart</span> version.</p><p>Optional attributes:</p><p><strong class="userinput"><code>mimetype</code></strong> associates files <acronym class="acronym">MIME</acronym> type.</p><p><strong class="userinput"><code>casesensitive</code></strong> defines, whether the keywords are case sensitive or not.</p><p><strong class="userinput"><code>priority</code></strong> is necessary if another highlight definition file uses the same extensions. The higher priority will win.</p><p><strong class="userinput"><code>author</code></strong> contains the name of the author and his email-address.</p><p><strong class="userinput"><code>license</code></strong> contains the license, usually the MIT license for new syntax-highlighting files.</p><p><strong class="userinput"><code>style</code></strong> contains the provided language and is used by the indenters for the attribute <code class="literal">required-syntax-style</code>.</p><p><strong class="userinput"><code>indenter</code></strong> defines which indenter will be used by default. Available indenters are: <span class="emphasis"><em>ada, normal, cstyle, cmake, haskell, latex, lilypond, lisp, lua, pascal, python, replicode, ruby</em></span> and <span class="emphasis"><em>xml</em></span>.</p><p><strong class="userinput"><code>hidden</code></strong> defines whether the name should appear in <span class="application">KatePart</span>'s menus.</p><p>So the next line may look like this:</p><pre class="programlisting">
&lt;language name="C++" version="1" kateversion="2.4" section="Sources" extensions="*.cpp;*.h" /&gt;
</pre></dd><dt><span class="term">Next comes the <strong class="userinput"><code>highlighting</code></strong> element, which
contains the optional element <strong class="userinput"><code>list</code></strong> and the required
elements <strong class="userinput"><code>contexts</code></strong> and <strong class="userinput"><code>itemDatas</code></strong>.</span></dt><dd><p><strong class="userinput"><code>list</code></strong> elements contain a list of keywords. In
this case the keywords are <span class="emphasis"><em>class</em></span> and <span class="emphasis"><em>const</em></span>.
You can add as many lists as you need.</p><p>Since <span class="productname"><span class="orgname">KDE</span> Frameworks</span> 5.53, a list can include keywords from another
list or language/file, using the <strong class="userinput"><code>include</code></strong> element.
<strong class="userinput"><code>##</code></strong> is used to separate the list name and the language
definition name, in the same way as in the <strong class="userinput"><code>IncludeRules</code></strong> rule.
This is useful to avoid duplicating keyword lists, if you need to include the keywords
of another language/file. For example, the <span class="emphasis"><em>othername</em></span> list
contains the <span class="emphasis"><em>str</em></span> keyword and all the keywords of the
<span class="emphasis"><em>types</em></span> list, which belongs to the <span class="emphasis"><em>ISO C++</em></span>
language.</p><p>The <strong class="userinput"><code>contexts</code></strong> element contains all contexts.
The first context is by default the start of the highlighting. There are
two rules in the context <span class="emphasis"><em>Normal Text</em></span>, which match
the list of keywords with the name <span class="emphasis"><em>somename</em></span> and a
rule that detects a quote and switches the context to <span class="emphasis"><em>string</em></span>.
To learn more about rules read the next chapter.</p><p>The third part is the <strong class="userinput"><code>itemDatas</code></strong> element. It
contains all color and font styles needed by the contexts and rules.
In this example, the <strong class="userinput"><code>itemData</code></strong> <span class="emphasis"><em>Normal Text</em></span>,
<span class="emphasis"><em>String</em></span> and <span class="emphasis"><em>Keyword</em></span> are used.
</p><pre class="programlisting">
  &lt;highlighting&gt;
    &lt;list name="somename"&gt;
      &lt;item&gt;class&lt;/item&gt;
      &lt;item&gt;const&lt;/item&gt;
    &lt;/list&gt;
    &lt;list name="othername"&gt;
      &lt;item&gt;str&lt;/item&gt;
      &lt;include&gt;types##ISO C++&lt;/include&gt;
    &lt;/list&gt;
    &lt;contexts&gt;
      &lt;context attribute="Normal Text" lineEndContext="#pop" name="Normal Text" &gt;
        &lt;keyword attribute="Keyword" context="#stay" String="somename" /&gt;
        &lt;keyword attribute="Keyword" context="#stay" String="othername" /&gt;
        &lt;DetectChar attribute="String" context="string" char="&amp;quot;" /&gt;
      &lt;/context&gt;
      &lt;context attribute="String" lineEndContext="#stay" name="string" &gt;
        &lt;DetectChar attribute="String" context="#pop" char="&amp;quot;" /&gt;
      &lt;/context&gt;
    &lt;/contexts&gt;
    &lt;itemDatas&gt;
      &lt;itemData name="Normal Text" defStyleNum="dsNormal" /&gt;
      &lt;itemData name="Keyword" defStyleNum="dsKeyword" /&gt;
      &lt;itemData name="String" defStyleNum="dsString" /&gt;
    &lt;/itemDatas&gt;
  &lt;/highlighting&gt;
</pre></dd><dt><span class="term">The last part of a highlight definition is the optional
<strong class="userinput"><code>general</code></strong> section. It may contain information
about keywords, code folding, comments, indentation, empty lines and
spell checking.</span></dt><dd><p>The <strong class="userinput"><code>comment</code></strong> section defines with what
string a single line comment is introduced. You also can define a
multiline comment using <span class="emphasis"><em>multiLine</em></span> with the
additional attribute <span class="emphasis"><em>end</em></span>. This is used if the
user presses the corresponding shortcut for <span class="emphasis"><em>comment/uncomment</em></span>.</p><p>The <strong class="userinput"><code>keywords</code></strong> section defines whether
keyword lists are case sensitive or not. Other attributes will be
explained later.</p><p>The other sections, <strong class="userinput"><code>folding</code></strong>,
<strong class="userinput"><code>emptyLines</code></strong> and <strong class="userinput"><code>spellchecking</code></strong>,
are usually not necessary and are explained later.</p><pre class="programlisting">
  &lt;general&gt;
    &lt;comments&gt;
      &lt;comment name="singleLine" start="#"/&gt;
      &lt;comment name="multiLine" start="###" end="###" region="CommentFolding"/&gt;
    &lt;/comments&gt;
    &lt;keywords casesensitive="1"/&gt;
    &lt;folding indentationsensitive="0"/&gt;
    &lt;emptyLines&gt;
      &lt;emptyLine regexpr="\s+"/&gt;
      &lt;emptyLine regexpr="\s*#.*"/&gt;
    &lt;/emptyLines&gt;
    &lt;spellchecking&gt;
      &lt;encoding char="á" string="\'a"/&gt;
      &lt;encoding char="à" string="\`a"/&gt;
    &lt;/spellchecking&gt;
  &lt;/general&gt;
&lt;/language&gt;
</pre></dd></dl></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="kate-highlight-sections"></a>The Sections in Detail</h4></div></div></div><p>This part will describe all available attributes for contexts,
itemDatas, keywords, comments, code folding and indentation.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">The element <strong class="userinput"><code>context</code></strong> belongs in the group
<strong class="userinput"><code>contexts</code></strong>. A context itself defines context specific
rules such as what should happen if the highlight system reaches the end of a
line. Available attributes are:</span></dt><dd><p><strong class="userinput"><code>name</code></strong> states the context name. Rules will use this name
to specify the context to switch to if the rule matches.</p><p><strong class="userinput"><code>lineEndContext</code></strong> defines the context the highlight
system switches to if it reaches the end of a line. This may either be a name
of another context, <strong class="userinput"><code>#stay</code></strong> to not switch the context
(<abbr class="abbrev">e.g.</abbr>. do nothing) or <strong class="userinput"><code>#pop</code></strong> which will cause it to leave this
context. It is possible to use for example <strong class="userinput"><code>#pop#pop#pop</code></strong>
to pop three times, or even <strong class="userinput"><code>#pop#pop!OtherContext</code></strong> to pop
two times and switch to the context named <strong class="userinput"><code>OtherContext</code></strong>.
It is also possible to switch to a context that belongs to another language definition,
in the same way as in the <strong class="userinput"><code>IncludeRules</code></strong> rules, <abbr class="abbrev">e.g.</abbr>,
<strong class="userinput"><code>SomeContext##JavaScript</code></strong>. Note that it is not possible to use
this context switch in combination with <strong class="userinput"><code>#pop</code></strong>, for example,
<strong class="userinput"><code>#pop!SomeContext##JavaScript</code></strong> is not valid.
Context switches are also described in <a class="xref" href="highlight.html#kate-highlight-rules-detailled" title="Highlight Detection Rules">the section called “Highlight Detection Rules”</a>.</p><p><strong class="userinput"><code>lineEmptyContext</code></strong> defines the context if an empty
line is encountered. The nomenclature of context switches is the same as
previously described in <span class="emphasis"><em>lineEndContext</em></span>. Default: #stay.</p><p><strong class="userinput"><code>fallthroughContext</code></strong> specifies the next context to
switch to if no rule matches. The nomenclature of context switches is
the same as previously described in <span class="emphasis"><em>lineEndContext</em></span>.
Default: #stay.</p><p><strong class="userinput"><code>fallthrough</code></strong> defines if the highlight system switches
to the context specified in <strong class="userinput"><code>fallthroughContext</code></strong> if no rule
matches. Note that since <span class="orgname">KDE</span> <span class="productname">Frameworks</span> 5.62 this attribute is deprecated
in favor of <strong class="userinput"><code>fallthroughContext</code></strong>, since if the
<strong class="userinput"><code>fallthroughContext</code></strong> attribute is present it is implicitly
understood that the value of <strong class="userinput"><code>fallthrough</code></strong> is
<span class="emphasis"><em>true</em></span>. Default: <span class="emphasis"><em>false</em></span>.</p><p><strong class="userinput"><code>noIndentationBasedFolding</code></strong> disables indentation-based folding
in the context. If indentation-based folding is not activated, this attribute is useless.
This is defined in the element <span class="emphasis"><em>folding</em></span> of the group <span class="emphasis"><em>general</em></span>.
Default: <span class="emphasis"><em>false</em></span>.</p></dd><dt><span class="term">The element <strong class="userinput"><code>itemData</code></strong> is in the group
<strong class="userinput"><code>itemDatas</code></strong>. It defines the font style and colors.
So it is possible to define your own styles and colors. However, we
recommend you stick to the default styles if possible so that the user
will always see the same colors used in different languages. Though,
sometimes there is no other way and it is necessary to change color
and font attributes. The attributes name and defStyleNum are required,
the others are optional. Available attributes are:</span></dt><dd><p><strong class="userinput"><code>name</code></strong> sets the name of the itemData.
Contexts and rules will use this name in their attribute
<span class="emphasis"><em>attribute</em></span> to reference an itemData.</p><p><strong class="userinput"><code>defStyleNum</code></strong> defines which default style to use.
Available default styles are explained in detail later.</p><p><strong class="userinput"><code>color</code></strong> defines a color. Valid formats are
'#rrggbb' or '#rgb'.</p><p><strong class="userinput"><code>selColor</code></strong> defines the selection color.</p><p><strong class="userinput"><code>italic</code></strong> if <span class="emphasis"><em>true</em></span>, the text will be italic.</p><p><strong class="userinput"><code>bold</code></strong> if <span class="emphasis"><em>true</em></span>, the text will be bold.</p><p><strong class="userinput"><code>underline</code></strong> if <span class="emphasis"><em>true</em></span>, the text will be underlined.</p><p><strong class="userinput"><code>strikeout</code></strong> if <span class="emphasis"><em>true</em></span>, the text will be struck out.</p><p><strong class="userinput"><code>spellChecking</code></strong> if <span class="emphasis"><em>true</em></span>, the text will be spellchecked.</p></dd><dt><span class="term">The element <strong class="userinput"><code>keywords</code></strong> in the group
<strong class="userinput"><code>general</code></strong> defines keyword properties. Available attributes are:</span></dt><dd><p><strong class="userinput"><code>casesensitive</code></strong> may be <span class="emphasis"><em>true</em></span>
or <span class="emphasis"><em>false</em></span>. If <span class="emphasis"><em>true</em></span>, all keywords
are matched case sensitively.</p><p><strong class="userinput"><code>weakDeliminator</code></strong> is a list of characters that
do not act as word delimiters. For example, the dot <strong class="userinput"><code>'.'</code></strong>
is a word delimiter. Assume a keyword in a <strong class="userinput"><code>list</code></strong> contains
a dot, it will only match if you specify the dot as a weak delimiter.</p><p><strong class="userinput"><code>additionalDeliminator</code></strong> defines additional delimiters.</p><p><strong class="userinput"><code>wordWrapDeliminator</code></strong> defines characters after which a
line wrap may occur.</p><p>Default delimiters and word wrap delimiters are the characters
<strong class="userinput"><code>.():!+,-&lt;=&gt;%&amp;*/;?[]^{|}~\</code></strong>, space (<strong class="userinput"><code>' '</code></strong>)
and tabulator (<strong class="userinput"><code>'\t'</code></strong>).</p></dd><dt><span class="term">The element <strong class="userinput"><code>comment</code></strong> in the group
<strong class="userinput"><code>comments</code></strong> defines comment properties which are used
for <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Comment</span></span>,
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Uncomment</span></span> and
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Toggle Comment</span></span>.
Available attributes are:</span></dt><dd><p><strong class="userinput"><code>name</code></strong> is either <span class="emphasis"><em>singleLine</em></span>
or <span class="emphasis"><em>multiLine</em></span>. If you choose <span class="emphasis"><em>multiLine</em></span>
the attributes <span class="emphasis"><em>end</em></span> and <span class="emphasis"><em>region</em></span> are
required. If you choose <span class="emphasis"><em>singleLine</em></span> you can add the optional
attribute <span class="emphasis"><em>position</em></span>.</p><p><strong class="userinput"><code>start</code></strong> defines the string used to start a comment.
In C++ this would be "/*" in multiline comments. This attribute is required
for types <span class="emphasis"><em>multiLine</em></span> and <span class="emphasis"><em>singleLine</em></span>.</p><p><strong class="userinput"><code>end</code></strong> defines the string used to close a comment.
In C++ this would be "*/". This attribute is only available and is
required for comments of type <span class="emphasis"><em>multiLine</em></span>.</p><p><strong class="userinput"><code>region</code></strong> should be the name of the foldable
multiline comment. Assume you have <span class="emphasis"><em>beginRegion="Comment"</em></span>
... <span class="emphasis"><em>endRegion="Comment"</em></span> in your rules, you should use
<span class="emphasis"><em>region="Comment"</em></span>. This way uncomment works even if you
do not select all the text of the multiline comment. The cursor only must be
in the multiline comment. This attribute is only available for type
<span class="emphasis"><em>multiLine</em></span>.</p><p><strong class="userinput"><code>position</code></strong> defines where the single line comment is inserted.
By default, the single line comment is placed at the beginning of the line at column 0,
but if you use <span class="emphasis"><em>position="afterwhitespace"</em></span> the comment is
inserted after leading whitespaces right, before the first non-whitespace character.
This is useful for putting comments correctly in languages where indentation
is important, such as Python or YAML. This attribute is optional and the only
possible value is <span class="emphasis"><em>afterwhitespace</em></span>.
This is only available for type <span class="emphasis"><em>singleLine</em></span>.</p></dd><dt><span class="term">The element <strong class="userinput"><code>folding</code></strong> in the group
<strong class="userinput"><code>general</code></strong> defines code folding properties.
Available attributes are:</span></dt><dd><p><strong class="userinput"><code>indentationsensitive</code></strong> if <span class="emphasis"><em>true</em></span>, the code folding markers
will be added indentation based, as in the scripting language Python. Usually you
do not need to set it, as it defaults to <span class="emphasis"><em>false</em></span>.</p></dd><dt><span class="term">The element <strong class="userinput"><code>emptyLine</code></strong> in the group <strong class="userinput"><code>emptyLines</code></strong>
defines which lines should be treated as empty lines. This allows modifying the behavior of the
<span class="emphasis"><em>lineEmptyContext</em></span> attribute in the elements <strong class="userinput"><code>context</code></strong>.
Available attributes are:</span></dt><dd><p><strong class="userinput"><code>regexpr</code></strong> defines a regular expression that will be treated as an empty line.
By default, empty lines do not contain any characters, therefore, this adds additional empty lines,
for example, if you want lines with spaces to also be considered empty lines.
However, in most syntax definitions you do not need to set this attribute.</p></dd><dt><span class="term">The element <strong class="userinput"><code>encoding</code></strong> in the group <strong class="userinput"><code>spellchecking</code></strong>
defines a character encoding for spell checking. Available attributes:</span></dt><dd><p><strong class="userinput"><code>char</code></strong> is a encoded character.</p><p><strong class="userinput"><code>string</code></strong> is a sequence of characters that will be encoded as
the character <span class="emphasis"><em>char</em></span> in the spell checking.
For example, in the language LaTeX, the string <strong class="userinput"><code>\"{A}</code></strong> represents
the character <strong class="userinput"><code>Ä</code></strong>.</p></dd></dl></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="kate-highlight-default-styles"></a>Available Default Styles</h4></div></div></div><p>Default Styles were <a class="link" href="highlight.html#kate-highlight-system-default-styles" title="Default Styles">already explained</a>,
as a short summary: Default styles are predefined font and color styles.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">General default styles:</span></dt><dd><p><strong class="userinput"><code>dsNormal</code></strong>, when no special highlighting is required.</p><p><strong class="userinput"><code>dsKeyword</code></strong>, built-in language keywords.</p><p><strong class="userinput"><code>dsFunction</code></strong>, function calls and definitions.</p><p><strong class="userinput"><code>dsVariable</code></strong>, if applicable: variable names (<abbr class="abbrev">e.g.</abbr> $someVar in PHP/Perl).</p><p><strong class="userinput"><code>dsControlFlow</code></strong>, control flow keywords like if, else, switch, break, return, yield, ...</p><p><strong class="userinput"><code>dsOperator</code></strong>, operators like + - * / :: &lt; &gt;</p><p><strong class="userinput"><code>dsBuiltIn</code></strong>, built-in functions, classes, and objects.</p><p><strong class="userinput"><code>dsExtension</code></strong>, common extensions, such as <span class="trademark">Qt</span>™ classes and functions/macros in C++ and Python.</p><p><strong class="userinput"><code>dsPreprocessor</code></strong>, preprocessor statements or macro definitions.</p><p><strong class="userinput"><code>dsAttribute</code></strong>, annotations such as @override and __declspec(...).</p></dd><dt><span class="term">String-related default styles:</span></dt><dd><p><strong class="userinput"><code>dsChar</code></strong>, single characters, such as 'x'.</p><p><strong class="userinput"><code>dsSpecialChar</code></strong>, chars with special meaning in strings such as escapes, substitutions, or regex operators.</p><p><strong class="userinput"><code>dsString</code></strong>, strings like "hello world".</p><p><strong class="userinput"><code>dsVerbatimString</code></strong>, verbatim or raw strings like 'raw \backlash' in Perl, CoffeeScript, and shells, as well as r'\raw' in Python.</p><p><strong class="userinput"><code>dsSpecialString</code></strong>, SQL, regexes, HERE docs, L<sup>A</sup>T<sub>E</sub>X math mode, ...</p><p><strong class="userinput"><code>dsImport</code></strong>, import, include, require of modules.</p></dd><dt><span class="term">Number-related default styles:</span></dt><dd><p><strong class="userinput"><code>dsDataType</code></strong>, built-in data types like int, void, u64.</p><p><strong class="userinput"><code>dsDecVal</code></strong>, decimal values.</p><p><strong class="userinput"><code>dsBaseN</code></strong>, values with a base other than 10.</p><p><strong class="userinput"><code>dsFloat</code></strong>, floating point values.</p><p><strong class="userinput"><code>dsConstant</code></strong>, built-in and user defined constants like PI.</p></dd><dt><span class="term">Comment and documentation-related default styles:</span></dt><dd><p><strong class="userinput"><code>dsComment</code></strong>, comments.</p><p><strong class="userinput"><code>dsDocumentation</code></strong>, /** Documentation comments */ or """docstrings""".</p><p><strong class="userinput"><code>dsAnnotation</code></strong>, documentation commands like @param, @brief.</p><p><strong class="userinput"><code>dsCommentVar</code></strong>, the variable names used in above commands, like "foobar" in @param foobar.</p><p><strong class="userinput"><code>dsRegionMarker</code></strong>, region markers like //BEGIN, //END in comments.</p></dd><dt><span class="term">Other default styles:</span></dt><dd><p><strong class="userinput"><code>dsInformation</code></strong>, notes and tips like @note in doxygen.</p><p><strong class="userinput"><code>dsWarning</code></strong>, warnings like @warning in doxygen.</p><p><strong class="userinput"><code>dsAlert</code></strong>, special words like TODO, FIXME, XXXX.</p><p><strong class="userinput"><code>dsError</code></strong>, error highlighting and wrong syntax.</p><p><strong class="userinput"><code>dsOthers</code></strong>, when nothing else fits.</p></dd></dl></div></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="kate-highlight-rules-detailled"></a>Highlight Detection Rules</h3></div></div></div><p>This section describes the syntax detection rules.</p><p>Each rule can match zero or more characters at the beginning of
the string they are tested against. If the rule matches, the matching
characters are assigned the style or <span class="emphasis"><em>attribute</em></span>
defined by the rule, and a rule may ask that the current context is
switched.</p><p>A rule looks like this:</p><pre class="programlisting">&lt;RuleName attribute="(identifier)" context="(identifier)" [rule specific attributes] /&gt;</pre><p>The <span class="emphasis"><em>attribute</em></span> identifies the style to use
for matched characters by name, and the <span class="emphasis"><em>context</em></span>
identifies the context to use from here.</p><p>The <span class="emphasis"><em>context</em></span> can be identified by:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>An <span class="emphasis"><em>identifier</em></span>, which is the name of the other
context.</p></li><li class="listitem"><p>An <span class="emphasis"><em>order</em></span> telling the engine to stay in the
current context (<strong class="userinput"><code>#stay</code></strong>), or to pop back to a
previous context used in the string (<strong class="userinput"><code>#pop</code></strong>).</p><p>To go back more steps, the #pop keyword can be repeated:
<strong class="userinput"><code>#pop#pop#pop</code></strong></p></li><li class="listitem"><p>An <span class="emphasis"><em>order</em></span> followed by an exclamation mark
(<span class="emphasis"><em>!</em></span>) and an <span class="emphasis"><em>identifier</em></span>, which
will make the engine first follow the order and then switch to the
other context, <abbr class="abbrev">e.g.</abbr> <strong class="userinput"><code>#pop#pop!OtherContext</code></strong>.</p></li><li class="listitem"><p>An <span class="emphasis"><em>identifier</em></span>, which is a context name,
followed by two hashes (<strong class="userinput"><code>##</code></strong>) and another
<span class="emphasis"><em>identifier</em></span>, which is the name of a language definition.
This naming is similar to that used in <strong class="userinput"><code>IncludeRules</code></strong>
rules and allows you to switch to a context belonging to another syntax
highlighting definition, e.g. <strong class="userinput"><code>SomeContext##JavaScript</code></strong>.
Note that it is not possible to use this context switch in combination with
<strong class="userinput"><code>#pop</code></strong>, for example,
<strong class="userinput"><code>#pop!SomeContext##JavaScript</code></strong> is not valid.</p></li></ul></div><p>Rule specific attributes varies and are described in the
following sections.</p><div class="itemizedlist"><p class="title"><b>Common attributes</b></p><p>All rules have the following attributes in common and are
available whenever <strong class="userinput"><code>(common attributes)</code></strong> appears.
<span class="emphasis"><em>attribute</em></span> and <span class="emphasis"><em>context</em></span>
are required attributes, all others are optional.
</p><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="emphasis"><em>attribute</em></span>: An attribute maps to a defined <span class="emphasis"><em>itemData</em></span>.</p></li><li class="listitem"><p><span class="emphasis"><em>context</em></span>: Specify the context to which the highlighting system switches if the rule matches.</p></li><li class="listitem"><p><span class="emphasis"><em>beginRegion</em></span>: Start a code folding block. Default: unset.</p></li><li class="listitem"><p><span class="emphasis"><em>endRegion</em></span>: Close a code folding block. Default: unset.</p></li><li class="listitem"><p><span class="emphasis"><em>lookAhead</em></span>: If <span class="emphasis"><em>true</em></span>, the
highlighting system will not process the matches length.
Default: <span class="emphasis"><em>false</em></span>.</p></li><li class="listitem"><p><span class="emphasis"><em>firstNonSpace</em></span>: Match only, if the string is
the first non-whitespace in the line. Default: <span class="emphasis"><em>false</em></span>.</p></li><li class="listitem"><p><span class="emphasis"><em>column</em></span>: Match only, if the column matches. Default: unset.</p></li></ul></div><div class="itemizedlist"><p class="title"><b>Dynamic rules</b></p><p>Some rules allow the optional attribute <strong class="userinput"><code>dynamic</code></strong>
of type boolean that defaults to <span class="emphasis"><em>false</em></span>. If dynamic is
<span class="emphasis"><em>true</em></span>, a rule can use placeholders representing the text
matched by a <span class="emphasis"><em>regular expression</em></span> rule that switched to the
current context in its <strong class="userinput"><code>string</code></strong> or
<strong class="userinput"><code>char</code></strong> attributes. In a <strong class="userinput"><code>string</code></strong>,
the placeholder <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>%N</code></em></span> (where N is a number) will be
replaced with the corresponding capture <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>N</code></em></span>
from the calling regular expression, starting from 1. In a
<strong class="userinput"><code>char</code></strong> the placeholder must be a number
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>N</code></em></span> and it will be replaced with the first character of
the corresponding capture <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>N</code></em></span> from the calling regular
expression. Whenever a rule allows this attribute it will contain a
<span class="emphasis"><em>(dynamic)</em></span>.</p><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="emphasis"><em>dynamic</em></span>: may be <span class="emphasis"><em>(true|false)</em></span>.</p></li></ul></div><p><strong class="userinput"><code>How does it work:</code></strong></p><p>In the <a class="link" href="regular-expressions.html" title="Appendix A. Regular Expressions">regular expressions</a> of the
<strong class="userinput"><code>RegExpr</code></strong> rules, all text within simple curved brackets
<strong class="userinput"><code>(PATTERN)</code></strong> is captured and remembered.
These captures can be used in the context to which it is switched, in the rules with the
attribute <strong class="userinput"><code>dynamic</code></strong> <span class="emphasis"><em>true</em></span>, by
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>%N</code></em></span> (in <span class="emphasis"><em>String</em></span>) or
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>N</code></em></span> (in <span class="emphasis"><em>char</em></span>).</p><p>It is important to mention that a text captured in a <strong class="userinput"><code>RegExpr</code></strong> rule is
only stored for the switched context, specified in its <strong class="userinput"><code>context</code></strong> attribute.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>If the captures will not be used, both by dynamic rules and in the same regular expression,
<strong class="userinput"><code>non-capturing groups</code></strong> should be used: <strong class="userinput"><code>(?:PATTERN)</code></strong></p><p>The <span class="emphasis"><em>lookahead</em></span> or <span class="emphasis"><em>lookbehind</em></span> groups such as
<strong class="userinput"><code>(?=PATTERN)</code></strong>, <strong class="userinput"><code>(?!PATTERN)</code></strong> or
<strong class="userinput"><code>(?&lt;=PATTERN)</code></strong> are not captured.
See <a class="link" href="regular-expressions.html" title="Appendix A. Regular Expressions">Regular Expressions</a> for more information.</p></li><li class="listitem"><p>The capture groups can be used within the same regular expression,
using <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>\N</code></em></span> instead of <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>%N</code></em></span> respectively.
For more information, see <a class="link" href="regex-patterns.html#regex-capturing" title="Capturing matching text (back references)">Capturing matching text (back references)</a>
in <a class="link" href="regular-expressions.html" title="Appendix A. Regular Expressions">Regular Expressions</a>.</p></li></ul></div></div><p>Example 1:</p><p>In this simple example, the text matched by the regular expression
<strong class="userinput"><code>=*</code></strong> is captured and inserted into <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>%1</code></em></span>
in the dynamic rule. This allows the comment to end with the same amount of
<strong class="userinput"><code>=</code></strong> as at the beginning. This matches text like:
<strong class="userinput"><code>[[ comment ]]</code></strong>, <strong class="userinput"><code>[=[ comment ]=]</code></strong> or
<strong class="userinput"><code>[=====[ comment ]=====]</code></strong>.</p><p>In addition, the captures are available only in the switched context
<span class="emphasis"><em>Multi-line Comment</em></span>.</p><pre class="programlisting">
&lt;context name="Normal" attribute="Normal Text" lineEndContext="#stay"&gt;
  &lt;RegExpr context="Multi-line Comment" attribute="Comment" String="\[(=*)\[" beginRegion="RegionComment"/&gt;
&lt;/context&gt;
&lt;context name="Multi-line Comment" attribute="Comment" lineEndContext="#stay"&gt;
  &lt;StringDetect context="#pop" attribute="Comment" String="]%1]" dynamic="true" endRegion="RegionComment"/&gt;
&lt;/context&gt;
</pre><p>Example 2:</p><p>In the dynamic rule, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>%1</code></em></span> corresponds to the capture that matches
<strong class="userinput"><code>#+</code></strong>, and <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>%2</code></em></span> to <strong class="userinput"><code>&amp;quot;+</code></strong>.
This matches text as: <strong class="userinput"><code>#label""""inside the context""""#</code></strong>.</p><p>These captures will not be available in other contexts, such as
<span class="emphasis"><em>OtherContext</em></span>, <span class="emphasis"><em>FindEscapes</em></span> or
<span class="emphasis"><em>SomeContext</em></span>.</p><pre class="programlisting">
&lt;context name="SomeContext" attribute="Normal Text" lineEndContext="#stay"&gt;
  &lt;RegExpr context="#pop!NamedString" attribute="String" String="(#+)(?:[\w-]|[^[:ascii:]])(&amp;quot;+)"/&gt;
&lt;/context&gt;
&lt;context name="NamedString" attribute="String" lineEndContext="#stay"&gt;
  &lt;RegExpr context="#pop!OtherContext" attribute="String" String="%2(?:%1)?" dynamic="true"/&gt;
  &lt;DetectChar context="FindEscapes" attribute="Escape" char="\"/&gt;
&lt;/context&gt;
</pre><p>Example 3:</p><p>This matches text like:
<strong class="userinput"><code>Class::function&lt;T&gt;( ... )</code></strong>.</p><pre class="programlisting">
&lt;context name="Normal" attribute="Normal Text" lineEndContext="#stay"&gt;
  &lt;RegExpr context="FunctionName" lookAhead="true"
              String="\b([a-zA-Z_][\w-]*)(::)([a-zA-Z_][\w-]*)(?:&amp;lt;[\w\-\s]*&amp;gt;)?(\()"/&gt;
&lt;/context&gt;
&lt;context name="FunctionName" attribute="Normal Text" lineEndContext="#pop"&gt;
  &lt;StringDetect context="#stay" attribute="Class" String="%1" dynamic="true"/&gt;
  &lt;StringDetect context="#stay" attribute="Operator" String="%2" dynamic="true"/&gt;
  &lt;StringDetect context="#stay" attribute="Function" String="%3" dynamic="true"/&gt;
  &lt;DetectChar context="#pop" attribute="Normal Text" char="4" dynamic="true"/&gt;
&lt;/context&gt;
</pre><div class="itemizedlist"><p class="title"><b>Local deliminators</b></p><p>Some rules allow the optional attributes <strong class="userinput"><code>weakDeliminator</code></strong>
and <strong class="userinput"><code>additionalDeliminator</code></strong> which are combined with attributes
of the same name of <strong class="userinput"><code>keywords</code></strong> tag. For example, when
<strong class="userinput"><code>'%'</code></strong> is a weak delimiter of <strong class="userinput"><code>keywords</code></strong>,
it can become a word delimiter only for a rule by putting it in its
<strong class="userinput"><code>additionalDeliminator</code></strong> attribute. Whenever a rule allows these
attributes it will contain a <span class="emphasis"><em>(local deliminators)</em></span>.</p><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="emphasis"><em>weakDeliminator</em></span>: list of characters that do not act as word
delimiters.</p></li><li class="listitem"><p><span class="emphasis"><em>additionalDeliminator</em></span>: defines additional delimiters.</p></li></ul></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="highlighting-rules-in-detail"></a>The Rules in Detail</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">DetectChar</span></dt><dd><p>Detect a single specific character. Commonly used for example to
find the ends of quoted strings.</p><pre class="programlisting">&lt;DetectChar char="(character)" (common attributes) (dynamic) /&gt;</pre><p>The <strong class="userinput"><code>char</code></strong> attribute defines the character
to match.</p></dd><dt><span class="term">Detect2Chars</span></dt><dd><p>Detect two specific characters in a defined order.</p><pre class="programlisting">&lt;Detect2Chars char="(character)" char1="(character)" (common attributes) /&gt;</pre><p>The <strong class="userinput"><code>char</code></strong> attribute defines the first character to match,
<strong class="userinput"><code>char1</code></strong> the second.</p></dd><dt><span class="term">AnyChar</span></dt><dd><p>Detect one character of a set of specified characters.</p><pre class="programlisting">&lt;AnyChar String="(string)" (common attributes) /&gt;</pre><p>The <strong class="userinput"><code>String</code></strong> attribute defines the set of
characters.</p></dd><dt><span class="term">StringDetect</span></dt><dd><p>Detect an exact string.</p><pre class="programlisting">&lt;StringDetect String="(string)" [insensitive="true|false"] (common attributes) (dynamic) /&gt;</pre><p>The <strong class="userinput"><code>String</code></strong> attribute defines the string
to match. The <strong class="userinput"><code>insensitive</code></strong> attribute defaults to
<span class="emphasis"><em>false</em></span> and is passed to the string comparison
function. If the value is <span class="emphasis"><em>true</em></span> insensitive
comparing is used.</p></dd><dt><span class="term">WordDetect</span></dt><dd><p>Detect an exact string but additionally require word boundaries
such as a dot <strong class="userinput"><code>'.'</code></strong> or a whitespace on the beginning
and the end of the word. Think of <strong class="userinput"><code>\b&lt;string&gt;\b</code></strong>
in terms of a regular expression, but it is faster than the rule <strong class="userinput"><code>RegExpr</code></strong>.</p><pre class="programlisting">&lt;WordDetect String="(string)" [insensitive="true|false"] (common attributes) (local deliminators) /&gt;</pre><p>The <strong class="userinput"><code>String</code></strong> attribute defines the string
to match. The <strong class="userinput"><code>insensitive</code></strong> attribute defaults to
<span class="emphasis"><em>false</em></span> and is passed to the string comparison
function. If the value is <span class="emphasis"><em>true</em></span> insensitive
comparing is used.</p><p>Since: <span class="application">Kate</span> 3.5 (<span class="orgname">KDE</span> 4.5)</p></dd><dt><span class="term">RegExpr</span></dt><dd><p>Matches against a regular expression.</p><pre class="programlisting">&lt;RegExpr String="(string)" [insensitive="true|false"] [minimal="true|false"] (common attributes) (dynamic) /&gt;</pre><p>The <strong class="userinput"><code>String</code></strong> attribute defines the regular
expression.</p><p><strong class="userinput"><code>insensitive</code></strong> defaults to
<span class="emphasis"><em>false</em></span> and is passed to the regular expression
engine.</p><p><strong class="userinput"><code>minimal</code></strong> defaults to
<span class="emphasis"><em>false</em></span> and is passed to the regular expression
engine.</p><p>Because the rules are always matched against the beginning of
the current string, a regular expression starting with a caret
(<code class="literal">^</code>) indicates that the rule should only be
matched against the start of a line.</p><p>See <a class="link" href="regular-expressions.html" title="Appendix A. Regular Expressions">Regular Expressions</a>
for more information on those.</p></dd><dt><span class="term">keyword</span></dt><dd><p>Detect a keyword from a specified list.</p><pre class="programlisting">&lt;keyword String="(list name)" (common attributes) (local deliminators) /&gt;</pre><p>The <strong class="userinput"><code>String</code></strong> attribute identifies the
keyword list by name. A list with that name must exist.</p><p>The highlighting system processes keyword rules in a very optimized way.
This makes it an absolute necessity that any keywords to be matched need to be
surrounded by defined delimiters, either implied (the default delimiters),
or explicitly specified within the <span class="emphasis"><em>additionalDeliminator</em></span>
property of the <span class="emphasis"><em>keywords</em></span> tag.</p><p>If a keyword to be matched shall contain a delimiter character, this
respective character must be added to the <span class="emphasis"><em>weakDeliminator</em></span>
property of the <span class="emphasis"><em>keywords</em></span> tag.  This character will then
loose its delimiter property in all <span class="emphasis"><em>keyword</em></span> rules. It is
also possible to use the <span class="emphasis"><em>weakDeliminator</em></span> attribute of
<span class="emphasis"><em>keyword</em></span> so that this modification only applies to this
rule.</p></dd><dt><span class="term">Int</span></dt><dd><p>Detect an integer number (as the regular expression: <strong class="userinput"><code>\b[0-9]+</code></strong>).</p><pre class="programlisting">&lt;Int (common attributes) (local deliminators) /&gt;</pre><p>This rule has no specific attributes.</p></dd><dt><span class="term">Float</span></dt><dd><p>Detect a floating point number (as the regular expression:
<strong class="userinput"><code>(\b[0-9]+\.[0-9]*|\.[0-9]+)([eE][-+]?[0-9]+)?</code></strong>).</p><pre class="programlisting">&lt;Float (common attributes) (local deliminators) /&gt;</pre><p>This rule has no specific attributes.</p></dd><dt><span class="term">HlCOct</span></dt><dd><p>Detect an octal point number representation (as the regular
expression: <strong class="userinput"><code>\b0[0-7]+</code></strong>).</p><pre class="programlisting">&lt;HlCOct (common attributes) (local deliminators) /&gt;</pre><p>This rule has no specific attributes.</p></dd><dt><span class="term">HlCHex</span></dt><dd><p>Detect a hexadecimal number representation (as a regular expression:
<strong class="userinput"><code>\b0[xX][0-9a-fA-F]+</code></strong>).</p><pre class="programlisting">&lt;HlCHex (common attributes) (local deliminators) /&gt;</pre><p>This rule has no specific attributes.</p></dd><dt><span class="term">HlCStringChar</span></dt><dd><p>Detect an escaped character.</p><pre class="programlisting">&lt;HlCStringChar (common attributes) /&gt;</pre><p>This rule has no specific attributes.</p><p>It matches literal representations of characters commonly used in
program code, for example <strong class="userinput"><code>\n</code></strong>
(newline) or <strong class="userinput"><code>\t</code></strong> (TAB).</p><p>The following characters will match if they follow a backslash
(<code class="literal">\</code>):
<strong class="userinput"><code>abefnrtv"'?\</code></strong>. Additionally, escaped
hexadecimal numbers such as for example <strong class="userinput"><code>\xff</code></strong> and
escaped octal numbers, for example <strong class="userinput"><code>\033</code></strong> will
match.</p></dd><dt><span class="term">HlCChar</span></dt><dd><p>Detect an C character.</p><pre class="programlisting">&lt;HlCChar (common attributes) /&gt;</pre><p>This rule has no specific attributes.</p><p>It matches C characters enclosed in a tick (Example: <strong class="userinput"><code>'c'</code></strong>).
The ticks may be a simple character or an escaped character.
See HlCStringChar for matched escaped character sequences.</p></dd><dt><span class="term">RangeDetect</span></dt><dd><p>Detect a string with defined start and end characters.</p><pre class="programlisting">&lt;RangeDetect char="(character)"  char1="(character)" (common attributes) /&gt;</pre><p><strong class="userinput"><code>char</code></strong> defines the character starting the range,
<strong class="userinput"><code>char1</code></strong> the character ending the range.</p><p>Useful to detect for example small quoted strings and the like, but
note that since the highlighting engine works on one line at a time, this
will not find strings spanning over a line break.</p></dd><dt><span class="term">LineContinue</span></dt><dd><p>Matches a specified char at the end of a line.</p><pre class="programlisting">&lt;LineContinue (common attributes) [char="\"] /&gt;</pre><p><strong class="userinput"><code>char</code></strong> optional character to match, default is
backslash (<strong class="userinput"><code>'\'</code></strong>). New since <span class="orgname">KDE</span> 4.13.</p><p>This rule is useful for switching context at end of line. This is needed for
 example in C/C++ to continue macros or strings.</p></dd><dt><span class="term">IncludeRules</span></dt><dd><p>Include rules from another context or language/file.</p><pre class="programlisting">&lt;IncludeRules context="contextlink" [includeAttrib="true|false"] /&gt;</pre><p>The <strong class="userinput"><code>context</code></strong> attribute defines which context to include.</p><p>If it is a simple string it includes all defined rules into the current context, example:
</p><pre class="programlisting">&lt;IncludeRules context="anotherContext" /&gt;</pre><p>
If the string contains a <strong class="userinput"><code>##</code></strong> the highlight system
will look for a context from another language definition with the given name,
for example
</p><pre class="programlisting">&lt;IncludeRules context="String##C++" /&gt;</pre><p>
would include the context <span class="emphasis"><em>String</em></span> from the <span class="emphasis"><em>C++</em></span>
highlighting definition.</p><p>If <strong class="userinput"><code>includeAttrib</code></strong> attribute is
<span class="emphasis"><em>true</em></span>, change the destination attribute to the one of
the source. This is required to make, for example, commenting work, if text
matched by the included context is a different highlight from the host
context.
</p></dd><dt><span class="term">DetectSpaces</span></dt><dd><p>Detect whitespaces.</p><pre class="programlisting">&lt;DetectSpaces (common attributes) /&gt;</pre><p>This rule has no specific attributes.</p><p>Use this rule if you know that there can be several whitespaces ahead,
for example in the beginning of indented lines. This rule will skip all
whitespace at once, instead of testing multiple rules and skipping one at a
time due to no match.</p></dd><dt><span class="term">DetectIdentifier</span></dt><dd><p>Detect identifier strings (as the regular expression:
<strong class="userinput"><code>[a-zA-Z_][a-zA-Z0-9_]*</code></strong>).</p><pre class="programlisting">&lt;DetectIdentifier (common attributes) /&gt;</pre><p>This rule has no specific attributes.</p><p>Use this rule to skip a string of word characters at once, rather than
testing with multiple rules and skipping one at a time due to no match.</p></dd></dl></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="idm4620"></a>Tips &amp; Tricks</h4></div></div></div><div class="itemizedlist"><p>Once you have understood how the context switching works it will be
easy to write highlight definitions. Though you should carefully check what
rule you choose in what situation. Regular expressions are very mighty, but
they are slow compared to the other rules. So you may consider the following
tips.
</p><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>If you only match two characters use <strong class="userinput"><code>Detect2Chars</code></strong>
instead of <strong class="userinput"><code>StringDetect</code></strong>. The same applies to
<strong class="userinput"><code>DetectChar</code></strong>.</p></li><li class="listitem"><p>Regular expressions are easy to use but often there is another much
faster way to achieve the same result. Consider you only want to match
the character <strong class="userinput"><code>'#'</code></strong> if it is the first character in the
line. A regular expression based solution would look like this:
</p><pre class="programlisting">&lt;RegExpr attribute="Macro" context="macro" String="^\s*#" /&gt;</pre><p>
You can achieve the same much faster in using:
</p><pre class="programlisting">&lt;DetectChar attribute="Macro" context="macro" char="#" firstNonSpace="true" /&gt;</pre><p>
If you want to match the regular expression <strong class="userinput"><code>'^#'</code></strong> you
can still use <strong class="userinput"><code>DetectChar</code></strong> with the attribute <strong class="userinput"><code>column="0"</code></strong>.
The attribute <strong class="userinput"><code>column</code></strong> counts characters, so a tabulator is only one character.
</p></li><li class="listitem"><p>In <strong class="userinput"><code>RegExpr</code></strong> rules, use the attribute <strong class="userinput"><code>column="0"</code></strong> if the pattern
<strong class="userinput"><code>^PATTERN</code></strong> will be used to match text at the beginning of a line.
This improves performance, as it will avoid looking for matches in the rest of the columns.</p></li><li class="listitem"><p>In regular expressions, use non-capturing groups <strong class="userinput"><code>(?:PATTERN)</code></strong> instead of
capturing groups <strong class="userinput"><code>(PATTERN)</code></strong>, if the captures will not be used in the same regular
expression or in dynamic rules. This avoids storing captures unnecessarily.</p></li><li class="listitem"><p>You can switch contexts without processing characters. Assume that you
want to switch context when you meet the string <strong class="userinput"><code>*/</code></strong>, but
need to process that string in the next context. The below rule will match, and
the <strong class="userinput"><code>lookAhead</code></strong> attribute will cause the highlighter to
keep the matched string for the next context.
</p><pre class="programlisting">&lt;Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" lookAhead="true" /&gt;</pre><p>
</p></li><li class="listitem"><p>Use <strong class="userinput"><code>DetectSpaces</code></strong> if you know that many whitespaces occur.</p></li><li class="listitem"><p>Use <strong class="userinput"><code>DetectIdentifier</code></strong> instead of the regular expression <strong class="userinput"><code>'[a-zA-Z_]\w*'</code></strong>.</p></li><li class="listitem"><p>Use default styles whenever you can. This way the user will find a familiar environment.</p></li><li class="listitem"><p>Look into other <acronym class="acronym">XML</acronym> files to see how other people implement tricky rules.</p></li><li class="listitem"><p>You can validate every <acronym class="acronym">XML</acronym> file by using the command
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>validatehl.sh language.xsd mySyntax.xml</strong></span></span>.
The files <code class="filename">validatehl.sh</code> and <code class="filename">language.xsd</code>
are available in <a class="ulink" href="https://commits.kde.org/syntax-highlighting?path=data/schema" target="_top">Syntax
Highlighting repository</a>.
</p></li><li class="listitem"><p>If you repeat complex regular expression very often you can use
<span class="emphasis"><em>ENTITIES</em></span>. Example:</p><pre class="programlisting">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE language SYSTEM "language.dtd"
[
        &lt;!ENTITY myref    "[A-Za-z_:][\w.:_-]*"&gt;
]&gt;
</pre><p>Now you can use <span class="emphasis"><em>&amp;myref;</em></span> instead of the regular
expression.</p></li></ul></div></div></div></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="dev.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="color-themes.html">Next</a></td></tr><tr><td class="prevCell">Extending <span class="application">KatePart</span> </td><td class="upCell">Extending <span class="application">KatePart</span></td><td class="nextCell"> Working with Color Themes</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="color-themes.html"><html><head><title>Working with Color Themes</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="dev.html" title="Chapter 6. Extending KatePart"><link rel="prev" href="highlight.html" title="Working with Syntax Highlighting"><link rel="next" href="dev-scripting.html" title="Scripting with JavaScript"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Working with Color Themes</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="highlight.html">Prev</a></td><td class="upCell">Extending <span class="application">KatePart</span></td><td class="nextCell"><a accesskey="n" href="dev-scripting.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="color-themes"></a>Working with Color Themes</h2></div></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="color-themes-overview"></a>Overview</h3></div></div></div><p>Color themes define the colors of the
<a class="link" href="kate-part.html" title="Chapter 3. Working with the KatePart editor">text editing area</a> and the
<a class="link" href="highlight.html" title="Working with Syntax Highlighting">syntax highlighting</a>. A color
theme encompasses the following:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>The text style, used for syntax highlighting through the
<span class="emphasis"><em>default styles attributes</em></span>. For example, the text
color and the selected text color.</p></li><li class="listitem"><p>The background of the text editing area, including the text
selection and the current line.</p></li><li class="listitem"><p>The icon border of the text area: their background, the separator line,
the line numbers, the line word wrap markers, the modified line marks and
the code folding.</p></li><li class="listitem"><p>Text decorators such as the search markers, the indentation and tab/space
line marks, the bracket matching and the spell checking.</p></li><li class="listitem"><p>Bookmarks and snippets.</p></li></ul></div><p>
</p><p>To avoid confusion, the following is out of scope:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>The font type and the font size.</p></li><li class="listitem"><p>The colors of the text editing application, such as the scroll bar map, the menus,
the tab bar, the window color, etc. In <span class="orgname">KDE</span> applications, like <span class="application">Kate</span> or <span class="application">KDevelop</span>, these colors
are defined by the <strong class="userinput"><code><span class="orgname">KDE</span> <span class="productname">Plasma</span> global color scheme</code></strong>, which are set in
the <a class="ulink" href="help:/kcontrol/colors/" target="_top"><span class="quote">“<span class="quote">Colors</span>”</span> module in <span class="application">System Settings</span></a>
or from the application itself in the menu
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Settings</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Color Scheme</span></span>.
</p></li></ul></div><p>
</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="breeze-color-theme-preview.png" alt="“Breeze Light” and “Breeze Dark” color themes with the “C++” syntax highlighting."><div class="caption"><p><span class="quote">“<span class="quote">Breeze Light</span>”</span> and <span class="quote">“<span class="quote">Breeze Dark</span>”</span> color themes
with the <span class="quote">“<span class="quote">C++</span>”</span> syntax highlighting.</p></div></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="color-themes-ksyntaxhighlighting"></a>The KSyntaxHighlighting Color Themes</h3></div></div></div><p>The <a class="ulink" href="https://api.kde.org/frameworks/syntax-highlighting/html/" target="_top">KSyntaxHighlighting</a>
framework, which is the <a class="link" href="highlight.html" title="Working with Syntax Highlighting">syntax highlighting</a> engine,
is the library that <strong class="userinput"><code>provides and manages the color themes</code></strong>.
This is part of <span class="orgname">KDE</span> <span class="productname">Frameworks</span> and is used in <span class="orgname">KDE</span> text editors such as
<a class="ulink" href="https://apps.kde.org/en/kate" target="_top"><span class="application">Kate</span></a>,
<a class="ulink" href="https://apps.kde.org/en/kwrite" target="_top"><span class="application">KWrite</span></a>,
<a class="ulink" href="https://apps.kde.org/en/kile" target="_top"><span class="application">Kile</span></a> and
<a class="ulink" href="https://apps.kde.org/en/kdevelop" target="_top"><span class="application">KDevelop</span></a>.
This dependency looks like the following:</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="kf5-ksyntaxhighlighting.png" alt="Dependence of KDE Frameworks 5 libraries on text editors."><div class="caption"><p>Dependence of <span class="orgname">KDE</span> <span class="productname">Frameworks</span> libraries on text editors.</p></div></div><p>KSyntaxHighlighting includes a variety of built-in themes which are displayed on
the <a class="ulink" href="https://kate-editor.org/themes/" target="_top"><span class="quote">“<span class="quote">Color Themes</span>”</span> page of
the Kate editor website</a>.</p><p>The <a class="ulink" href="https://api.kde.org/frameworks/ktexteditor/html/" target="_top">KTextEditor</a>
framework, which is the text editing engine, provides a user interface for creating and editing
color themes, including a tool for importing and exporting themes. This is the simplest way to
create and edit them, you can access it from the
<a class="link" href="config-dialog.html" title="Chapter 7. Configure KatePart"><span class="quote">“<span class="quote">Configure</span>”</span> dialog</a> of the text editor.
More details in <a class="xref" href="color-themes.html#color-themes-gui" title="The Color Themes GUI">the section called “The Color Themes <acronym class="acronym">GUI</acronym>”</a>.</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="color-themes-gui-breeze-dark-default-text-styles.png" alt="The GUI to manage color themes in Kate's settings."><div class="caption"><p>The <acronym class="acronym">GUI</acronym> to manage color themes in <span class="application">Kate</span>'s settings.</p></div></div><p>It is important to mention that, in the <span class="orgname">KDE</span> text editors like <span class="application">Kate</span> or <span class="application">KDevelop</span>,
the KSyntaxHighlighting color themes are used
<a class="ulink" href="https://kate-editor.org/post/2020/2020-09-13-kate-color-themes-5.75/" target="_top">since
<span class="orgname">KDE</span> <span class="productname">Frameworks</span> 5.75</a>, released on October 10, 2020. Previously, <span class="application">Kate</span>'s color
schemes (KConfig based schema config) were used and are now deprecated. However, it is
possible to convert the old <span class="application">Kate</span> schemes to the KSyntaxHighlighting color themes.
The <a class="ulink" href="https://invent.kde.org/frameworks/syntax-highlighting" target="_top">KSyntaxHighlighting
repository</a> includes the <strong class="userinput"><code>utils/kateschema_to_theme_converter.py</code></strong>
script and the <strong class="userinput"><code>utils/schema-converter/</code></strong> utility for that purpose.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="color-themes-json"></a>The Color Themes <acronym class="acronym">JSON</acronym> Format</h3></div></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="color-themes-json-overview"></a>Overview</h4></div></div></div><p>Color themes are stored in <acronym class="acronym">JSON</acronym> format files, with the
<strong class="userinput"><code>.theme</code></strong> extension.</p><p>In the <a class="ulink" href="https://invent.kde.org/frameworks/syntax-highlighting" target="_top">
KSyntaxHighlighting source code</a>, the <acronym class="acronym">JSON</acronym> files of built-in themes
are located in the <strong class="userinput"><code>data/themes/</code></strong> directory.
Note that in text editors, the built-in themes are compiled into the
KSyntaxHighlighting library, therefore, the way to access them is through the
source code or by <a class="link" href="color-themes.html#color-themes-gui-import-export" title="Import or export JSON theme files">exporting them
from the <acronym class="acronym">GUI</acronym> to manage themes of KTextEditor</a>.</p><p>It is also possible to easily add additional or custom themes, which are
loaded from the file system. User-customized theme files are located in the
<code class="filename">org.kde.syntax-highlighting/themes/</code>
directory in your user folder, which you can find with the command
<strong class="userinput"><code><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>qtpaths</strong></span></span><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="option"><code class="option"> --paths GenericDataLocation</code></span></code></strong>
and are commonly <code class="filename"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="envar"><code class="envar">$HOME</code></span>/.local/share/</code>
and <code class="filename">/usr/share/</code>.
</p><p>In Flatpak and Snap packages, the above directory will not work
as the data location is different for each application.
In a Flatpak application, the location of custom theme files is usually
<code class="filename"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="envar"><code class="envar">$HOME</code></span>/.var/app/<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>flatpak-package-name</code></em></span>/data/org.kde.syntax-highlighting/themes/</code>
and in a Snap application that location is
<code class="filename"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="envar"><code class="envar">$HOME</code></span>/snap/<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>snap-package-name</code></em></span>/current/.local/share/org.kde.syntax-highlighting/themes/</code>.
</p><p>On <span class="trademark">Windows</span>® these files are located
<code class="filename">%USERPROFILE%\AppData\Local\org.kde.syntax-highlighting\themes</code>.
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>%USERPROFILE%</code></em></span> usually expands to
<code class="filename">C:\Users\<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>user-name</code></em></span></code>.</p><p>In summary, for most configurations the custom themes directory is as follows:</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col><col></colgroup><tbody><tr><td>For local user</td><td><code class="filename"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="envar"><code class="envar">$HOME</code></span>/.local/share/org.kde.syntax-highlighting/themes/</code></td></tr><tr><td>For all users</td><td><code class="filename">/usr/share/org.kde.syntax-highlighting/themes/</code></td></tr><tr><td>For Flatpak packages</td><td><code class="filename"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="envar"><code class="envar">$HOME</code></span>/.var/app/<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>flatpak-package-name</code></em></span>/data/org.kde.syntax-highlighting/themes/</code></td></tr><tr><td>For Snap packages</td><td><code class="filename"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="envar"><code class="envar">$HOME</code></span>/snap/<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>snap-package-name</code></em></span>/current/.local/share/org.kde.syntax-highlighting/themes/</code></td></tr><tr><td>On <span class="trademark">Windows</span>®</td><td><code class="filename">%USERPROFILE%\AppData\Local\org.kde.syntax-highlighting\themes</code></td></tr></tbody></table></div><p>If multiple theme files exist with the same name, the file with the highest <strong class="userinput"><code>revision</code></strong> will be loaded.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="color-themes-json-basic"></a>The <acronym class="acronym">JSON</acronym> Structure</h4></div></div></div><p>The structure of a <acronym class="acronym">JSON</acronym> file is explained on
<a class="ulink" href="https://www.json.org" target="_top">their website</a>.
Basically, a <acronym class="acronym">JSON</acronym> format file consists of:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>Collections of key/value pairs, separated by commas and grouped in
<strong class="userinput"><code>{ }</code></strong> which we will call <span class="quote">“<span class="quote">objects</span>”</span>.</p></li><li class="listitem"><p>Ordered lists of values, separated by commas and grouped in
<strong class="userinput"><code>[ ]</code></strong> which we will call <span class="quote">“<span class="quote">array</span>”</span>.</p></li></ul></div><p>
</p><p>The nomenclature <span class="quote">“<span class="quote">key</span>”</span>, <span class="quote">“<span class="quote">value</span>”</span>, <span class="quote">“<span class="quote">object</span>”</span>
and <span class="quote">“<span class="quote">array</span>”</span> will be used in this article. If this is your first time working
with <acronym class="acronym">JSON</acronym> files, understanding them is as simple as looking at the examples below.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="color-themes-json-root"></a>Main Sections of the <acronym class="acronym">JSON</acronym> Color Theme Files</h4></div></div></div><p>The root object of the color theme <acronym class="acronym">JSON</acronym> file contains the following
schema keys:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><strong class="userinput"><code>metadata</code></strong>: It is mandatory. The value
is an object with the theme's metadata, such as name, revision and license.</p><p>This is detailed in <a class="xref" href="color-themes.html#color-themes-json-metadata" title="Metadata">the section called “Metadata”</a>.</p></li><li class="listitem"><p><strong class="userinput"><code>editor-colors</code></strong>: It is mandatory. The
value is an object with the colors of the text editing area, such as the
background, the icon border and the text decoration.</p><p>This is detailed in <a class="xref" href="color-themes.html#color-themes-editor-colors" title="Editor Colors">the section called “Editor Colors”</a>.</p></li><li class="listitem"><p><strong class="userinput"><code>text-styles</code></strong>: It is mandatory. The value
is an object with the <span class="emphasis"><em>default text style</em></span> attributes of
the syntax highlighting. Each attribute defines its <span class="emphasis"><em>text color</em></span>,
its <span class="emphasis"><em>selected text color</em></span>, or whether it <span class="emphasis"><em>bold</em></span>
or <span class="emphasis"><em>italic</em></span>, for example. The text styles can be referenced
from <a class="link" href="highlight.html#kate-highlight-default-styles" title="Available Default Styles">the attributes of the syntax
definition <acronym class="acronym">XML</acronym> files</a>.</p><p>This is detailed in <a class="xref" href="color-themes.html#color-themes-text-styles" title="Default Text Styles">the section called “Default Text Styles”</a>.</p></li><li class="listitem"><p><strong class="userinput"><code>custom-styles</code></strong>: It is optional. Defines
text styles for the attributes of specific syntax highlighting definitions.
For example, in a highlighting definition such as <strong class="userinput"><code>Python</code></strong>
or <strong class="userinput"><code>Markdown</code></strong> you can specify a different text style that
overrides the default defined in <strong class="userinput"><code>text-styles</code></strong>.</p><p>This is detailed in <a class="xref" href="color-themes.html#color-themes-custom-styles" title="Custom Highlighting Text Styles">the section called “Custom Highlighting Text Styles”</a>.</p></li></ul></div><p>The <acronym class="acronym">JSON</acronym> language does not support comments. However, you can use the
optional key <strong class="userinput"><code>_comments</code></strong> in the root object to write comments,
for example, if you are adapting an existing theme you can put the URL of the
original repository. The most practical way is to use an array of strings.
</p><p>Below is an example file for the <span class="quote">“<span class="quote">Breeze Light</span>”</span> theme.
You can notice that, to avoid the example being too large, the
<strong class="userinput"><code>editor-colors</code></strong> and <strong class="userinput"><code>text-styles</code></strong>
objects do not contain all the required keys. You can see the full archive of
<a class="ulink" href="https://invent.kde.org/frameworks/syntax-highlighting/-/blob/master/data/themes/breeze-light.theme" target="_top">
the <span class="quote">“<span class="quote">Breeze Light</span>”</span> theme in the KSyntaxHighlighting repository</a>.
</p><pre class="programlisting">
{
    "_comments": [
        "This is a comment.",
        "If this theme is an adaptation of another, put the link to the original repository."
    ],
    "metadata": {
        "name" : "Breeze Light",
        "revision" : 5,
        "copyright": [
            "SPDX-FileCopyrightText: 2016 Volker Krause &lt;vkrause@kde.org&gt;",
            "SPDX-FileCopyrightText: 2016 Dominik Haumann &lt;dhaumann@kde.org&gt;"
        ],
        "license": "SPDX-License-Identifier: MIT"
    },
    "editor-colors": {
        "BackgroundColor" : "#ffffff",
        "CodeFolding" : "#94caef",
        "BracketMatching" : "#ffff00",
        "CurrentLine" : "#f8f7f6",
        "IconBorder" : "#f0f0f0",
        "IndentationLine" : "#d2d2d2",
        "LineNumbers" : "#a0a0a0",
        "CurrentLineNumber" : "#1e1e1e",
        <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>The other editor color keys...</code></em></span>

    },
    "text-styles": {
        "Normal" : {
            "text-color" : "#1f1c1b",
            "selected-text-color" : "#ffffff",
            "bold" : false,
            "italic" : false,
            "underline" : false,
            "strike-through" : false
        },
        "Keyword" : {
            "text-color" : "#1f1c1b",
            "selected-text-color" : "#ffffff",
            "bold" : true
        },
        "Function" : {
            "text-color" : "#644a9b",
            "selected-text-color" : "#452886"
        },
        "Variable" : {
            "text-color" : "#0057ae",
            "selected-text-color" : "#00316e"
        },
        <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>The other text style keys...</code></em></span>

    },
    "custom-styles": {
        "ISO C++": {
            "Data Type": {
                "bold": true,
                "selected-text-color": "#009183",
                "text-color": "#00b5cf"
            },
            "Keyword": {
                "text-color": "#6431b3"
            }
        },
        "YAML": {
            "Attribute": {
                "selected-text-color": "#00b5cf",
                "text-color": "#00b5cf"
            }
        }
    }
}
</pre></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="color-themes-json-metadata"></a>Metadata</h4></div></div></div><p>The <acronym class="acronym">JSON</acronym> object of the <strong class="userinput"><code>metadata</code></strong> key contains
relevant information on the theme. This object has the following keys:

</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><strong class="userinput"><code>name</code></strong>: It is a <span class="emphasis"><em>string</em></span>
sets the name of the language. It appears in the menus and dialogs afterwards.
It is mandatory.</p></li><li class="listitem"><p><strong class="userinput"><code>revision</code></strong>: It is an
<span class="emphasis"><em>integer</em></span> number that specifies the current revision of the
theme file. Whenever you update a color theme file, make sure to increase this
number. It is mandatory.</p></li><li class="listitem"><p><strong class="userinput"><code>license</code></strong>: It is a
<span class="emphasis"><em>string</em></span> that defines the license of the theme, using the
identifier <strong class="userinput"><code>SPDX-License-Identifier</code></strong> from the standard
<a class="ulink" href="https://spdx.dev/" target="_top">SPDX license communication format</a>.
It is optional.</p><p>You can see the full list of SPDX license identifiers
<a class="ulink" href="https://spdx.org/licenses/" target="_top">here</a>.</p></li><li class="listitem"><p><strong class="userinput"><code>copyright</code></strong>: It is an <span class="emphasis"><em>array</em></span>
of <span class="emphasis"><em>strings</em></span> that specifies the authors of the theme, using
the identifier <strong class="userinput"><code>SPDX-FileCopyrightText</code></strong> from the standard
<a class="ulink" href="https://spdx.dev/" target="_top">SPDX license communication format</a>.
It is optional.</p></li></ul></div><p>
</p><pre class="programlisting">
"metadata": {
    "name" : "Breeze Light",
    "revision" : 5,
    "copyright": [
        "SPDX-FileCopyrightText: 2016 Volker Krause &lt;vkrause@kde.org&gt;",
        "SPDX-FileCopyrightText: 2016 Dominik Haumann &lt;dhaumann@kde.org&gt;"
    ],
    "license": "SPDX-License-Identifier: MIT"
}
</pre></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="color-themes-editing"></a>Colors in Detail</h3></div></div></div><p>This section details all the available color attributes and available
color settings.</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="color-themes-editor-colors"></a>Editor Colors</h4></div></div></div><p>Corresponds to the colors of the <a class="link" href="kate-part.html" title="Chapter 3. Working with the KatePart editor">text editing area</a>.</p><p>In the <a class="link" href="color-themes.html#color-themes-json" title="The Color Themes JSON Format"><acronym class="acronym">JSON</acronym> theme file</a>, the respective key
<strong class="userinput"><code>editor-colors</code></strong> has as value an <span class="emphasis"><em>object</em></span> where each
key references an attribute color of the text editor. Here, <strong class="userinput"><code>all available keys
are mandatory</code></strong>, their values are <strong class="userinput"><code>strings</code></strong> with hexadecimal
color codes, like <span class="quote">“<span class="quote">#00B5CF</span>”</span>.
</p><p>In <a class="link" href="color-themes.html#color-themes-gui" title="The Color Themes GUI">the <acronym class="acronym">GUI</acronym> to manage themes of KTextEditor</a>,
these attributes can be modified in the <strong class="userinput"><code><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Colors</span></span></code></strong> tab.
</p><p>The available keys are the following; the keys used in the
<a class="link" href="color-themes.html#color-themes-json" title="The Color Themes JSON Format"><acronym class="acronym">JSON</acronym> file</a> are listed in <span class="emphasis"><em>bold</em></span>,
the names used in the <a class="link" href="color-themes.html#color-themes-gui" title="The Color Themes GUI"><acronym class="acronym">GUI</acronym></a> are shown in parentheses.
</p><div class="variablelist"><dl class="variablelist"><dt><a name="variable-prefcolors-colors-text-background"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Editor Background Colors</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><a name="variable-pref-colors-normal-text"></a><span class="term"><strong class="userinput"><code>BackgroundColor</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Text Area</span></span>)</span></dt><dd><p>This is the default background for the editor area, it will be
the dominant color on the editor area.</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="editor-colors-BackgroundColor.png"><div class="caption"><p></p></div></div></dd><dt><a name="variable-pref-colors-selected-text"></a><span class="term"><strong class="userinput"><code>TextSelection</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Selected Text</span></span>)</span></dt><dd><p>This is the background for selected text.
</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="editor-colors-TextSelection.png"><div class="caption"><p></p></div></div></dd><dt><a name="variable-pref-colors-current-line"></a><span class="term"><strong class="userinput"><code>CurrentLine</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Current Line</span></span>)</span></dt><dd><p>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.
</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="editor-colors-CurrentLine.png"><div class="caption"><p></p></div></div></dd><dt><a name="variable-pref-colors-search-highlight"></a><span class="term"><strong class="userinput"><code>SearchHighlight</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Search Highlight</span></span>)</span></dt><dd><p>Set the color for the text that matches your last search.
</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="editor-colors-SearchHighlight.png"><div class="caption"><p></p></div></div></dd><dt><a name="variable-pref-colors-replace-highlight"></a><span class="term"><strong class="userinput"><code>ReplaceHighlight</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Replace Highlight</span></span>)</span></dt><dd><p>Set the color for the text that matches your last replace
operation.</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="editor-colors-ReplaceHighlight.png"><div class="caption"><p></p></div></div></dd></dl></div></dd><dt><a name="variable-prefcolors-colors-icon-border"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Icon Border</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><strong class="userinput"><code>IconBorder</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Background Area</span></span>)</span></dt><dd><p>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.
</p></dd><dt><span class="term"><strong class="userinput"><code>LineNumbers</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Line Numbers</span></span>)</span></dt><dd><p>This color is used to draw the line numbers on the left side of
the view when displayed.</p></dd><dt><span class="term"><strong class="userinput"><code>CurrentLineNumber</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Current Line Number</span></span>)</span></dt><dd><p>This color is used to draw the line number of the current line,
on the left side of the view when displayed. Setting this a bit different from
<span class="quote">“<span class="quote">LineNumbers</span>”</span> helps to keep focus on the current line.
</p></dd><dt><span class="term"><strong class="userinput"><code>Separator</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Separator</span></span>)</span></dt><dd><p>This color is used to draw the vertical line that separates the
icon border from the background of the text area.</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="editor-colors-IconBorder.png"><div class="caption"><p></p></div></div></dd><dt><span class="term"><strong class="userinput"><code>WordWrapMarker</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Word Wrap Marker</span></span>)</span></dt><dd><p>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.</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="editor-colors-WordWrapMarker.png"><div class="caption"><p></p></div></div></dd><dt><span class="term"><strong class="userinput"><code>CodeFolding</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Code Folding</span></span>)</span></dt><dd><p>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
<a class="link" href="advanced-editing-tools-code-folding.html" title="Using Code Folding">the code
folding documentation</a>.</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="editor-colors-CodeFolding.png"><div class="caption"><p></p></div></div></dd><dt><span class="term"><strong class="userinput"><code>ModifiedLines</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Modified Lines</span></span>)</span></dt><dd><p>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
<a class="xref" href="kate-part-line-modification.html" title="Line Modification Indicators">the section called “Line Modification Indicators”</a>.</p></dd><dt><span class="term"><strong class="userinput"><code>SavedLines</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Saved Lines</span></span>)</span></dt><dd><p>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
<a class="xref" href="kate-part-line-modification.html" title="Line Modification Indicators">the section called “Line Modification Indicators”</a>.</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="editor-colors-ModifiedLines.png"><div class="caption"><p></p></div></div></dd></dl></div></dd><dt><a name="variable-prefcolors-colors-text-decorations"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Text Decorations</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><strong class="userinput"><code>SpellChecking</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Spelling Mistake Line</span></span>)</span></dt><dd><p>This color is used to indicate spelling mistakes.</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="editor-colors-SpellChecking.png"><div class="caption"><p></p></div></div></dd><dt><span class="term"><strong class="userinput"><code>TabMarker</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Tab and Space Markers</span></span>)</span></dt><dd><p>This color is used to draw white space indicators, when they are
enabled.</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="editor-colors-TabMarker.png"><div class="caption"><p></p></div></div></dd><dt><span class="term"><strong class="userinput"><code>IndentationLine</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Indentation Line</span></span>)</span></dt><dd><p>This color is used to draw a line to the left of indented blocks,
if <a class="link" href="config-dialog.html#appearance-general" title="General">that feature is enabled</a>.</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="editor-colors-IndentationLine.png"><div class="caption"><p></p></div></div></dd><dt><span class="term"><strong class="userinput"><code>BracketMatching</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Bracket Highlight</span></span>)</span></dt><dd><p>This color is used to draw the background of matching brackets.
</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="editor-colors-BracketMatching.png"><div class="caption"><p></p></div></div></dd></dl></div></dd><dt><a name="variable-prefcolors-colors-marker-colors"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Marker Colors</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><strong class="userinput"><code>MarkBookmark</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Bookmark</span></span>)</span></dt><dd><p>This color is used to indicate bookmarks. Note that this color
has an opacity of 22% (and 33% for the current line) with respect to the background.
For more information, see <a class="xref" href="kate-part-bookmarks.html" title="Using Bookmarks">the section called “Using Bookmarks”</a>.</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="editor-colors-MarkBookmark.png"><div class="caption"><p></p></div></div></dd><dt><span class="term"><strong class="userinput"><code>MarkBreakpointActive</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Active Breakpoint</span></span>)</span></dt><dd><p>This color is used by the GDB plugin to indicate an active
breakpoint. Notice that this color has an opacity to the background.
For more information, see <a class="ulink" href="help:/kate/kate-application-plugin-gdb.html" target="_top">the
GDB Plugin documentation</a>.</p></dd><dt><span class="term"><strong class="userinput"><code>MarkBreakpointReached</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Reached Breakpoint</span></span>)</span></dt><dd><p>This color is used by the GDB plugin to indicate a breakpoint
you have reached while debugging. Notice that this color has an opacity
to the background.
For more information, see <a class="ulink" href="help:/kate/kate-application-plugin-gdb.html" target="_top">the
GDB Plugin documentation</a>.</p></dd><dt><span class="term"><strong class="userinput"><code>MarkBreakpointDisabled</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Disabled Breakpoint</span></span>)</span></dt><dd><p>This color is used by the GDB plugin to indicate an inactive
breakpoint. Notice that this color has an opacity to the background.
For more information, see <a class="ulink" href="help:/kate/kate-application-plugin-gdb.html" target="_top">the
GDB Plugin documentation</a>.</p></dd><dt><span class="term"><strong class="userinput"><code>MarkExecution</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Execution</span></span>)</span></dt><dd><p>This color is used by the GDB plugin the line presently being
executed. Notice that this color has an opacity to the background.
For more information, see <a class="ulink" href="help:/kate/kate-application-plugin-gdb.html" target="_top">the
GDB Plugin documentation</a>.</p></dd><dt><span class="term"><strong class="userinput"><code>MarkWarning</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Warning</span></span>)</span></dt><dd><p>This color is used by the build plugin to indicate a line that
has caused a compiler warning. Notice that this color has an opacity to the background.
For more information, see <a class="ulink" href="help:/kate/kate-application-plugin-build.html" target="_top">the
Build Plugin documentation</a>.</p></dd><dt><span class="term"><strong class="userinput"><code>MarkError</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Error</span></span>)</span></dt><dd><p>This color is used by the build plugin to indicate a line that
has caused a compiler error. Notice that this color has an opacity to the background.
For more information, see <a class="ulink" href="help:/kate/kate-application-plugin-build.html" target="_top">the
Build Plugin documentation</a>.</p></dd></dl></div></dd><dt><a name="variable-prefcolors-colors-text-templates-snippets"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Text Templates &amp; Snippets</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><strong class="userinput"><code>TemplateBackground</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Background</span></span>)</span></dt><dd><p>This color is used by the <span class="application">Kate</span> Snippets plugin to mark the
background of a snippet.  For more information, see
<a class="ulink" href="help:/kate/kate-application-plugin-snippets.html" target="_top">the <span class="application">Kate</span> Snippets
documentation</a>.</p></dd><dt><span class="term"><strong class="userinput"><code>TemplatePlaceholder</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Editable Placeholder</span></span>)</span></dt><dd><p>This color is used by the <span class="application">Kate</span> Snippets plugin to mark a
placeholder that you can click in to edit manually.  For more information, see
<a class="ulink" href="help:/kate/kate-application-plugin-snippets.html" target="_top">the <span class="application">Kate</span> Snippets
documentation</a>.</p></dd><dt><span class="term"><strong class="userinput"><code>TemplateFocusedPlaceholder</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Focused Editable Placeholder</span></span>)</span></dt><dd><p>This color is used by the <span class="application">Kate</span> Snippets plugin to mark the
placeholder that you are presently editing.  For more information, see
<a class="ulink" href="help:/kate/kate-application-plugin-snippets.html" target="_top">the <span class="application">Kate</span> Snippets
documentation</a>.</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="editor-colors-Template.png"><div class="caption"><p></p></div></div></dd><dt><span class="term"><strong class="userinput"><code>TemplateReadOnlyPlaceholder</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Not Editable Placeholder</span></span>)</span></dt><dd><p>This color is used by the <span class="application">Kate</span> Snippets plugin to mark a
placeholder that cannot be edited manually, such as one that is automatically
populated.  For more information, see
<a class="ulink" href="help:/kate/kate-application-plugin-snippets.html" target="_top">the <span class="application">Kate</span> Snippets
documentation</a>.</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="editor-colors-TemplateReadOnlyPlaceholder.png"><div class="caption"><p></p></div></div></dd></dl></div></dd></dl></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="color-themes-text-styles"></a>Default Text Styles</h4></div></div></div><p>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 KSyntaxHighlighting can highlight.
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
These text styles can be referenced from the <strong class="userinput"><code>default styles</code></strong> used
in <a class="link" href="highlight.html" title="Working with Syntax Highlighting">syntax highlighting</a> definition <acronym class="acronym">XML</acronym> files, for example,
the <span class="quote">“<span class="quote">Normal</span>”</span> attribute is equivalent to <span class="quote">“<span class="quote">dsNormal</span>”</span> in the <acronym class="acronym">XML</acronym> files,
and <span class="quote">“<span class="quote">DataType</span>”</span> is equivalent to <span class="quote">“<span class="quote">dsDataType</span>”</span>.
See <a class="xref" href="highlight.html#kate-highlight-default-styles" title="Available Default Styles">the section called “Available Default Styles”</a> in the syntax highlighting documentation.
</p></div><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><p>
Make sure to choose readable colors with good contrast especially in combination with
the <strong class="userinput"><code><a class="link" href="color-themes.html#color-themes-editor-colors" title="Editor Colors">Editor Colors</a></code></strong>.
See <a class="xref" href="color-themes.html#color-themes-contrast" title="Contrast of Text Colors">the section called “Contrast of Text Colors”</a>.
</p></div><p>In the <a class="link" href="color-themes.html#color-themes-json" title="The Color Themes JSON Format"><acronym class="acronym">JSON</acronym> file</a>, the respective key
<strong class="userinput"><code>text-styles</code></strong> has as value an <span class="emphasis"><em>object</em></span> where
each key corresponds to the name of a <span class="emphasis"><em>default text style</em></span>, which are
equivalent to those used in the syntax highlighting definitions. Here, <strong class="userinput"><code>all available
text style keys are mandatory</code></strong>, these are listed below.
</p><pre class="programlisting">
"text-styles": {
    "Normal" : {
        "text-color" : "#1f1c1b",
        "selected-text-color" : "#ffffff",
        "bold" : false,
        "italic" : false,
        "underline" : false,
        "strike-through" : false
    },
    "Keyword" : {
        "text-color" : "#1f1c1b",
        "selected-text-color" : "#ffffff",
        "bold" : true
    },
    "Function" : {
        "text-color" : "#644a9b",
        "selected-text-color" : "#452886"
    },
    <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>The other text style keys...</code></em></span>
}
</pre><div class="variablelist"><dl class="variablelist"><dt><span class="term">Each key of <span class="emphasis"><em>default text style</em></span> has a <acronym class="acronym">JSON</acronym> object as
its value, where values such as <span class="emphasis"><em>color</em></span>, <span class="emphasis"><em>bold</em></span>,
<span class="emphasis"><em>italic</em></span>, etc. are specified. These keys are as follows:
</span></dt><dd><p><strong class="userinput"><code>text-color</code></strong>: It is a <span class="emphasis"><em>string</em></span> with the
text color in hexadecimal color code. This key/value is required.</p><p><strong class="userinput"><code>selected-text-color</code></strong>: The text color when it is selected
is generally the same value as <span class="quote">“<span class="quote">text-color</span>”</span>. When the text is selected,
the background is defined by the value of
<a class="link" href="color-themes.html#variable-pref-colors-selected-text">TextSelection</a> in the
<a class="link" href="color-themes.html#color-themes-editor-colors" title="Editor Colors">Editor Colors</a>, so you must ensure that
the text has good contrast and is readable with this background. The value is a
<span class="emphasis"><em>string</em></span> with a hexadecimal color code. This key/value is required.</p><p><strong class="userinput"><code>bold</code></strong>: It is a <span class="emphasis"><em>boolean</em></span> that determines
if the text is in bold. This key is optional, the default value is <strong class="userinput"><code>false</code></strong>.</p><p><strong class="userinput"><code>italic</code></strong>: It is a <span class="emphasis"><em>boolean</em></span> that determines
if the text is curved. This key is optional, the default value is <strong class="userinput"><code>false</code></strong>.</p><p><strong class="userinput"><code>underline</code></strong>: It is a <span class="emphasis"><em>boolean</em></span> that determines
if the text is underlined. This key is optional, the default value is <strong class="userinput"><code>false</code></strong>.</p><p><strong class="userinput"><code>strike-through</code></strong>: It is a <span class="emphasis"><em>boolean</em></span> that
determines if the text is strike through. This key is optional, the default value is <strong class="userinput"><code>false</code></strong>.</p><p><strong class="userinput"><code>background-color</code></strong>: Determines the background of the text,
used for example in alerts in comments. The value is a <span class="emphasis"><em>string</em></span> with
a hexadecimal color code. This key is optional, by default there is no background.</p><p><strong class="userinput"><code>selected-background-color</code></strong>: Determines the background of the
text when it is selected. The value is a <span class="emphasis"><em>string</em></span> with a hexadecimal
color code. This key is optional, by default there is no background.</p></dd></dl></div><p>In <a class="link" href="color-themes.html#color-themes-gui" title="The Color Themes GUI">the <acronym class="acronym">GUI</acronym> to manage color themes of KTextEditor</a>,
these attributes can be modified in the <strong class="userinput"><code><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Default Text Styles</span></span></code></strong>
tab. 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.</p><p>The available text style keys are the following; the keys used in the
<a class="link" href="color-themes.html#color-themes-json" title="The Color Themes JSON Format"><acronym class="acronym">JSON</acronym> file</a> are listed in <span class="emphasis"><em>bold</em></span>,
the names used in the <a class="link" href="color-themes.html#color-themes-gui" title="The Color Themes GUI"><acronym class="acronym">GUI</acronym></a> are shown in parentheses
if they are different.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Normal Text &amp; Source Code</span></span></span></dt><dd><p><strong class="userinput"><code>Normal</code></strong>:
Default text style for normal text and source code without special highlighting.</p><p><strong class="userinput"><code>Keyword</code></strong>:
Text style for built-in language keywords.</p><p><strong class="userinput"><code>Function</code></strong>:
Text style for function definitions and function calls.</p><p><strong class="userinput"><code>Variable</code></strong>:
Text style for variables, if applicable. For instance, variables in PHP/Perl typically
start with a <strong class="userinput"><code>$</code></strong>, so all identifiers following the pattern
<strong class="userinput"><code>$foo</code></strong> are highlighted as variable.</p><p><strong class="userinput"><code>ControlFlow</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Control Flow</span></span>):
Text style for control flow keywords, such as <span class="emphasis"><em>if</em></span>, <span class="emphasis"><em>then</em></span>,
<span class="emphasis"><em>else</em></span>, <span class="emphasis"><em>return</em></span>, <span class="emphasis"><em>switch</em></span>,
<span class="emphasis"><em>break</em></span>, <span class="emphasis"><em>yield</em></span>, <span class="emphasis"><em>continue</em></span>, etc.</p><p><strong class="userinput"><code>Operator</code></strong>:
Text style for operators, such as <strong class="userinput"><code>+</code></strong>, <strong class="userinput"><code>-</code></strong>,
<strong class="userinput"><code>*</code></strong>, <strong class="userinput"><code>/</code></strong>, <strong class="userinput"><code>%</code></strong>, etc.</p><p><strong class="userinput"><code>BuiltIn</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Built-in</span></span>):
Text style for built-in language classes, functions and objects.</p><p><strong class="userinput"><code>Extension</code></strong>:
Text style for well-known extensions, such as <span class="trademark">Qt</span>™ classes, functions/macros in C++ and
Python or boost.</p><p><strong class="userinput"><code>Preprocessor</code></strong>:
Text style for preprocessor statements or macro definitions.</p><p><strong class="userinput"><code>Attribute</code></strong>:
Text style for annotations or attributes of functions or objects, e.g.
<strong class="userinput"><code>@override</code></strong> in Java, or <strong class="userinput"><code>__declspec(...)</code></strong> and
<strong class="userinput"><code>__attribute__((...))</code></strong> in C++.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Numbers, Types &amp; Constants</span></span></span></dt><dd><p><strong class="userinput"><code>DataType</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Data Type</span></span>):
Text style for built-in data types such as <span class="emphasis"><em>int</em></span>, <span class="emphasis"><em>char</em></span>,
<span class="emphasis"><em>float</em></span>, <span class="emphasis"><em>void</em></span>, <span class="emphasis"><em>u64</em></span>, etc.</p><p><strong class="userinput"><code>DecVal</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Decimal/Value</span></span>):
Text style for decimal values.</p><p><strong class="userinput"><code>BaseN</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Base-N Integer</span></span>):
Text style for numbers with base other than 10.</p><p><strong class="userinput"><code>Float</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Floating Point</span></span>):
Text style for floating point numbers.</p><p><strong class="userinput"><code>Constant</code></strong>:
Text style for language constants and user defined constants, e.g. <span class="emphasis"><em>True</em></span>,
<span class="emphasis"><em>False</em></span>, <span class="emphasis"><em>None</em></span> in Python or <span class="emphasis"><em>nullptr</em></span>
in C/C++; or math constants like <span class="emphasis"><em>PI</em></span>.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Strings &amp; Characters</span></span></span></dt><dd><p><strong class="userinput"><code>Char</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Character</span></span>):
Text style for single characters such as <strong class="userinput"><code>'x'</code></strong>.</p><p><strong class="userinput"><code>SpecialChar</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Special Character</span></span>):
Text style for escaped characters in strings, e.g. <span class="quote">“<span class="quote"><strong class="userinput"><code>hello\n</code></strong></span>”</span>,
and other characters with special meaning in strings, such as substitutions or regex operators.</p><p><strong class="userinput"><code>String</code></strong>:
Text style for strings like <span class="quote">“<span class="quote"><strong class="userinput"><code>hello world</code></strong></span>”</span>.</p><p><strong class="userinput"><code>VerbatimString</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Verbatim String</span></span>):
Text style for verbatim or raw strings like <strong class="userinput"><code>'raw \backlash'</code></strong> in
Perl, CoffeeScript, and shells, as well as <strong class="userinput"><code>r'\raw'</code></strong> in Python,
or such as HERE docs.</p><p><strong class="userinput"><code>SpecialString</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Special String</span></span>):
Text style for special strings, such as regular expressions in ECMAScript, the L<sup>A</sup>T<sub>E</sub>X math
mode, SQL, etc.</p><p><strong class="userinput"><code>Import</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Imports, Modules, Includes</span></span>):
Text style for includes, imports, modules or L<sup>A</sup>T<sub>E</sub>X packages.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Comments &amp; Documentation</span></span></span></dt><dd><p><strong class="userinput"><code>Comment</code></strong>:
Text style for normal comments.</p><p><strong class="userinput"><code>Documentation</code></strong>:
Text style for comments that reflect API documentation, such as
<strong class="userinput"><code>/** doxygen comments */</code></strong> or <strong class="userinput"><code>"""docstrings"""</code></strong>.</p><p><strong class="userinput"><code>Annotation</code></strong>:
Text style for annotations in comments or documentation commands, such as
<strong class="userinput"><code>@param</code></strong> in Doxygen or JavaDoc.</p><p><strong class="userinput"><code>CommentVar</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Comment Variable</span></span>):
Text style that refers to variables names used in above commands in a comment, such as
<strong class="userinput"><code>foobar</code></strong> in <span class="quote">“<span class="quote"><strong class="userinput"><code>@param foobar</code></strong></span>”</span>,
in Doxygen or JavaDoc.</p><p><strong class="userinput"><code>RegionMarker</code></strong> (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Region Marker</span></span>):
Text style for region markers, typically defined by <strong class="userinput"><code>//BEGIN</code></strong>
and <strong class="userinput"><code>//END</code></strong> in comments.</p><p><strong class="userinput"><code>Information</code></strong>:
Text style for information, notes and tips, such as the keyword
<strong class="userinput"><code>@note</code></strong> in Doxygen.</p><p><strong class="userinput"><code>Warning</code></strong>:
Text style for warnings, such as the keyword <strong class="userinput"><code>@warning</code></strong> in Doxygen.</p><p><strong class="userinput"><code>Alert</code></strong>:
Text style for special words in comments, such as <strong class="userinput"><code>TODO</code></strong>,
<strong class="userinput"><code>FIXME</code></strong>, <strong class="userinput"><code>XXXX</code></strong> and <strong class="userinput"><code>WARNING</code></strong>.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Miscellaneous</span></span></span></dt><dd><p><strong class="userinput"><code>Error</code></strong>:
Text style indicating error highlighting and wrong syntax.</p><p><strong class="userinput"><code>Others</code></strong>:
Text style for attributes that do not match any of the other default styles.</p></dd></dl></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="color-themes-custom-styles"></a>Custom Highlighting Text Styles</h4></div></div></div><p>Here you can establish text styles for a specific syntax highlighting definition,
overriding the <strong class="userinput"><code>default text style</code></strong> described in
<a class="link" href="color-themes.html#color-themes-text-styles" title="Default Text Styles">the previous section</a>.
</p><p>In the <a class="link" href="color-themes.html#color-themes-json" title="The Color Themes JSON Format"><acronym class="acronym">JSON</acronym> theme file</a>, this corresponds
to the <strong class="userinput"><code>custom-styles</code></strong> key, whose value is an <span class="emphasis"><em>object</em></span>
where each subschema key corresponds to the <strong class="userinput"><code>name of a syntax highlighting definition</code></strong>.
Its value is an <span class="emphasis"><em>object</em></span> where each key refers to the <strong class="userinput"><code>style attributes
name</code></strong> defined in <a class="link" href="highlight.html#kate-highlight-sections" title="The Sections in Detail">the <strong class="userinput"><code>itemData</code></strong>
elements</a> of the syntax highlighting <acronym class="acronym">XML</acronym> file, and the respective value is a sub-object with the keys
<span class="emphasis"><em>text-color</em></span>, <span class="emphasis"><em>selected-text-color</em></span>, <span class="emphasis"><em>bold</em></span>,
<span class="emphasis"><em>italic</em></span>, <span class="emphasis"><em>underline</em></span>, <span class="emphasis"><em>strike-through</em></span>,
<span class="emphasis"><em>background-color</em></span> and <span class="emphasis"><em>selected-background-color</em></span>, defined in
<a class="link" href="color-themes.html#color-themes-text-styles" title="Default Text Styles">the previous section</a>. Each of these values are optional,
since if they are not present, the style set in <strong class="userinput"><code>text-styles</code></strong> is considered.
</p><p>For example, in this piece of code, the <span class="quote">“<span class="quote">ISO C++</span>”</span> syntax highlighting definition
has a special text style for the <span class="quote">“<span class="quote">Type Modifiers</span>”</span> and <span class="quote">“<span class="quote">Standard Classes</span>”</span>
attributes. In the corresponding <acronym class="acronym">XML</acronym> file <span class="quote">“<span class="quote">isocpp.xml</span>”</span>, the defined attribute
<span class="quote">“<span class="quote">Standard Classes</span>”</span> uses the default style <strong class="userinput"><code>BuiltIn</code></strong> (or dsBuiltIn).
In this attribute, only the value of <strong class="userinput"><code>text-color</code></strong> is overwritten by the new
color <span class="quote">“<span class="quote">#6431b3</span>”</span>.
</p><pre class="programlisting">
"custom-styles": {
    "ISO C++": {
        "Standard Classes": {
            "text-color": "#6431b3"
        },
        "Type Modifiers": {
            "bold": true,
            "selected-text-color": "#009183",
            "text-color": "#00b5cf"
        }
    }
}
</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>You should consider that these text styles are associated with the attribute names defined
in the syntax highlighting <acronym class="acronym">XML</acronym> files. If an XML file is updated and some attributes are renamed
or removed, the custom style defined in the theme will no longer apply.</p></li><li class="listitem"><p>Syntax highlighting definitions often include other definitions. For example, the
<span class="quote">“<span class="quote">QML</span>”</span> highlighter includes the <span class="quote">“<span class="quote">JavaScript</span>”</span> highlighter,
since they share functionality in highlighting.</p></li></ul></div></div><p>In <a class="link" href="color-themes.html#color-themes-gui" title="The Color Themes GUI">the <acronym class="acronym">GUI</acronym> to manage themes of KTextEditor</a>,
these attributes can be modified in the
<strong class="userinput"><code><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Highlighting Text Styles</span></span></code></strong> tab.
By default, the editor preselects the highlighting of the current document. You will notice that
many highlights contain other highlights represented by groups in the style list. For example
most highlights import the <span class="quote">“<span class="quote">Alert</span>”</span> highlight, and many source code formats import
the <span class="quote">“<span class="quote">Doxygen</span>”</span> highlight.
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="color-themes-gui"></a>The Color Themes <acronym class="acronym">GUI</acronym></h3></div></div></div><p>The simplest way to create and edit color themes is through the <acronym class="acronym">GUI</acronym> within
the <a class="link" href="config-dialog.html" title="Chapter 7. Configure KatePart"><span class="quote">“<span class="quote">Configure</span>”</span> dialog</a> provided
by <a class="ulink" href="https://api.kde.org/frameworks/ktexteditor/html/" target="_top">KTextEditor</a>.
To access it, select <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Settings</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Configure <span class="replaceable"><em class="replaceable"><code>Application</code></em></span>...</span></span>
from the menubar in your text editor. This brings up the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Configure</span></span>
dialog box, there select <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Color Themes</span></span> in the side panel.
</p><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="color-themes-gui-default-text-styles.png" alt="Kate's settings dialog box with the color theme management."><div class="caption"><p><span class="application">Kate</span>'s settings dialog box with the color theme management.</p></div></div><p>In this <a class="link" href="config-dialog.html" title="Chapter 7. Configure KatePart">dialog</a> you can configure all the colors
in any theme you have, as well as create/copy new themes, delete them, export them to a
<strong class="userinput"><code>.theme</code></strong> file with <a class="link" href="color-themes.html#color-themes-json" title="The Color Themes JSON Format"><acronym class="acronym">JSON</acronym> format</a>
or import them from external <strong class="userinput"><code>.theme</code></strong> files. Each theme has settings
for text colors and styles.
</p><p>The built-in themes cannot be modified by default. To do this, you need to copy
them and give them a new name.</p><p>To use a theme permanently in your text editor, you must select it in the combobox
labeled <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Default theme for <span class="replaceable"><em class="replaceable"><code>Application</code></em></span></span></span> at
the bottom of the dialog and press <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Apply</span></span> or <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">OK</span></span>.
By default, the <strong class="userinput"><code><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Automatic Selection</span></span></code></strong> option is
active, which chooses a more appropriate color theme according to the
<span class="emphasis"><em><span class="orgname">KDE</span> <span class="productname">Plasma</span> color scheme</em></span> used in the text editing application;
it usually chooses between <span class="quote">“<span class="quote">Breeze Light</span>”</span> and <span class="quote">“<span class="quote">Breeze Dark</span>”</span>
if the scheme is light or dark, respectively.
</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><p>
You can adjust the <span class="orgname">KDE</span> global color scheme in the
<a class="ulink" href="help:/kcontrol/colors/" target="_top"><span class="quote">“<span class="quote">Colors</span>”</span> module in <span class="application">System Settings</span></a>.
You can also change it in some applications individually such as <span class="application">Kate</span> or <span class="application">KDevelop</span>, from the menu
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Settings</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Color Scheme</span></span>.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="color-themes-gui-new-theme"></a>Create a new theme</h4></div></div></div><p>To create a new theme, it is first necessary to copy an existing one. Select an existing
theme which you want to use as a base, such as <span class="quote">“<span class="quote">Breeze Light</span>”</span> or <span class="quote">“<span class="quote">Breeze Dark</span>”</span>,
and click <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Copy</span></span>. Then write a name for the new theme.
</p><p>If you want to modify a built-in or read-only theme, you must first copy it under a different name.</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="color-themes-gui-import-export"></a>Import or export <acronym class="acronym">JSON</acronym> theme files</h4></div></div></div><p>You can export a selected theme (including built-in ones) to a
<a class="link" href="color-themes.html#color-themes-json" title="The Color Themes JSON Format"><acronym class="acronym">JSON</acronym> file</a> with <strong class="userinput"><code>.theme</code></strong>
extension, with the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Export</span></span> button. This will open a dialog
to save the file. To add a color theme from an external
<a class="link" href="color-themes.html#color-themes-json" title="The Color Themes JSON Format"><acronym class="acronym">JSON</acronym> file</a>, just press the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Import</span></span> button and select the
<strong class="userinput"><code>.theme</code></strong> file from the dialog.
</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>As <a class="link" href="color-themes.html#color-themes-json-overview" title="Overview">mentioned above</a>, user-customized theme
files are stored in the <code class="filename">org.kde.syntax-highlighting/themes/</code>
directory. When you copy or create a theme, it will automatically appear there. Also, importing
or adding a theme is equivalent to copying an external <strong class="userinput"><code>.theme</code></strong> file into this
directory. KSyntaxHighlighting automatically picks up color theme files from this directory.</p></li><li class="listitem"><p>If you want to publish a theme created by you, it is essential to check the
<a class="link" href="color-themes.html#color-themes-json-metadata" title="Metadata">metadata</a> object of the
<a class="link" href="color-themes.html#color-themes-json" title="The Color Themes JSON Format"><acronym class="acronym">JSON</acronym> file</a>, adding the respective license and
checking the revision number.</p></li></ul></div></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="color-themes-gui-editing"></a>Editing color themes</h4></div></div></div><div class="sect4"><div class="titlepage"><div><div><h5 class="title"><a name="prefcolors-colors"></a>Colors</h5></div></div></div><p>Here the colors of the text editing area are adjusted. These are detailed in
<a class="xref" href="color-themes.html#color-themes-editor-colors" title="Editor Colors">the section called “Editor Colors”</a>.</p></div><div class="sect4"><div class="titlepage"><div><div><h5 class="title"><a name="prefcolors-normal-text-styles"></a>Default Text Styles</h5></div></div></div><p>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
KSyntaxHighlighting can highlight.</p><p>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.
</p><p>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.</p><p>The attributes of this area are detailed in
<a class="xref" href="color-themes.html#color-themes-text-styles" title="Default Text Styles">the section called “Default Text Styles”</a>.</p></div><div class="sect4"><div class="titlepage"><div><div><h5 class="title"><a name="prefcolors-highlighting-text-styles"></a>Highlighting Text Styles</h5></div></div></div><p>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 <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Highlight</span></span> combobox
above the style list.
</p><p>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.
</p><p>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.</p><p>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.
</p></div></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="color-themes-tips-and-tricks"></a>Tips &amp; Tricks</h3></div></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="color-themes-contrast"></a>Contrast of Text Colors</h4></div></div></div><p>An important aspect when working with color themes is to choose a text contrast
that makes it easier to read, especially in combination with the background.</p><p>The <strong class="userinput"><code>Kontrast</code></strong> application is a color contrast checker. It tells
you that the text color and background color combinations are readable and accessible, so
this is an excellent tool to help you create color themes.</p><p>You can download <strong class="userinput"><code>Kontrast</code></strong> from
<a class="ulink" href="https://apps.kde.org/en/kontrast" target="_top">the <span class="orgname">KDE</span> Applications website</a>
or from <a class="ulink" href="https://flathub.org/apps/details/org.kde.kontrast" target="_top">the Flatpak
package on Flathub</a> (only in GNU/Linux).</p><p>The GNOME <strong class="userinput"><code>Contrast</code></strong> application is similar. You can download
<a class="ulink" href="https://flathub.org/apps/details/org.gnome.design.Contrast" target="_top">the Flatpak
package on Flathub</a> (only in GNU/Linux).</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="color-themes-tips-and-tricks-consistency"></a>Suggestions of Consistency with Syntax Highlighting</h4></div></div></div><p>KSyntaxHighlighting includes <a class="ulink" href="https://kate-editor.org/syntax/" target="_top">more
than 300 syntax highlighting definitions</a>, therefore it is ideal that you
make sure your new theme looks good in all syntax highlighting definitions.
The built-in color themes have the following similarities that it is
recommended (but not required) to follow to achieve a correct display of all syntax
highlighting definitions:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>Use bold for the <span class="quote">“<span class="quote">Keyword</span>”</span> and <span class="quote">“<span class="quote">ControlFlow</span>”</span>
<a class="link" href="color-themes.html#color-themes-text-styles" title="Default Text Styles">text styles</a>.</p></li><li class="listitem"><p>Do not use background color in any
<a class="link" href="color-themes.html#color-themes-text-styles" title="Default Text Styles">text style</a>, except <span class="quote">“<span class="quote">Alert</span>”</span>
and <span class="quote">“<span class="quote">RegionMarker</span>”</span>.</p></li></ul></div><p>Most of the syntax highlighters are intended to look good on the default themes
<span class="quote">“<span class="quote">Breeze Light</span>”</span> and <span class="quote">“<span class="quote">Breeze Dark</span>”</span>, therefore, another way to
maintain consistency is to use similar colors in the
<a class="link" href="color-themes.html#color-themes-text-styles" title="Default Text Styles">text styles</a>, like <span class="emphasis"><em>green</em></span>
for <span class="quote">“<span class="quote">Preprocessor</span>”</span> and <span class="quote">“<span class="quote">Others</span>”</span>, <span class="emphasis"><em>blue</em></span> for
<span class="quote">“<span class="quote">DataType</span>”</span> and <span class="quote">“<span class="quote">Attribute</span>”</span>, or <span class="emphasis"><em>purple</em></span> for
<span class="quote">“<span class="quote">Function</span>”</span>.</p><p>Note that these recommendations are not mandatory when creating and publishing
a theme.</p></div></div></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="highlight.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="dev-scripting.html">Next</a></td></tr><tr><td class="prevCell">Working with Syntax Highlighting </td><td class="upCell">Extending <span class="application">KatePart</span></td><td class="nextCell"> Scripting with <span class="application">JavaScript</span></td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="dev-scripting.html"><html><head><title>Scripting with JavaScript</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="dev.html" title="Chapter 6. Extending KatePart"><link rel="prev" href="color-themes.html" title="Working with Color Themes"><link rel="next" href="config-dialog.html" title="Chapter 7. Configure KatePart"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Scripting with <span class="application">JavaScript</span></div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="color-themes.html">Prev</a></td><td class="upCell">Extending <span class="application">KatePart</span></td><td class="nextCell"><a accesskey="n" href="config-dialog.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dev-scripting"></a>Scripting with <span class="application">JavaScript</span></h2></div></div></div><p>
The <span class="application">KatePart</span> editor component is easily extensible by writing scripts.
The scripting language is ECMAScript (widely known as <span class="application">JavaScript</span>).
<span class="application">KatePart</span> supports two kinds of scripts: indentation and command line scripts.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="dev-scripting-indentation"></a>Indentation Scripts</h3></div></div></div><p>
Indentation scripts - also referred as indenters - automatically indent the
source code while typing text. As an example, after hitting the return key
the indentation level often increases.
</p><p>
The following sections describe step by step how to create the skeleton for a
simple indenter. As a first step, create a new <code class="filename">*.js</code> file
called <abbr class="abbrev">e.g.</abbr> <code class="filename">javascript.js</code> in the local home folder
<code class="filename">$<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="envar"><code class="envar">XDG_DATA_HOME</code></span>/katepart5/script/indentation</code>.
Therein, the environment variable <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="envar"><code class="envar">XDG_DATA_HOME</code></span> typically expands to
either <code class="filename">~/.local</code> or <code class="filename">~/.local/share</code>.
</p><p>On <span class="trademark">Windows</span>® these files are located in <code class="filename">%USERPROFILE%\AppData\Local\katepart5\script\indentation</code>.
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>%USERPROFILE%</code></em></span> usually expands to <code class="filename">C:\\Users\\<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>user</code></em></span></code>.</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="dev-scripting-indentation-header"></a>The Indentation Script Header</h4></div></div></div><p>
The header of the file <code class="filename">javascript.js</code> is embedded as <acronym class="acronym">JSON</acronym> at the beginning of the document as follows:

</p><pre class="programlisting">
var katescript = {
    "name": "JavaScript",
    "author": "Example Name &lt;example.name@some.address.org&gt;",
    "license": "BSD License",
    "revision": 1,
    "kate-version": "5.1",
    "required-syntax-style": "javascript",
    "indent-languages": ["javascript"],
    "priority": 0,
}; // kate-script-header, must be at the start of the file without comments
</pre><p>

Each entry is explained in detail now:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
<code class="literal">name</code> [required]: This is the indenter name that appears in the menu
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Indentation</span></span>
and in the configuration dialog.
</p></li><li class="listitem"><p>
<code class="literal">author</code> [optional]: The author's name and contact information.
</p></li><li class="listitem"><p>
<code class="literal">license</code> [optional]: Short form of the license, such as BSD License or LGPLv3.
</p></li><li class="listitem"><p>
<code class="literal">revision</code> [required]: The revision of the script. This number should be increased whenever the script is modified.
</p></li><li class="listitem"><p>
<code class="literal">kate-version</code> [required]: Minimum required <span class="application">KatePart</span> version.
</p></li><li class="listitem"><p>
<code class="literal">required-syntax-style</code> [optional]: The required syntax style, which matches the specified <code class="literal">style</code> in syntax highlighting files. This is important for indenters that rely on specific highlight information in the document. If a required syntax style is specified, the indenter is available only when the appropriate highlighter is active. This prevents <span class="quote">“<span class="quote">undefined behavior</span>”</span> caused by using the indenter without the expected highlighting schema. For instance, the Ruby indenter makes use of this in the files <code class="filename">ruby.js</code> and <code class="filename">ruby.xml</code>.
</p></li><li class="listitem"><p>
<code class="literal">indent-languages</code> [optional]: <acronym class="acronym">JSON</acronym> array of syntax styles the indenter can indent correctly, <abbr class="abbrev">e.g.</abbr>: <code class="literal">["c++", "java"]</code>.
</p></li><li class="listitem"><p>
<code class="literal">priority</code> [optional]: If several indenters are suited for a certain highlighted file, the priority decides which indenter is chosen as default indenter.
</p></li></ul></div><p>
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="dev-scripting-indentation-body"></a>The Indenter Source Code</h4></div></div></div><p>
Having specified the header this section explains how the indentation scripting
itself works. The basic skeleton of the body looks like this:

</p><pre class="programlisting">
// required katepart js libraries, <abbr class="abbrev">e.g.</abbr> range.js if you use Range
require ("range.js");

triggerCharacters = "{}/:;";
function indent(line, indentWidth, ch)
{
    // called for each newline (ch == '\n') and all characters specified in
    // the global variable triggerCharacters. When calling <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Format Indentation</span></span>
    // the variable ch is empty, i.e. ch == ''.
    //
    // see also: Scripting API
    return -2;
}
</pre><p>

The function <code class="function">indent()</code> has three parameters:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="literal">line</code>: the line that has to be indented</p></li><li class="listitem"><p><code class="literal">indentWidth</code>: the indentation width in number of spaces</p></li><li class="listitem"><p><code class="literal">ch</code>: either a newline character (<code class="literal">ch == '\n'</code>), the trigger character specified in <code class="literal">triggerCharacters</code> or empty if the user invoked the action <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Format Indentation</span></span>.</p></li></ul></div><p>
The return value of the <code class="function">indent()</code> function specifies how
the line will be indented. If the return value is a simple integer number, it
is interpreted as follows:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>return value <code class="literal">-2</code>: do nothing</p></li><li class="listitem"><p>return value <code class="literal">-1</code>: keep indentation (searches for previous non-blank line)</p></li><li class="listitem"><p>return value <code class="literal"> 0</code>: numbers &gt;= 0 specify the indentation depth in spaces</p></li></ul></div><p>
Alternatively, an array of two elements can be returned:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="literal">return [ indent, align ];</code></p></li></ul></div><p>
In this case, the first element is the indentation depth as above with the
same meaning of the special values. However, the second element is an absolute
value representing a column for <span class="quote">“<span class="quote">alignment</span>”</span>. If this value is higher than the
indent value, the difference represents a number of spaces to be added after
the indentation of the first parameter. Otherwise, the second number is ignored.
Using tabs and spaces for indentation is often referred to as <span class="quote">“<span class="quote">mixed mode</span>”</span>.
</p><p>
Consider the following example: Assume using tabs to indent, and tab width is set
to 4. Here, &lt;tab&gt; represents a tab and '.' a space:
</p><pre class="programlisting">
1: &lt;tab&gt;&lt;tab&gt;foobar("hello",
2: &lt;tab&gt;&lt;tab&gt;......."world");
</pre><p>
When indenting line 2, the <code class="function">indent()</code> function returns [8, 15]. As result, two
tabs are inserted to indent to column 8, and 7 spaces are added to align the
second parameter under the first, so that it stays aligned if the file is viewed
with a different tab width.
</p><p>
A default <span class="orgname">KDE</span> installation ships <span class="application">KatePart</span> with several indenters. The
corresponding <span class="application">JavaScript</span> source code can be found in <code class="filename">$<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="envar"><code class="envar">XDG_DATA_DIRS</code></span>/katepart5/script/indentation</code>.</p><p>On <span class="trademark">Windows</span>® these files are located in <code class="filename">%USERPROFILE%\AppData\Local\katepart5\script\indentation</code>.
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>%USERPROFILE%</code></em></span> usually expands to <code class="filename">C:\\Users\\<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>user</code></em></span></code>.
</p><p>
Developing an indenter requires reloading the scripts to see whether the changes
behave appropriately. Instead of restarting the application, simply switch to
the command line and invoke the command <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>reload-scripts</strong></span></span>.
</p><p>
If you develop useful scripts please consider contributing to the <span class="application">KatePart</span> Project
by <a class="ulink" href="mailto:kwrite-devel@kde.org" target="_top">contacting the mailing list</a>.
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="dev-scripting-command-line"></a>Command Line Scripts</h3></div></div></div><p>
As it is hard to satisfy everyone's needs, <span class="application">KatePart</span> supports little helper tools
for quick text manipulation through the
<a class="link" href="advanced-editing-tools-commandline.html" title="The Editor Component Command Line">built-in command line</a>.
For instance, the command
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>sort</strong></span></span> is implemented as a script. This section explains how to create
<code class="filename">*.js</code> files to extend <span class="application">KatePart</span> with arbitrary helper scripts.
</p><p>
Command line scripts are located in the same folder as indentation scripts.
So as a first step, create a new <code class="filename">*.js</code> file called
<code class="filename">myutils.js</code> in the local home folder
<code class="filename">$<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="envar"><code class="envar">XDG_DATA_HOME</code></span>/katepart5/script/commands</code>.
Therein, the environment variable <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="envar"><code class="envar">XDG_DATA_HOME</code></span> typically expands to
either <code class="filename">~/.local</code> or <code class="filename">~/.local/share</code>.</p><p>On <span class="trademark">Windows</span>® these files are located in <code class="filename">%USERPROFILE%\AppData\Local\katepart5\script\commands</code>.
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>%USERPROFILE%</code></em></span> usually expands to <code class="filename">C:\\Users\\<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>user</code></em></span></code>.
</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="dev-scripting-command-line-header"></a>The Command Line Script Header</h4></div></div></div><p>
The header of each command line script is embedded in <acronym class="acronym">JSON</acronym> at the beginning of the script as follows:

</p><pre class="programlisting">
var katescript = {
    "author": "Example Name &lt;example.name@some.address.org&gt;",
    "license": "LGPLv2+",
    "revision": 1,
    "kate-version": "5.1",
    "functions": ["sort", "moveLinesDown"],
    "actions": [
        {   "function": "sort",
            "name": "Sort Selected Text",
            "category": "Editing",
            "interactive": "false"
        },
        {   "function": "moveLinesDown",
            "name": "Move Lines Down",
            "category": "Editing",
            "shortcut": "Ctrl+Shift+Down",
            "interactive": "false"
        }
    ]
}; // kate-script-header, must be at the start of the file without comments
</pre><p>

Each entry is explained in detail now:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="literal">author</code> [optional]: The author's name and contact information.</p></li><li class="listitem"><p><code class="literal">license</code> [optional]: Short form of the license, such as BSD License or LGPLv2.</p></li><li class="listitem"><p><code class="literal">revision</code> [required]: The revision of the script. This number should be increased whenever the script is modified.</p></li><li class="listitem"><p><code class="literal">kate-version</code> [required]: Minimum required <span class="application">KatePart</span> version.</p></li><li class="listitem"><p><code class="literal">functions</code> [required]: <acronym class="acronym">JSON</acronym> array of commands in the script.</p></li><li class="listitem"><p><code class="literal">actions</code> [optional]: <acronym class="acronym">JSON</acronym> Array of <acronym class="acronym">JSON</acronym> objects that defines the actions that appear in the application menu. Detailed information is provided in the section <a class="link" href="advanced-editing-tools-commandline.html" title="The Editor Component Command Line">Binding Shortcuts</a>.</p></li></ul></div><p>
</p><p>
Since the value of <code class="literal">functions</code> is a <acronym class="acronym">JSON</acronym> array, a single script is able to contain an arbitrary number
of command line commands. Each function is available through <span class="application">KatePart</span>'s
<a class="link" href="advanced-editing-tools-commandline.html" title="The Editor Component Command Line">built-in command line</a>.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="dev-scripting-command-line-body"></a>The Script Source Code</h4></div></div></div><p>
All functions specified in the header have to be implemented in the script.
For instance, the script file from the example above needs to implement the two
functions <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>sort</strong></span></span> and <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>moveLinesDown</strong></span></span>.
All functions have the following syntax:

</p><pre class="programlisting">
// required katepart js libraries, <abbr class="abbrev">e.g.</abbr> range.js if you use Range
require ("range.js");

function &lt;name&gt;(arg1, arg2, ...)
{
    // ... implementation, see also: Scripting API
}
</pre><p>
</p><p>
Arguments in the command line are passed to the function as
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>arg1</code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>arg2</code></em></span>, <abbr class="abbrev">etc.</abbr>
In order to provide documentation for each command, simply implement the
'<code class="function">help</code>' function as follows:

</p><pre class="programlisting">
function help(cmd)
{
    if (cmd == "sort") {
        return i18n("Sort the selected text.");
    } else if (cmd == "...") {
        // ...
    }
}
</pre><p>

Executing <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>help sort</strong></span></span> in the command line then calls this help function with
the argument <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>cmd</code></em></span> set to the given command, <abbr class="abbrev">i.e.</abbr>
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>cmd == "sort"</code></em></span>. <span class="application">KatePart</span> then presents the returned text as
documentation to the user. Make sure to
<a class="link" href="dev-scripting.html#dev-scripting-api-i18n" title="Translation">translate the strings</a>.
</p><p>
Developing a command line script requires reloading the scripts to see whether
the changes behave appropriately. Instead of restarting the application, simply
switch to the command line and invoke the command <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>reload-scripts</strong></span></span>.
</p><div class="sect4"><div class="titlepage"><div><div><h5 class="title"><a name="dev-scripting-command-line-shortcuts"></a>Binding Shortcuts</h5></div></div></div><p>In order to make the scripts accessible in the application menu and assign shortcuts, the script needs to provide an appropriate
script header. In the above example, both functions <code class="literal">sort</code> and <code class="literal">moveLinesDown</code> appear in the menu
due to the following part in the script header:
</p><pre class="programlisting">
var katescript = {
    ...
    "actions": [
        {   "function": "sort",
            "name": "Sort Selected Text",
            "icon": "",
            "category": "Editing",
            "interactive": "false"
        },
        {   "function": "moveLinesDown",
            "name": "Move Lines Down",
            "icon": "",
            "category": "Editing",
            "shortcut": "Ctrl+Shift+Down",
            "interactive": "false"
        }
    ]
};
</pre><p>
The fields for one action are as follows:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="literal">function</code> [required]: The function that should appear in the menu <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guisubmenu">Scripts</span></span>.</p></li><li class="listitem"><p><code class="literal">name</code> [required]: The text appears in the script menu.</p></li><li class="listitem"><p><code class="literal">icon</code> [optional]: The icon appears next to the text in the menu. All <span class="orgname">KDE</span> icon names can be used here.</p></li><li class="listitem"><p><code class="literal">category</code> [optional]: If a category is specified, the script appears in a submenu.</p></li><li class="listitem"><p><code class="literal">shortcut</code> [optional]: The shortcut given here is the default shortcut. Example: <code class="literal">Ctrl+Alt+t</code>. See the <a class="ulink" href="https://doc.qt.io/qt-5/qt.html#Key-enum" target="_top"><span class="trademark">Qt</span>™ documentation</a> for further details.</p></li><li class="listitem"><p><code class="literal">interactive</code> [optional]: If the script needs user input in the command line, set this to <code class="literal">true</code>.</p></li></ul></div><p>
</p><p>
If you develop useful scripts please consider contributing to the <span class="application">KatePart</span> Project
by <a class="ulink" href="mailto:kwrite-devel@kde.org" target="_top">contacting the mailing list</a>.
</p></div></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="dev-scripting-api"></a>Scripting API</h3></div></div></div><p>
The scripting API presented here is available to all scripts, <abbr class="abbrev">i.e.</abbr> indentation
scripts and command line commands.
The <code class="classname">Cursor</code> and <code class="classname">Range</code> classes are provided by library files in <code class="filename">$<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="envar"><code class="envar">XDG_DATA_DIRS</code></span>/katepart5/libraries</code>.
If you want to use them in your script, which needs to use some of the <code class="classname">Document</code> or <code class="classname">View</code> functions, please include the necessary library by using:

</p><pre class="programlisting">
// required katepart js libraries, <abbr class="abbrev">e.g.</abbr> range.js if you use Range
require ("range.js");
</pre><p>
</p><p>
To extend the standard scripting API with your own functions and prototypes simply
create a new file in <span class="orgname">KDE</span>'s local configuration folder
<code class="filename">$<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="envar"><code class="envar">XDG_DATA_HOME</code></span>/katepart5/libraries</code> and include it into your script using:

</p><pre class="programlisting">
require ("myscriptnamehere.js");
</pre><p>

</p><p>On <span class="trademark">Windows</span>® these files are located in <code class="filename">%USERPROFILE%\AppData\Local\katepart5\libraries</code>.
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>%USERPROFILE%</code></em></span> usually expands to <code class="filename">C:\\Users\\<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>user</code></em></span></code>.</p><p>
To extend existing prototypes like <code class="classname">Cursor</code> or
<code class="classname">Range</code>, the recommended way is to
<span class="emphasis"><em>not</em></span> modify the global <code class="filename">*.js</code> files.
Instead, change the <code class="classname">Cursor</code> prototype in <span class="application">JavaScript</span> after the <code class="filename">cursor.js</code> is included into your
script via <code class="literal">require</code>.
</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="dev-scripting-api-prototypes"></a>Cursors and Ranges</h4></div></div></div><p>
As <span class="application">KatePart</span> is a text editor, all the scripting API is based on cursors and
ranges whenever possible. A Cursor is a simple <code class="literal">(line, column)</code>
tuple representing a text position in the document. A Range spans text from a
starting cursor position to an ending cursor position. The API is explained in
detail in the next sections.
</p><div class="sect4"><div class="titlepage"><div><div><h5 class="title"><a name="dev-scripting-api-cursors"></a>The Cursor Prototype</h5></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><pre class="synopsis">
Cursor();
</pre></span></dt><dd><p>
Constructor. Returns a Cursor at position <code class="literal">(0, 0)</code>.</p><p>Example: <code class="function">var cursor = new Cursor();</code>
</p></dd><dt><span class="term"><pre class="synopsis">
Cursor(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Constructor. Returns a Cursor at position (line, column).
</p><p>Example: <code class="function">var cursor = new Cursor(3, 42);</code>
</p></dd><dt><span class="term"><pre class="synopsis">
Cursor(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>other</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Copy constructor. Returns a copy of the cursor <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>other</code></em></span>.
</p><p>Example: <code class="function">var copy = new Cursor(other);</code>
</p></dd><dt><span class="term"><pre class="synopsis">
Cursor Cursor.clone();
</pre></span></dt><dd><p>
Returns a clone of the cursor.</p><p>Example: <code class="function">var clone = cursor.clone();</code>
</p></dd><dt><span class="term"><pre class="synopsis">
Cursor.setPosition(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Sets the cursor position to <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>line</code></em></span> and <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>column</code></em></span>.</p><p>
Since: <span class="orgname">KDE</span> 4.11
</p></dd><dt><span class="term"><pre class="synopsis">
bool Cursor.isValid();
</pre></span></dt><dd><p>
Check whether the cursor is valid. The cursor is invalid, if line and/or
column are set to <code class="literal">-1</code>.
</p><p>
Example: <code class="function">var valid = cursor.isValid();</code>
</p></dd><dt><span class="term"><pre class="synopsis">
Cursor Cursor.invalid();
</pre></span></dt><dd><p>
Returns a new invalid cursor located at <code class="literal">(-1, -1)</code>.
</p><p>Example: <code class="function">var invalidCursor = cursor.invalid();</code>
</p></dd><dt><span class="term"><pre class="synopsis">
int Cursor.compareTo(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>other</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Compares this cursor to the cursor <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>other</code></em></span>. Returns
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="literal">-1</code>, if this cursor is located before the cursor <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>other</code></em></span>,</p></li><li class="listitem"><p><code class="literal">0</code>, if both cursors equal and</p></li><li class="listitem"><p><code class="literal">+1</code>, if this cursor is located after the cursor <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>other</code></em></span>.</p></li></ul></div><p>
</p></dd><dt><span class="term"><pre class="synopsis">
bool Cursor.equals(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>other</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Returns <code class="literal">true</code>, if this cursor and the cursor <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>other</code></em></span> are
equal, otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
String Cursor.toString();
</pre></span></dt><dd><p>
Returns the cursor as a string of the form <span class="quote">“<span class="quote"><code class="literal">Cursor(line, column)</code></span>”</span>.
</p></dd></dl></div></div><div class="sect4"><div class="titlepage"><div><div><h5 class="title"><a name="dev-scripting-api-ranges"></a>The Range Prototype</h5></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><pre class="synopsis">
Range();
</pre></span></dt><dd><p>
Constructor. Calling <code class="literal">new Range()</code> returns a Range at (0, 0) - (0, 0).
</p></dd><dt><span class="term"><pre class="synopsis">
Range(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>start</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>end</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Constructor. Calling <code class="literal">new Range(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>start</code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>end</code></em></span>)</code> returns the Range (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>start</code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>end</code></em></span>).
</p></dd><dt><span class="term"><pre class="synopsis">
Range(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>startLine</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>startColumn</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>endLine</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>endColumn</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Constructor. Calling <code class="literal">new Range(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>startLine</code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>startColumn</code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>endLine</code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>endColumn</code></em></span>)</code>
returns the Range from (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>startLine</code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>startColumn</code></em></span>) to (<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>endLine</code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>endColumn</code></em></span>).
</p></dd><dt><span class="term"><pre class="synopsis">
Range(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Range <span class="replaceable"><em class="replaceable"><code>other</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Copy constructor. Returns a copy of Range <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>other</code></em></span>.
</p></dd><dt><span class="term"><pre class="synopsis">
Range Range.clone();
</pre></span></dt><dd><p>
Returns a clone of the range.
</p><p>Example: <code class="function">var clone = range.clone();</code>
</p></dd><dt><span class="term"><pre class="synopsis">
bool Range.isEmpty();
</pre></span></dt><dd><p>
Returns <code class="literal">true</code>, if the start and end cursors are equal.
</p><p>Example: <code class="function">var empty = range.isEmpty();</code>
</p><p>
Since: <span class="orgname">KDE</span> 4.11
</p></dd><dt><span class="term"><pre class="synopsis">
bool Range.isValid();
</pre></span></dt><dd><p>
Returns <code class="literal">true</code>, if both start and end cursor are valid, otherwise <code class="literal">false</code>.
</p><p>Example: <code class="function">var valid = range.isValid();</code>
</p></dd><dt><span class="term"><pre class="synopsis">
Range Range.invalid();
</pre></span></dt><dd><p>
Returns the Range from (-1, -1) to (-1, -1).
</p></dd><dt><span class="term"><pre class="synopsis">
bool Range.contains(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Returns <code class="literal">true</code>, if this range contains the cursor position, otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
bool Range.contains(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Range <span class="replaceable"><em class="replaceable"><code>other</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Returns <code class="literal">true</code>, if this range contains the Range <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>other</code></em></span>,
otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
bool Range.containsColumn(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Returns <code class="literal">true</code>, if <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>column</code></em></span> is in the half open interval
<code class="literal">[start.column, end.column)</code>, otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
bool Range.containsLine(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Returns <code class="literal">true</code>, if <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>line</code></em></span> is in the half open interval
<code class="literal">[start.line, end.line)</code>, otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
bool Range.overlaps(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Range <span class="replaceable"><em class="replaceable"><code>other</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Returns <code class="literal">true</code>, if this range and the range <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>other</code></em></span> share
a common region, otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
bool Range.overlapsLine(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Returns <code class="literal">true</code>, if <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>line</code></em></span> is in the interval
<code class="literal">[start.line, end.line]</code>, otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
bool Range.overlapsColumn(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Returns <code class="literal">true</code>, if <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>column</code></em></span> is in the interval
<code class="literal">[start.column, end.column]</code>, otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
bool Range.onSingleLine();
</pre></span></dt><dd><p>
Returns <code class="literal">true</code>, if the range starts and ends at the same line,
<abbr class="abbrev">i.e.</abbr> if <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>Range.start.line == Range.end.line</code></em></span>.
</p><p>
Since: <span class="orgname">KDE</span> 4.9
</p></dd><dt><span class="term"><pre class="synopsis">
bool Range.equals(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Range <span class="replaceable"><em class="replaceable"><code>other</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Returns <code class="literal">true</code>, if this range and the Range <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>other</code></em></span> are
equal, otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
String Range.toString();
</pre></span></dt><dd><p>
Returns the range as a string of the form <span class="quote">“<span class="quote"><code class="literal">Range(Cursor(line, column), Cursor(line, column))</code></span>”</span>.
</p></dd></dl></div></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="dev-scripting-api-global"></a>Global Functions</h4></div></div></div><p>This section lists all global functions.</p><div class="sect4"><div class="titlepage"><div><div><h5 class="title"><a name="dev-scripting-api-includes"></a>Reading &amp; Including Files</h5></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><pre class="synopsis">
String read(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>file</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Will search the given <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>file</code></em></span> relative to the <code class="literal">katepart5/script/files</code> directory and return its content as a string.
</p></dd></dl></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><pre class="synopsis">
void require(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>file</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Will search the given <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>file</code></em></span> relative to the <code class="literal">katepart5/script/libraries</code> directory and evaluate it.
<code class="literal">require</code> is internally guarded against multiple inclusions of the same <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>file</code></em></span>.
</p><p>
  Since: <span class="orgname">KDE</span> 4.10
</p></dd></dl></div></div><div class="sect4"><div class="titlepage"><div><div><h5 class="title"><a name="dev-scripting-api-debug"></a>Debugging</h5></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><pre class="synopsis">
void debug(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>text</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Prints <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>text</code></em></span> to <code class="literal">stdout</code> in the
console launching the application.
</p></dd></dl></div></div><div class="sect4"><div class="titlepage"><div><div><h5 class="title"><a name="dev-scripting-api-i18n"></a>Translation</h5></div></div></div><p>In order to support full localization, there are several functions to translate
strings in scripts, namely <code class="literal">i18n</code>, <code class="literal">i18nc</code>,
<code class="literal">i18np</code> and <code class="literal">i18ncp</code>. These functions behave
exactly like <a class="ulink" href="https://techbase.kde.org/Development/Tutorials/Localization/i18n" target="_top">
<span class="orgname">KDE</span>'s translation functions</a>.
</p><p>The translation functions translate the wrapped strings through <span class="orgname">KDE</span>'s
translation system to the language used in the application. Strings in scripts
being developed in the official <span class="application">KatePart</span> sources are automatically extracted and
translatable. In other words, as a <span class="application">KatePart</span> developer you do not have to bother with
message extraction and translation. It should be noted though, that the translation
only works inside the <span class="orgname">KDE</span> infrastructure, <abbr class="abbrev">i.e.</abbr>, new strings in 3rd-party
scripts developed outside of <span class="orgname">KDE</span> are not translated.
Therefore, please consider contributing your scripts to <span class="application">Kate</span> such that
proper translation is possible.
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><pre class="synopsis">
void i18n(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>text</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>arg1</code></em></span>, ...);
</pre></span></dt><dd><p>
Translates <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>text</code></em></span> into the language used by the application.
The arguments <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>arg1</code></em></span>, ..., are optional and used to
replace the placeholders <code class="literal">%1</code>, <code class="literal">%2</code>, <abbr class="abbrev">etc.</abbr></p></dd><dt><span class="term"><pre class="synopsis">
void i18nc(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>context</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>text</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>arg1</code></em></span>, ...);
</pre></span></dt><dd><p>
Translates <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>text</code></em></span> into the language used by the
application. Additionally, the string <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>context</code></em></span> is
visible to translators so they can provide a better translation.
The arguments <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>arg1</code></em></span>, ..., are optional and used to
replace the placeholders <code class="literal">%1</code>, <code class="literal">%2</code>, <abbr class="abbrev">etc.</abbr></p></dd><dt><span class="term"><pre class="synopsis">
void i18np(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>singular</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>plural</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>number</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>arg1</code></em></span>, ...);
</pre></span></dt><dd><p>
Translates either <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>singular</code></em></span> or
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>plural</code></em></span> into the language used by the application,
depending on the given <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>number</code></em></span>.
The arguments <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>arg1</code></em></span>, ..., are optional and used to
replace the placeholders <code class="literal">%1</code>, <code class="literal">%2</code>, <abbr class="abbrev">etc.</abbr></p></dd><dt><span class="term"><pre class="synopsis">
void i18ncp(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>context</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>singular</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>plural</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>number</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>arg1</code></em></span>, ...);
</pre></span></dt><dd><p>
Translates either <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>singular</code></em></span> or
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>plural</code></em></span> into the language used by the application,
depending on the given <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>number</code></em></span>. Additionally, the
string <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>context</code></em></span> is visible to translators so they
can provide a better translation. The arguments <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>arg1</code></em></span>,
..., are optional and used to replace the placeholders <code class="literal">%1</code>,
<code class="literal">%2</code>, <abbr class="abbrev">etc.</abbr></p></dd></dl></div></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="dev-scripting-api-view"></a>The View API</h4></div></div></div><p>Whenever a script is being executed, there is a global variable
<span class="quote">“<span class="quote"><code class="literal">view</code></span>”</span> representing the current active editor
view. The following is a list of all available View functions.

</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><pre class="synopsis">
<code class="function">void view.copy()</code>
</pre></span></dt><dd><p>Copy the selection if there is one, otherwise the current line if the option <strong class="userinput"><code>[ ] Copy/Cut the current line if no selection</code></strong> is set.</p><p>Since: <span class="productname"><span class="orgname">KDE</span> Frameworks</span> 5.79</p></dd><dt><span class="term"><pre class="synopsis">
<code class="function">void view.cut()</code>
</pre></span></dt><dd><p>Cut the selection if there is one, otherwise the current line if the option <strong class="userinput"><code>[ ] Copy/Cut the current line if no selection</code></strong> is set.</p><p>Since: <span class="productname"><span class="orgname">KDE</span> Frameworks</span> 5.79</p></dd><dt><span class="term"><pre class="synopsis">
<code class="function">void view.paste()</code>
</pre></span></dt><dd><p>Paste the clipboard content.</p><p>Since: <span class="productname"><span class="orgname">KDE</span> Frameworks</span> 5.79</p></dd><dt><span class="term"><pre class="synopsis">
<code class="function">Cursor view.cursorPosition()</code>
</pre></span></dt><dd><p>Returns the current cursor position in the view.</p></dd><dt><span class="term"><pre class="synopsis">
void view.setCursorPosition(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
void view.setCursorPosition(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Set the current cursor position to either (line, column) or to the given cursor.
</p></dd><dt><span class="term"><pre class="synopsis">
Cursor view.virtualCursorPosition();
</pre></span></dt><dd><p>
Returns the virtual cursor position with each tab counting the corresponding amount of spaces depending on the current tab width.
</p></dd><dt><span class="term"><pre class="synopsis">
void view.setVirtualCursorPosition(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
void view.setVirtualCursorPosition(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Set the current virtual cursor position to (line, column) or to the given cursor.
</p></dd><dt><span class="term"><pre class="synopsis">
String view.selectedText();
</pre></span></dt><dd><p>
Returns the selected text. If no text is selected, the returned string is empty.
</p></dd><dt><span class="term"><pre class="synopsis">
bool view.hasSelection();
</pre></span></dt><dd><p>
Returns <code class="literal">true</code>, if the view has selected text, otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
Range view.selection();
</pre></span></dt><dd><p>
Returns the selected text range. The returned range is invalid if there is no
selected text.
</p></dd><dt><span class="term"><pre class="synopsis">
void view.setSelection(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Range <span class="replaceable"><em class="replaceable"><code>range</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Set the selected text to the given range.
</p></dd><dt><span class="term"><pre class="synopsis">
void view.removeSelectedText();
</pre></span></dt><dd><p>
Remove the selected text. If the view does not have any selected text, this
does nothing.
</p></dd><dt><span class="term"><pre class="synopsis">
void view.selectAll();
</pre></span></dt><dd><p>
Selects the entire text in the document.
</p></dd><dt><span class="term"><pre class="synopsis">
void view.clearSelection();
</pre></span></dt><dd><p>
Clears the text selection without removing the text.
</p></dd><dt><span class="term"><pre class="synopsis">
void view.setBlockSelection(bool on);
</pre></span></dt><dd><p>
Set block selection mode on or off.
</p></dd><dt><span class="term"><pre class="synopsis">
bool view.blockSelection();
</pre></span></dt><dd><p>
Returns <code class="literal">true</code>, if block selection mode is on, otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
void view.align(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Range <span class="replaceable"><em class="replaceable"><code>range</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Properly re-indent lines within <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>range</code></em></span> according to current indentation settings.
</p></dd><dt><span class="term"><pre class="synopsis">
void view.alignOn(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Range <span class="replaceable"><em class="replaceable"><code>range</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>pattern</code></em></span> = ""</code></em></span>);
</pre></span></dt><dd><p>
Aligns lines in <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>range</code></em></span> on the column given by the regular expression <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>pattern</code></em></span>.
With an empty <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>pattern</code></em></span> it will align on the first non-blank character by default.
If the pattern has a capture it will indent on the captured match.
</p><p><span class="emphasis"><em>Examples:</em></span></p><p><code class="literal">view.alignOn(document.documentRange(), '-');</code> will insert spaces before the first <code class="literal">-</code> of each lines to align them all on the same column.</p><p><code class="literal">view.alignOn(document.documentRange(), ':\\s+(.)');</code> will insert spaces before the first non-blank character that occurs after a colon to align them all on the same column.</p></dd><dt><span class="term"><pre class="synopsis">
object view.executeCommand(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>command</code></em></span></code></em></span>,
                           <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>args</code></em></span></code></em></span>,
                           <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Range <span class="replaceable"><em class="replaceable"><code>range</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Executes the <a class="link" href="advanced-editing-tools-commandline.html" title="The Editor Component Command Line">command line command</a> <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>command</code></em></span>
with the optional arguments <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>args</code></em></span> and the optional <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>range</code></em></span>.
The returned <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>object</code></em></span> has a boolean property <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>object.ok</code></em></span>
that indicates whether execution of the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>command</code></em></span> was successful.
In case of an error, the string <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>object.status</code></em></span> contains an error message.
</p><p>Since: <span class="productname"><span class="orgname">KDE</span> Frameworks</span> 5.50</p></dd><dt><span class="term"><pre class="synopsis">
Range view.searchText(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Range <span class="replaceable"><em class="replaceable"><code>range</code></em></span></code></em></span>,
                      <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>pattern</code></em></span></code></em></span>,
                      <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>bool <span class="replaceable"><em class="replaceable"><code>backwards</code></em></span> = false</code></em></span>);
</pre></span></dt><dd><p>
Search for the first occurrence of <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>pattern</code></em></span> in <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>range</code></em></span> and returns the matched range.
Search is performed backwards if the optional boolean parameter <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>backwards</code></em></span> is set to <code class="literal">true</code>.
</p><p>
The returned range is invalid (see Range.isValid()) if <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>pattern</code></em></span> is not found in <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>range</code></em></span>.
</p><p>Since: <span class="productname"><span class="orgname">KDE</span> Frameworks</span> 5.97</p></dd></dl></div><p>
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="dev-scripting-api-document"></a>The Document API</h4></div></div></div><p>
Whenever a script is being executed, there is a global variable
<span class="quote">“<span class="quote"><code class="literal">document</code></span>”</span> representing the current active
document. The following is a list of all available Document functions.

</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><pre class="synopsis">
String document.fileName();
</pre></span></dt><dd><p>
Returns the document's filename or an empty string for unsaved text buffers.
</p></dd><dt><span class="term"><pre class="synopsis">
String document.url();
</pre></span></dt><dd><p>
Returns the document's full <acronym class="acronym">URL</acronym> or an empty string for unsaved text buffers.
</p></dd><dt><span class="term"><pre class="synopsis">
String document.mimeType();
</pre></span></dt><dd><p>
Returns the document's <acronym class="acronym">MIME</acronym> type or the <acronym class="acronym">MIME</acronym> type <code class="literal">application/octet-stream</code>
if no appropriate <acronym class="acronym">MIME</acronym> type could be found.
</p></dd><dt><span class="term"><pre class="synopsis">
String document.encoding();
</pre></span></dt><dd><p>
Returns the currently used encoding to save the file.
</p></dd><dt><span class="term"><pre class="synopsis">
String document.highlightingMode();
</pre></span></dt><dd><p>
Returns the global highlighting mode used for the whole document.
</p></dd><dt><span class="term"><pre class="synopsis">
String document.highlightingModeAt(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>pos</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Returns the highlighting mode used at the given position in the document.
</p></dd><dt><span class="term"><pre class="synopsis">
Array document.embeddedHighlightingModes();
</pre></span></dt><dd><p>
Returns an array of highlighting modes embedded in this document.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.isModified();
</pre></span></dt><dd><p>
Returns <code class="literal">true</code>, if the document has unsaved changes (modified), otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
String document.text();
</pre></span></dt><dd><p>
Returns the entire content of the document in a single text string. Newlines
are marked with the newline character <span class="quote">“<span class="quote"><code class="literal">\n</code></span>”</span>.
</p></dd><dt><span class="term"><pre class="synopsis">
String document.text(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>fromLine</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>fromColumn</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>toLine</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>toColumn</code></em></span></code></em></span>);
String document.text(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>from</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>to</code></em></span></code></em></span>);
String document.text(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Range <span class="replaceable"><em class="replaceable"><code>range</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the text in the given range. It is recommended to use the cursor
    and range based version for better readability of the source code.
</p></dd><dt><span class="term"><pre class="synopsis">
String document.line(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the given text line as string. The string is empty if the requested
    line is out of range.
</p></dd><dt><span class="term"><pre class="synopsis">
String document.wordAt(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
String document.wordAt(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the word at the given cursor position.
</p></dd><dt><span class="term">
<pre class="synopsis">
Range document.wordRangeAt(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
Range document.wordRangeAt(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre>
</span></dt><dd><p>
Return the range of the word at the given cursor position. The returned range
is invalid (see Range.isValid()), if the text position is after the end of a
line. If there is no word at the given cursor, an empty range is returned.
</p><p>
  Since: <span class="orgname">KDE</span> 4.9
</p></dd><dt><span class="term"><pre class="synopsis">
String document.charAt(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
String document.charAt(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the character at the given cursor position.
</p></dd><dt><span class="term"><pre class="synopsis">
String document.firstChar(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the first character in the given <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>line</code></em></span>
    that is not a whitespace. The first character is at column 0. If the line
    is empty or only contains whitespace characters, the returned string is
    empty.
</p></dd><dt><span class="term"><pre class="synopsis">
String document.lastChar(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the last character in the given <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>line</code></em></span>
    that is not a whitespace. If the line is empty or only contains whitespace
    characters, the returned string is empty.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.isSpace(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
bool document.isSpace(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns <code class="literal">true</code>, if the character at the given cursor position is a whitespace,
    otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.matchesAt(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>text</code></em></span></code></em></span>);
bool document.matchesAt(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>text</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns <code class="literal">true</code>, if the given <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>text</code></em></span> matches at the
    corresponding cursor position, otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.startsWith(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>text</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>bool <span class="replaceable"><em class="replaceable"><code>skipWhiteSpaces</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns <code class="literal">true</code>, if the line starts with <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>text</code></em></span>, otherwise <code class="literal">false</code>.
    The argument <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>skipWhiteSpaces</code></em></span> controls whether leading whitespaces are ignored.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.endsWith(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>text</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>bool <span class="replaceable"><em class="replaceable"><code>skipWhiteSpaces</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns <code class="literal">true</code>, if the line ends with <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>text</code></em></span>, otherwise <code class="literal">false</code>.
    The argument <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>skipWhiteSpaces</code></em></span> controls whether trailing whitespaces are ignored.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.setText(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>text</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Sets the entire document text.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.clear();
</pre></span></dt><dd><p>
    Removes the entire text in the document.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.truncate(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
bool document.truncate(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Truncate the given line at the given column or cursor position. Returns <code class="literal">true</code>
    on success, or <code class="literal">false</code> if the given line is not part of the document range.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.insertText(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>text</code></em></span></code></em></span>);
bool document.insertText(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>text</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Inserts the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>text</code></em></span> at the given cursor position.
    Returns <code class="literal">true</code> on success, or <code class="literal">false</code>, if the document is in read-only mode.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.removeText(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>fromLine</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>fromColumn</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>toLine</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>toColumn</code></em></span></code></em></span>);
bool document.removeText(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>from</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>to</code></em></span></code></em></span>);
bool document.removeText(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Range <span class="replaceable"><em class="replaceable"><code>range</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Removes the text in the given range. Returns <code class="literal">true</code> on success, or <code class="literal">false</code>, if
    the document is in read-only mode.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.insertLine(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>text</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Inserts text in the given line. Returns <code class="literal">true</code> on success, or <code class="literal">false</code>, if the
    document is in read-only mode or the line is not in the document range.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.removeLine(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Removes the given text line. Returns <code class="literal">true</code> on success, or <code class="literal">false</code>, if the
    document is in read-only mode or the line is not in the document range.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.wrapLine(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
bool document.wrapLine(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Wraps the line at the given cursor position. Returns <code class="literal">true</code> on success,
otherwise <code class="literal">false</code>, <abbr class="abbrev">e.g.</abbr> if line &lt; 0.
</p><p>
  Since: <span class="orgname">KDE</span> 4.9
</p></dd><dt><span class="term"><pre class="synopsis">
void document.joinLines(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>startLine</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>endLine</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Joins the lines from <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>startLine</code></em></span> to <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>endLine</code></em></span>.
    Two succeeding text lines are always separated with a single space.
</p></dd><dt><span class="term"><pre class="synopsis">
int document.lines();
</pre></span></dt><dd><p>
    Returns the number of lines in the document.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.isLineModified(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns <code class="literal">true</code>, if <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>line</code></em></span> currently contains unsaved data.
</p><p>
    Since: <span class="orgname">KDE</span> 5.0
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.isLineSaved(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns <code class="literal">true</code>, if <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>line</code></em></span> was changed, but the document was saved.
    Hence, the line currently does not contain any unsaved data.
</p><p>
    Since: <span class="orgname">KDE</span> 5.0
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.isLineTouched(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns <code class="literal">true</code>, if <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>line</code></em></span> currently contains unsaved data or was changed before.
</p><p>
    Since: <span class="orgname">KDE</span> 5.0
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.findTouchedLine(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>startLine</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>bool <span class="replaceable"><em class="replaceable"><code>down</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Search for the next touched line starting at <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>line</code></em></span>.
    The search is performed either upwards or downwards depending on the search direction specified in <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>down</code></em></span>.
</p><p>
    Since: <span class="orgname">KDE</span> 5.0
</p></dd><dt><span class="term"><pre class="synopsis">
int document.length();
</pre></span></dt><dd><p>
    Returns the number of characters in the document.
</p></dd><dt><span class="term"><pre class="synopsis">
int document.lineLength(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>line</code></em></span>'s length.
</p></dd><dt><span class="term"><pre class="synopsis">
void document.editBegin();
</pre></span></dt><dd><p>
    Starts an edit group for undo/redo grouping. Make sure to always call
    <code class="function">editEnd()</code> as often as you call
    <code class="function">editBegin()</code>. Calling <code class="function">editBegin()</code>
    internally uses a reference counter, <abbr class="abbrev">i.e.</abbr>, this call can be nested.
</p></dd><dt><span class="term"><pre class="synopsis">
void document.editEnd();
</pre></span></dt><dd><p>
    Ends an edit group. The last call of <code class="function">editEnd()</code> (<abbr class="abbrev">i.e.</abbr>
    the one for the first call of <code class="function">editBegin()</code>) finishes
    the edit step.
</p></dd><dt><span class="term"><pre class="synopsis">
int document.firstColumn(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the first non-whitespace column in the given <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>line</code></em></span>.
    If there are only whitespaces in the line, the return value is <code class="literal">-1</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
int document.lastColumn(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the last non-whitespace column in the given <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>line</code></em></span>.
    If there are only whitespaces in the line, the return value is <code class="literal">-1</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
int document.prevNonSpaceColumn(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
int document.prevNonSpaceColumn(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the column with a non-whitespace character starting at the given
    cursor position and searching backwards.
</p></dd><dt><span class="term"><pre class="synopsis">
int document.nextNonSpaceColumn(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
int document.nextNonSpaceColumn(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the column with a non-whitespace character starting at the given
    cursor position and searching forwards.
</p></dd><dt><span class="term"><pre class="synopsis">
int document.prevNonEmptyLine(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the next non-empty line containing non-whitespace characters
    searching backwards.
</p></dd><dt><span class="term"><pre class="synopsis">
int document.nextNonEmptyLine(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the next non-empty line containing non-whitespace characters
    searching forwards.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.isInWord(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>character</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>attribute</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns <code class="literal">true</code>, if the given <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>character</code></em></span> with the
    given <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>attribute</code></em></span> can be part of a word, otherwise
    <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.canBreakAt(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>character</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>attribute</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns <code class="literal">true</code>, if the given <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>character</code></em></span> with the given
    <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>attribute</code></em></span> is suited to wrap a line, otherwise
    <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.canComment(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>startAttribute</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>endAttribute</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns <code class="literal">true</code>, if a range starting and ending with the given attributes is
    suited to be commented out, otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
String document.commentMarker(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>attribute</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the comment marker for single line comments for a given <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>attribute</code></em></span>.
</p></dd><dt><span class="term"><pre class="synopsis">
String document.commentStart(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>attribute</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the comment marker for the start of multi-line comments for a given
    <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>attribute</code></em></span>.
</p></dd><dt><span class="term"><pre class="synopsis">
String document.commentEnd(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>attribute</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the comment marker for the end of multi-line comments for a given
    <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>attribute</code></em></span>.
</p></dd><dt><span class="term"><pre class="synopsis">
Range document.documentRange();
</pre></span></dt><dd><p>
    Returns a range that encompasses the whole document.
</p></dd><dt><span class="term"><pre class="synopsis">
Cursor documentEnd();
</pre></span></dt><dd><p>
    Returns a cursor positioned at the last column of the last line in the document.
</p></dd><dt><span class="term"><pre class="synopsis">
bool isValidTextPosition(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
bool isValidTextPosition(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns <code class="literal">true</code>, if the given cursor position is positioned at a valid text position.
    A text position is valid only if it locate at the start, in the middle, or the end of a valid line.
    Further, a text position is invalid if it is located in a Unicode surrogate.
</p><p>
    Since: <span class="orgname">KDE</span> 5.0
</p></dd><dt><span class="term"><pre class="synopsis">
int document.attribute(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
int document.attribute(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the attribute at the given cursor position.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.isAttribute(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>attribute</code></em></span></code></em></span>);
bool document.isAttribute(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>attribute</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns <code class="literal">true</code>, if the attribute at the given cursor position equals <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>attribute</code></em></span>,
    otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
String document.attributeName(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
String document.attributeName(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the attribute name as human readable text. This is equal to the
    <code class="literal">itemData</code> name in the syntax highlighting files.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.isAttributeName(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>name</code></em></span></code></em></span>);
bool document.isAttributeName(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>name</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns <code class="literal">true</code>, if the attribute name at a certain cursor position matches
    the given <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>name</code></em></span>, otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
String document.variable(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>key</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the value of the requested document variable <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>key</code></em></span>.
    If the document variable does not exist, the return value is an empty string.
</p></dd><dt><span class="term"><pre class="synopsis">
void document.setVariable(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>key</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>value</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Set the value of the requested document variable <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>key</code></em></span>.
</p><p>
    See also: <a class="link" href="config-variables.html" title="Configuring With Document Variables">Kate document variables</a>
</p><p>
    Since: <span class="orgname">KDE</span> 4.8
</p></dd><dt><span class="term"><pre class="synopsis">
int document.firstVirtualColumn(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the virtual column of the first non-whitespace character in the given
    line or <code class="literal">-1</code>, if the line is empty or contains only whitespace characters.
</p></dd><dt><span class="term"><pre class="synopsis">
int document.lastVirtualColumn(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the virtual column of the last non-whitespace character in the given
    line or <code class="literal">-1</code>, if the line is empty or contains only whitespace characters.
</p></dd><dt><span class="term"><pre class="synopsis">
int document.toVirtualColumn(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
int document.toVirtualColumn(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
Cursor document.toVirtualCursor(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Converts the given <span class="quote">“<span class="quote">real</span>”</span> cursor position to a virtual cursor position,
    either returning an int or a Cursor object.
</p></dd><dt><span class="term"><pre class="synopsis">
int document.fromVirtualColumn(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>virtualColumn</code></em></span></code></em></span>);
int document.fromVirtualColumn(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>virtualCursor</code></em></span></code></em></span>);
Cursor document.fromVirtualCursor(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>virtualCursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Converts the given virtual cursor position to a <span class="quote">“<span class="quote">real</span>”</span> cursor position,
    either returning an int or a Cursor object.
</p></dd><dt><span class="term"><pre class="synopsis">
Cursor document.anchor(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Char <span class="replaceable"><em class="replaceable"><code>character</code></em></span></code></em></span>);
Cursor document.anchor(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Char <span class="replaceable"><em class="replaceable"><code>character</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Searches backward for the given character starting from the given cursor.
    As an example, if '(' is passed as character, this function will return the
    position of the opening '('. This reference counting, <abbr class="abbrev">i.e.</abbr> other '(...)'
    are ignored.
</p></dd><dt><span class="term"><pre class="synopsis">
Cursor document.rfind(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>text</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>attribute</code></em></span> = -1</code></em></span>);
Cursor document.rfind(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>text</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>attribute</code></em></span> = -1</code></em></span>);
</pre></span></dt><dd><p>
    Find searching backwards the given text with the appropriate <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>attribute</code></em></span>.
    The argument <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>attribute</code></em></span> is ignored if it is set to
    <code class="literal">-1</code>. The returned cursor is invalid, if the text could not be found.
</p></dd><dt><span class="term"><pre class="synopsis">
int document.defStyleNum(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
int document.defStyleNum(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns the default style used at the given cursor position.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.isCode(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
bool document.isCode(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns <code class="literal">true</code>, if the attribute at the given cursor position is not equal
    to all of the following styles: <code class="literal">dsComment</code>,
    <code class="literal">dsString</code>, <code class="literal">dsRegionMarker</code>,
    <code class="literal">dsChar</code>, <code class="literal">dsOthers</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.isComment(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
bool document.isComment(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns <code class="literal">true</code>, if the attribute of the character at the cursor position
    is <code class="literal">dsComment</code>, otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.isString(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
bool document.isString(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns <code class="literal">true</code>, if the attribute of the character at the cursor position
    is <code class="literal">dsString</code>, otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.isRegionMarker(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
bool document.isRegionMarker(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns <code class="literal">true</code>, if the attribute of the character at the cursor position
    is <code class="literal">dsRegionMarker</code>, otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.isChar(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
bool document.isChar(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns <code class="literal">true</code>, if the attribute of the character at the cursor position
    is <code class="literal">dsChar</code>, otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
bool document.isOthers(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>line</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>column</code></em></span></code></em></span>);
bool document.isOthers(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Cursor <span class="replaceable"><em class="replaceable"><code>cursor</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
    Returns <code class="literal">true</code>, if the attribute of the character at the cursor position
    is <code class="literal">dsOthers</code>, otherwise <code class="literal">false</code>.
</p></dd><dt><span class="term"><pre class="synopsis">
void document.indent(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>Range <span class="replaceable"><em class="replaceable"><code>range</code></em></span></code></em></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>int <span class="replaceable"><em class="replaceable"><code>change</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Indents all lines in <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>range</code></em></span> by <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>change</code></em></span> tabs or <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>change</code></em></span> times <code class="literal">tabSize</code> spaces depending on the users preferences. The <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>change</code></em></span> parameter can be negative.
</p></dd></dl></div><p>
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="dev-scripting-api-editor"></a>The Editor API</h4></div></div></div><p>
In addition to the document and view API, there is a general editor API that
provides functions for general editor scripting functionality.

</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><pre class="synopsis">
String editor.clipboardText();
</pre></span></dt><dd><p>
Returns the text that currently is in the global clipboard.
</p><p>Since: <span class="productname"><span class="orgname">KDE</span> Frameworks</span> 5.50</p></dd><dt><span class="term"><pre class="synopsis">
String editor.clipboardHistory();
</pre></span></dt><dd><p>
The editor holds a clipboard history that contains up to 10 clipboard entries.
This function returns all entries that currently are in the clipboard history.
</p><p>Since: <span class="productname"><span class="orgname">KDE</span> Frameworks</span> 5.50</p></dd><dt><span class="term"><pre class="synopsis">
void editor.setClipboardText(<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="parameter"><em class="parameter"><code>String <span class="replaceable"><em class="replaceable"><code>text</code></em></span></code></em></span>);
</pre></span></dt><dd><p>
Set the contents of the clipboard to <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>text</code></em></span>.
The <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>text</code></em></span> will be added to the clipboard history.
</p><p>Since: <span class="productname"><span class="orgname">KDE</span> Frameworks</span> 5.50</p></dd></dl></div><p>
</p></div></div></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="color-themes.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="config-dialog.html">Next</a></td></tr><tr><td class="prevCell">Working with Color Themes </td><td class="upCell">Extending <span class="application">KatePart</span></td><td class="nextCell"> Configure <span class="application">KatePart</span></td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="advanced-editing-tools-code-folding.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="highlight.html">Next</a></td></tr><tr><td class="prevCell">Using Code Folding </td><td class="upCell"> </td><td class="nextCell"> Working with Syntax Highlighting</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="config-dialog.html"><html><head><title>Chapter 7. Configure KatePart</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="index.html" title="The KatePart Handbook"><link rel="prev" href="dev-scripting.html" title="Scripting with JavaScript"><link rel="next" href="config-variables.html" title="Configuring With Document Variables"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Configure <span class="application">KatePart</span></div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="dev-scripting.html">Prev</a></td><td class="upCell"> </td><td class="nextCell"><a accesskey="n" href="config-variables.html">Next</a></td></tr></table></div><div id="contentBody"><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="config-dialog"></a>Chapter 7. Configure <span class="application">KatePart</span></h1></div></div></div><p>
Selecting <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Settings</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Configure
<span class="replaceable"><em class="replaceable"><code>Application</code></em></span>...</span></span> from the menu brings up the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Configure</span></span> 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.
</p><p>
You may invoke the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Help</span></span> system, accept the
current settings and close the dialog by means of the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">OK</span></span> button, or <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Cancel</span></span> the
process. The categories <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Appearance</span></span>,
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Fonts &amp; Colors</span></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Editing</span></span>,
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Open/Save</span></span> and
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Extensions</span></span> are detailed below.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="config-dialog-editor"></a>The Editor Component Configuration</h2></div></div></div><p>This group contains all pages related to the editor component of
<span class="application">KatePart</span>. Most of the settings here are defaults, they can be overridden by
<a class="link" href="config-dialog.html#pref-open-save-modes-filetypes" title="Modes &amp; Filetypes">defining a filetype</a>,
by <a class="link" href="config-variables.html" title="Configuring With Document Variables">Document Variables</a> or
by changing them per document during an editing session.</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="appearance"></a>Appearance</h3></div></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="appearance-general"></a>General</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Editor font</span></span></span></dt><dd><p>
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.
</p><p>For more information about selecting a font, see the
<a class="ulink" href="help:/fundamentals/fonts.html" target="_top"><span class="emphasis"><em>Choosing Fonts</em></span>
section of the <span class="emphasis"><em><span class="orgname">KDE</span> Fundamentals</em></span> documentation</a>.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Show whitespace indicators</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Never</span></span></span></dt><dd><p>The editor will never display dots to indicate the presence of whitespace.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">At the end of a line</span></span></span></dt><dd><p>The editor will display dots to indicate the presence of extra
whitespace at the end of lines.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Always</span></span></span></dt><dd><p>The editor will always display dots to indicate the presence of whitespace.</p></dd></dl></div></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Whitespace indicator size</span></span></span></dt><dd><p>Use the slider to change the size of the visible indicator marker.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Show tab indicators</span></span></span></dt><dd><p>When checked the editor will display a » symbol to indicate the presence
  of a tab in the text.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Show focus frame around editor</span></span></span></dt><dd><p>When checked the editor shows focus frame around the main source text control.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Bracket matching
</span></span></span></dt><dd><p>
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Highlight range between selected brackets
</span></span></span></dt><dd><p>If this is enabled, the range between the selected matching brackets will be highlighted.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Show preview of matching open bracket
</span></span></span></dt><dd><p>When enabled, the editor will show a tooltip of the matching open bracket.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Flash matching bracket when cursor moves to other bracket in pair
</span></span></span></dt><dd><p>If enabled, moving on the brackets (<span class="keycap"><strong>{</strong></span>, <span class="keycap"><strong>[</strong></span>,  
<span class="keycap"><strong>]</strong></span>, <span class="keycap"><strong>}</strong></span>,<span class="keycap"><strong>(</strong></span> or <span class="keycap"><strong>)</strong></span>) will
quickly flash the matching bracket.</p></dd></dl></div><p>
</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Show indentation lines
</span></span></span></dt><dd><p>If this is checked, the editor will display
vertical lines to help identifying indent lines.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Counts
</span></span></span></dt><dd><p>
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Show word count
</span></span></span></dt><dd><p>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.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Show line count
</span></span></span></dt><dd><p>Displays the number of total lines in the document in the status bar.
This option is also available in the status bar context menu.</p></dd></dl></div><p>
</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Fold first line
</span></span></span></dt><dd><p>If enabled, the first line is folded, if possible. This is useful, 
if the file starts with a comment, such as a copyright</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Dynamic Word Wrap</span></span></span></dt><dd><p>If this option is checked, the text lines
will be wrapped at the view border on the screen.</p><p>
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Wrap dynamically at static word wrap marker
</span></span></span></dt><dd><p>When checked, editor wraps lines dynamically at the <a class="link" href="config-dialog.html#pref-word-wrap">static word wrap position</a>.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Disregard word boundaries for dynamic wrapping
</span></span></span></dt><dd><p>When checked, the editor does not take into account word boundaries when wrapping text lines.</p></dd></dl></div><p>
</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Dynamic word wrap indicators</span></span></span></dt><dd><p>Choose when the Dynamic word wrap indicators
should be displayed, either <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Off</span></span>, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Follow Line
Numbers</span></span> or <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Always on</span></span>.
</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Indent wrapped lines
</span></span></span></dt><dd><p>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.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Line Height Multiplier
</span></span></span></dt><dd><p>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.</p></dd></dl></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="appearance-borders"></a>Borders</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Code block folding</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Show arrows to collapse code blocks
</span></span></span></dt><dd><p>If this option is checked, the current view will display marks
for code folding, if code folding is available.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Show preview of folded blocks on hover
</span></span></span></dt><dd><p>If checked, hovering over a folded region shows a preview of the folded text
in a popup.</p></dd></dl></div></dd></dl></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Folding arrows visibility</span></span></span></dt><dd><p>Switch the folding arrows between <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Show on Hover</span></span>
and <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Show Always</span></span>.
</p></dd></dl></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Left side</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Show marks
</span></span></span></dt><dd><p>If this is checked, you will see an icon border on the left
hand side. The icon border shows bookmark signs for instance.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Show line numbers
</span></span></span></dt><dd><p>If this is checked, you will see line numbers on the left
hand side.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Highlight changed and unsaved lines
</span></span></span></dt><dd><p>If this is checked, line modification markers will be visible.
For more information, see <a class="xref" href="kate-part-line-modification.html" title="Line Modification Indicators">the section called “Line Modification Indicators”</a>.
</p></dd></dl></div></dd></dl></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Scrollbars</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Show marks
</span></span></span></dt><dd><p>If this option is checked the current view
will show marks on the vertical scrollbar. These marks will
for instance show bookmarks.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Show preview when hovering over scrollbar</span></span></span></dt><dd><p>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.</p></dd></dl></div></dd></dl></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Minimap</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Show minimap</span></span></span></dt><dd><p>If this option is checked, every new view will show a minimap of the 
document on the vertical scrollbar.</p><p>For more information on the scrollbar minimap, see
<a class="xref" href="kate-part-scrollbar-minimap.html" title="The Scrollbar Minimap">the section called “The Scrollbar Minimap”</a>.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Minimap Width</span></span></span></dt><dd><p>Adjusts the width of the scrollbar mini-map, defined in pixels.
</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Scrollbars visibility</span></span></span></dt><dd><p>Switch the scrollbar on, off or show the scrollbar only when needed.
Click with the <span class="mousebutton">left</span> mouse button on the blue rectangle to display the line number range of the document displayed on the screen.
Keep the <span class="mousebutton">left</span> mouse button pressed outside the blue rectangle to automatically scroll through the document.
</p></dd></dl></div></dd></dl></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Sort bookmarks menu</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">By date created
</span></span></span></dt><dd><p>Each new bookmark will be added to the bottom,
independently from where it is placed in the document.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">By line number
</span></span></span></dt><dd><p>The bookmarks will be ordered by the line
numbers they are placed at.</p></dd></dl></div></dd></dl></div></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="prefcolors"></a>Color Themes</h3></div></div></div><p>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 <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Follow System Color Scheme</span></span>.
Each scheme has settings for colors and normal and highlighted text
styles.
</p><p><span class="application">KatePart</span> will preselect the currently active theme for you, if you want to
work on a different theme start by selecting that from the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Select theme</span></span> combobox. With the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Copy</span></span> and <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Delete</span></span>
 buttons you can create a new theme (copying an existing one) or delete existing ones.</p><p>This is described in detail in <a class="xref" href="color-themes.html#color-themes-gui" title="The Color Themes GUI">the section called “The Color Themes <acronym class="acronym">GUI</acronym>”</a>.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="pref-edit"></a>Editing</h3></div></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="pref-edit-general"></a>General</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a name="pref-word-wrap"></a><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Word wrap</span></span></span></dt><dd><p>
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.  <span class="application">KatePart</span>
will automatically start a new line of text when  the current line reaches the
length specified by the <a class="link" href="config-dialog.html#pref-wrap-words-at">Wrap words
at:</a> option.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Wrap words at a fixed column</span></span></span></dt><dd><p>Turns static word wrap on or off.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Draw vertical line at the word wrap column</span></span></span></dt><dd><p>If this option is checked, a vertical line will be drawn at the word wrap
column as defined in the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Settings</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Configure Editor...</span></span> in the Editing tab.
Please note that the word wrap marker is only drawn if you use a fixed pitch
font.</p></dd><dt><span class="term"><a name="pref-wrap-words-at"></a><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Wrap words at:</span></span></span></dt><dd><p>If the <a class="link" href="config-dialog.html#pref-word-wrap">Wrap words at a fixed column</a> option is selected
this entry  determines the length (in characters) at which the editor will
automatically start a new line.</p></dd></dl></div></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Default input mode</span></span></span></dt><dd><p>
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
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> menu.
</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Brackets</span></span></span></dt><dd><p>If the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Automatically close brackets when opening bracket is typed</span></span> option is selected when
the user types a left bracket (<span class="keycap"><strong>[</strong></span>, <span class="keycap"><strong>(</strong></span>, or <span class="keycap"><strong>{</strong></span>)
<span class="application">KatePart</span> automatically enters the right bracket (<span class="keycap"><strong>}</strong></span>, <span class="keycap"><strong>)</strong></span>, 
or <span class="keycap"><strong>]</strong></span>) to the right of the cursor.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Enclosing characters</span></span></span></dt><dd><p>It is possible to select the enclosing characters using the corresponding drop-down list.</p><p>When text is selected, typing one of these characters wraps the selected text.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Copy and paste</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Move selected text when dragged</span></span></span></dt><dd><p>This option enables drag-and-drop of the selected text inside the editor window.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Copy/cut the current line if invoked without any text selected</span></span></span></dt><dd><p>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.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Don't move the text cursor when pasting by mouse</span></span></span></dt><dd><p>If this option is enabled and you paste some text in the editor window with the <span class="mousebutton">middle</span> mouse button clicking, <span class="application">KatePart</span>
will not move the text cursor into the clicked position.</p></dd></dl></div></dd></dl></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="pref-edit-cursor-selection"></a>Text Navigation</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Text Cursor Movement</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Smart home and smart end</span></span></span></dt><dd><p>When selected, pressing the home key will cause the cursor to
skip white space and go to the start of a line's text.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">PageUp/PageDown moves cursor</span></span></span></dt><dd><p>This option changes the behavior of the cursor when the user presses
the <span class="keysym">PgUp</span> or <span class="keysym">PgDn</span> key. If unselected the text cursor will maintain its
relative position within the visible text in <span class="application">KatePart</span> 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.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Enable camel case cursor movement</span></span></span></dt><dd><p>This option changes the behavior of the cursor when the user presses
the <span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Left arrow</strong></span> or
<span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Right arrow</strong></span> shortcut. If unselected
the text cursor jumps over the full words. With this option
selected, the cursor jumps break at camel case humps.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Autocenter cursor:</span></span></span></dt><dd><p>Sets the number of lines to maintain visible above and below the cursor
when possible.</p></dd></dl></div></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Text Selection Mode</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Normal</span></span></span></dt><dd><p>Selections will be overwritten by typed text and will be lost on
cursor movement.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Persistent</span></span></span></dt><dd><p>Selections will stay even after cursor movement and typing.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Allow scrolling past the end of the document</span></span></span></dt><dd><p>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.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Backspace key removes character’s base with its diacritics</span></span></span></dt><dd><p>When selected, composed characters are removed with their diacritics instead
of only removing the base character. This is useful for Indic locales.</p></dd></dl></div></dd><dt><a name="multicursor-modifier-configure"></a><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Multicursor modifier</span></span></span></dt><dd><p>This option lets you set the modifier that will be used to create multiple cursors with <span class="mousebutton">left</span> mouse button click. You need to press the modifiers and click <span class="mousebutton">left</span> mouse button to create a cursor at the desired location. See <a class="link" href="kate-part-multiple-cursors.html#kate-part-create-multiple-cursors" title="Creating multiple cursors">Creating multiple cursors</a> to discover other ways to create multiple cursors.</p></dd></dl></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="pref-edit-indent"></a>Indentation</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Default indentation mode:</span></span></span></dt><dd><p>Select the automatic indentation mode you want to use as default. It is
strongly recommended to use <strong class="userinput"><code>None</code></strong> or
<strong class="userinput"><code>Normal</code></strong> here, and use filetype configurations to set other
indentation modes for text formats like C/C++ code or <acronym class="acronym">XML</acronym>.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Indent using</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Tabulators</span></span></span></dt><dd><p>When this is enabled the editor will insert tabulator characters when you
press the <span class="keycap"><strong>Tab</strong></span> key or use <a class="link" href="kate-part-autoindent.html" title="Using automatic indenting">automatic
indentation</a>.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Spaces</span></span></span></dt><dd><p>When this is enabled the editor will insert a calculated number of spaces
according to the position in the text and the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="option"><code class="option">tab-width</code></span> setting
when you press the <span class="keycap"><strong>Tab</strong></span> key or use <a class="link" href="kate-part-autoindent.html" title="Using automatic indenting">automatic
indentation</a>.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Tabulators and Spaces</span></span></span></dt><dd><p>When this is enabled, the editor will insert spaces as describe above when
indenting or pressing <span class="keycap"><strong>Tab</strong></span> at the beginning of a line, but insert tabulators when
the <span class="keycap"><strong>Tab</strong></span> key is pressed in the middle or end of a line.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Tab width:</span></span></span></dt><dd><p>This configures the number of spaces that are displayed in place of a tabulator
character.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Indentation width:</span></span></span></dt><dd><p>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.</p></dd></dl></div></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Indentation Properties</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Keep extra spaces</span></span></span></dt><dd><p>If this option is disabled, changing the indentation
level aligns a line to a multiple of the width specified in
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Indentation width</span></span>.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Adjust indentation of text pasted from the clipboard</span></span></span></dt><dd><p>If this option is selected, text pasted from the clipboard is indented.
Triggering the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Undo</span></span> action removes the indentation.</p></dd></dl></div></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Indentation Actions</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Backspace key in leading blank space unindents</span></span></span></dt><dd><p>If this option is selected, the <span class="keysym">Backspace</span> key decreases the indentation level
if the cursor is located in the leading blank space of a line.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Tab key action (if no selection exists)</span></span></span></dt><dd><p>
If you want <span class="keycap"><strong>Tab</strong></span> to align the current line in the current code block
like in <span class="application">Emacs</span>, make <span class="keycap"><strong>Tab</strong></span> a shortcut to the action <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Format Indentation</span></span>.
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Always advance to the next tab position</span></span></span></dt><dd><p>If this option is selected, the <span class="keycap"><strong>Tab</strong></span> key always inserts white space
so that the next tab position is reached. If the option <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Insert spaces instead of tabulators</span></span>
on the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">General</span></span> tab in the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Editing</span></span>
page is enabled, spaces are inserted; otherwise, a single tabulator is inserted.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Always increase indentation level</span></span></span></dt><dd><p>If this option is selected, the <span class="keycap"><strong>Tab</strong></span> key always indents the current
line by the number of character positions specified in <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Indentation width</span></span>.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Increase indentation level if in leading blank space</span></span></span></dt><dd><p>If this option is selected, the <span class="keycap"><strong>Tab</strong></span> 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 <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Indentation width</span></span>.
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 <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Insert spaces instead of tabulators</span></span>
on the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">General</span></span> tab in the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Editing</span></span>
page is enabled, spaces are inserted; otherwise, a single tabulator is inserted.</p></dd></dl></div></dd></dl></div></dd></dl></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="pref-edit-autocompletion"></a>Auto Completion</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">General</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Enable auto completion</span></span></span></dt><dd><p>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.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Auto select first completion entry</span></span></span></dt><dd><p>If enabled, the first auto completion item is always preselected so you can insert it with
<span class="keysym">Enter</span>. If you do not want such behavior, <abbr class="abbrev">e.g.</abbr> if you want pressing <span class="keysym">Enter</span> to only insert a newline,
then disable this item.</p></dd></dl></div></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Minimal word length to complete</span></span></span></dt><dd><p>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.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Remove tail on complete</span></span></span></dt><dd><p>Remove the tail of a previous word when the completion item is chosen from a list.
</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Keyword completion
</span></span></span></dt><dd><p>If enabled, the built-in autocompletion uses the keywords defined by the syntax highlighting.
</p></dd></dl></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="pref-edit-spellcheck"></a>Spellcheck</h4></div></div></div><p>These configuration options are described in the documentation for the
<span class="application">System Settings</span> module <a class="ulink" href="help:/kcontrol/spellchecking" target="_top">Spell Checker</a>.</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="pref-edit-vi-input-mode"></a>Vi Input Mode</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">General</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Let Vi commands override Kate shortcuts</span></span></span></dt><dd><p>When selected, Vi commands will override <span class="application">KatePart</span>'s built-in commands. For
example: <span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>R</strong></span> will redo,
and override the standard action (showing the search and replace dialog).</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Display relative line numbers
</span></span></span></dt><dd><p>if this is enabled, the current line always refers to line 0. 
Lines above and below increase the line number relatively.</p></dd></dl></div></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Key Mapping</span></span></span></dt><dd><p>
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.</p><p>Example:</p><p><span class="keycap"><strong>F2</strong></span> -&gt; <strong class="userinput"><code>I--</code></strong> <span class="keycap"><strong>Esc</strong></span></p><p>This will prepend <strong class="userinput"><code>I--</code></strong> to a line when pressing <span class="keycap"><strong>F2</strong></span>.
</p></dd></dl></div></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="pref-open-save"></a>Open/Save</h3></div></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="pref-open-save-general"></a>General</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">File Format</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Encoding</span></span></span></dt><dd><p>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.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Encoding Detection</span></span></span></dt><dd><p>Select an item from the drop down box, either to disable autodetection or
use <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Universal</span></span> 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.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Fallback Encoding</span></span></span></dt><dd><p>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.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">End of line</span></span></span></dt><dd><p>Choose your preferred end of line mode for your active
document. You have the choice between <span class="trademark">UNIX</span>®, DOS/<span class="trademark">Windows</span>® or Macintosh.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Automatic end of line detection</span></span></span></dt><dd><p>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.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Enable byte order mark (BOM)</span></span></span></dt><dd><p>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 <a class="ulink" href="https://en.wikipedia.org/wiki/Byte_order_mark" target="_top">Byte Order Mark</a>.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Line Length Limit</span></span></span></dt><dd><p>Unfortunately, due to deficiencies in <span class="trademark">Qt</span>™, <span class="application">KatePart</span> experiences poor
performance when working with extremely long lines. For that reason, <span class="application">KatePart</span>
will automatically wrap lines when they are longer than the number of characters
specified here. To disable this, set this to <strong class="userinput"><code>0</code></strong>.</p></dd></dl></div></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Automatic Cleanups on Save</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Remove trailing spaces</span></span></span></dt><dd><p>The editor will automatically eliminate extra spaces at the ends of lines
of text while saving the file.  You can select <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Never</span></span> to
disable this functionality, <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">On Modified Lines</span></span> to do so
only on lines that you have modified since you last saved the document, or
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">In Entire Document</span></span> to remove them unconditionally from the
entire document.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Append newline at end of file on save</span></span></span></dt><dd><p>The editor will automatically append a newline to the end of the file if
one is not already present upon saving the file.</p></dd></dl></div></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Enable Auto Save (local files only)</span></span></span></dt><dd><p>
Check this if you want the editor to autosave documents while you are working on them.
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Auto save document when focus leaves the editor</span></span></span></dt><dd><p>The editor will automatically save documents when you switch to something outside the editor, <abbr class="abbrev">e.g.</abbr>, the terminal panel in <span class="application">Kate</span>.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Auto save interval</span></span></span></dt><dd><p>You can determine the autosave interval in seconds here. If the interval is 0, the document will not be autosaved after intervals.</p></dd></dl></div></dd></dl></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="pref-open-save-advanced"></a>Advanced</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Write a backup file on save for</span></span></span></dt><dd><p>Backing up on save will cause <span class="application">KatePart</span> to copy the disk file
(the previously saved version of the file) to &lt;prefix&gt;&lt;filename&gt;&lt;suffix&gt;
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 <span class="bold"><strong>~</strong></span>
and prefix is empty by default. </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Local files</span></span></span></dt><dd><p>Check this if you want backups of local files when
saving.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Remote files</span></span></span></dt><dd><p>Check this if you want backups of remote files when saving.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Prefix for backup files</span></span></span></dt><dd><p>Enter the prefix to prepend to the backup file names.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Suffix for backup files</span></span></span></dt><dd><p>Enter the suffix to add to the backup file names.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Swap file mode</span></span></span></dt><dd><p><span class="application">KatePart</span> is able to recover (most) unsaved work in the case of a
crash or power failure. A swap file (.&lt;filename&gt;.kate-swp) is created
when a document is edited. If the user doesn’t save the
changes and <span class="application">KatePart</span> crashes, the swap file remains on the disk. When opening a
file, <span class="application">KatePart</span> 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.</p><p><span class="application">KatePart</span> 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 <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Disable</span></span>,
but this can lead to more data loss.</p><p>When the swap file is enabled, it is possible to switch between two modes, namely <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Enabled, Store in Default Directory</span></span> and <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Enabled, Store in Custom Directory</span></span>.
</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Store swap files in</span></span></span></dt><dd><p>By default, the swap files are saved in the same folder as the file. 
When <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Enabled, Store in Custom Directory</span></span> 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.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Save swap files every</span></span></span></dt><dd><p><span class="application">KatePart</span> 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.</p></dd></dl></div></dd></dl></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="pref-open-save-modes-filetypes"></a>Modes &amp; Filetypes</h4></div></div></div><p>This page allows you to override the default configuration for documents
of specified <acronym class="acronym">MIME</acronym> types. When the editor loads a document, it will try if it
matches the file masks or <acronym class="acronym">MIME</acronym> 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.
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Filetype:</span></span></span></dt><dd><p>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.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">New</span></span></span></dt><dd><p>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.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Delete</span></span></span></dt><dd><p>To remove an existing filetype, select it from the drop down
box and press the Delete button.</p></dd></dl></div></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Properties of <span class="replaceable"><em class="replaceable"><code>current filetype</code></em></span></span></span></span></dt><dd><p>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.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Name:</span></span></span></dt><dd><p>The name of the filetype will be the text of the corresponding
menu item. This name is displayed in the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Filetypes</span></span> menu.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Section:</span></span></span></dt><dd><p>The section name is used to organize the file types in
menus. This is also used in the
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Tools</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Filetypes</span></span> menu.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Variables:</span></span></span></dt><dd><p>This string allows you to configure <span class="application">KatePart</span>'s settings for the
files selected by this <acronym class="acronym">MIME</acronym> type using <span class="application">KatePart</span> variables. You can set almost any
configuration option, such as highlight, indent-mode, <abbr class="abbrev">etc.</abbr></p><p>Press <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guibutton">Edit</span></span> 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.</p><p>For complete information on these variables, see
<a class="link" href="config-variables.html" title="Configuring With Document Variables">Configuring with Document
Variables</a>.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Highlighting:</span></span></span></dt><dd><p>If you create a new file type, this drop down box allows you to
select a filetype for highlighting.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Indentation Mode:</span></span></span></dt><dd><p>The drop down box specifies the indentation mode for new
documents.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">File extensions:</span></span></span></dt><dd><p>The wildcards mask allows you to select files by filename. A
typical mask uses an asterisk and the file extension, for example
<code class="filename">*.txt; *.text</code>. The string is a semicolon-separated list of
masks.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">MIME types:</span></span></span></dt><dd><p>Displays a wizard that helps you easily select
<acronym class="acronym">MIME</acronym> types.</p></dd><dt><span class="term"><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Priority:</span></span></span></dt><dd><p>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.</p></dd></dl></div></dd></dl></div></div></div></div><FILENAME filename="config-variables.html"><html><head><title>Configuring With Document Variables</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="config-dialog.html" title="Chapter 7. Configure KatePart"><link rel="prev" href="config-dialog.html" title="Chapter 7. Configure KatePart"><link rel="next" href="credits.html" title="Chapter 8. Credits and License"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Configuring With Document Variables</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="config-dialog.html">Prev</a></td><td class="upCell">Configure <span class="application">KatePart</span></td><td class="nextCell"><a accesskey="n" href="credits.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="config-variables"></a>Configuring With Document Variables</h2></div></div></div><p><span class="application">KatePart</span> variables is <span class="application">KatePart</span>'s implementation of document variables, similar
to <span class="application">Emacs</span> and vi modelines. In katepart, the lines have the following format:

<strong class="userinput"><code>kate: VARIABLENAME VALUE; [ VARIABLENAME VALUE; ... ]</code></strong>

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.</p><p>Here is an example variable line, forcing indentation settings for a C++,
<span class="trademark">Java</span>™ or <span class="application">JavaScript</span> file:

</p><pre class="programlisting">// kate: replace-tabs on; indent-width 4; indent-mode cstyle;</pre><p>
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Only the first and last 10 lines are searched for variable lines.</p></div><p>Additionally, document variables can be placed in a file called
<code class="filename">.kateconfig</code> 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 <code class="filename">.kateconfig</code> use the same syntax as
in modelines, but with <a class="link" href="config-variables.html#kateconfig-extended-options" title="Extended Options in .kateconfig files">extended options</a>.</p><p>There are variables to support almost all configurations in <span class="application">KatePart</span>, and
additionally plugins can use variables, in which case it should be documented in
the plugin's documentation.</p><p><span class="application">KatePart</span> has support for reading configurations from <code class="filename">.editorconfig</code>
files, when the <a class="ulink" href="https://editorconfig.org/" target="_top">editorconfig</a> library is installed.
<span class="application">KatePart</span> automatically searches for a <code class="filename">.editorconfig</code>
whenever you open a file. It gives priority to <code class="filename">.kateconfig</code> files, though.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="config-variables-howto"></a>How <span class="application">KatePart</span> uses Variables</h3></div></div></div><p>When reading configuration, katepart looks in the following places
(in that order):

</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>The global configuration.</p></li><li class="listitem"><p>Optional session data.</p></li><li class="listitem"><p>The "Filetype" configuration.</p></li><li class="listitem"><p>Document variables in <code class="filename">.kateconfig</code>.</p></li><li class="listitem"><p>Document variables in the document itself.</p></li><li class="listitem"><p>Settings made during editing from menu or command line.</p></li></ul></div><p>

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.</p><p>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.</p><p>The variables listed here documents <span class="application">KatePart</span> 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:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>BOOL - on|off|true|false|1|0</p></li><li class="listitem"><p>INTEGER - any integer number</p></li><li class="listitem"><p>STRING - anything else</p></li></ul></div><p>
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="config-variables-list"></a>Available Variables</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a name="variable-auto-brackets"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>auto-brackets</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Enable automatic insertion of brackets.</p></dd><dt><a name="variable-auto-center-lines"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>auto-center-lines</strong></span></span> [INT]</p></div></span></dt><dd><p>Set the number of autocenter lines.</p></dd><dt><a name="variable-background-color"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>background-color</strong></span></span> [STRING]</p></div></span></dt><dd><p>Set the document background color. The value must be something
that can be evaluated to a valid color, for example <strong class="userinput"><code>#ff0000</code></strong>.
</p></dd><dt><a name="variable-backspace-indents"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>backspace-indents</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Enable or disable unindenting when <span class="keysym">Backspace</span> is pressed.</p></dd><dt><a name="variable-block-selection"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>block-selection</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Turn <a class="link" href="kate-part-selection.html#kate-part-selection-block" title="Using Block Selection">block selection</a>
on or off.</p></dd><dt><a name="variable-byte-order-mark"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>bom | byte-order-mark | byte-order-marker</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Enable/disable the byte order mark (BOM) when saving files in Unicode format
(utf8, utf16, utf32).</p><p>Since: <span class="application">Kate</span> 3.4 (<span class="orgname">KDE</span> 4.4)</p></dd><dt><a name="variable-bracket-highlight-color"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>bracket-highlight-color</strong></span></span> [STRING]</p></div></span></dt><dd><p>Set the color for the bracket highlight. The value must be
something that can be evaluated to a valid color, for example <strong class="userinput"><code>#ff0000</code></strong>.
</p></dd><dt><a name="variable-current-line-color"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>current-line-color</strong></span></span> [STRING]</p></div></span></dt><dd><p>Set the color for the current line. The  value must be
something that can be evaluated to a valid color, for example <strong class="userinput"><code>#ff0000</code></strong>.
</p></dd><dt><a name="variable-default-dictionary"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>default-dictionary</strong></span></span> [STRING]</p></div></span></dt><dd><p>Sets the default dictionary used for spellchecking.</p><p>Since: <span class="application">Kate</span> 3.4 (<span class="orgname">KDE</span> 4.4)</p></dd><dt><a name="variable-dynamic-word-wrap"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>dynamic-word-wrap</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Turns <a class="link" href="kate-part-auto-wrap.html" title="Automatically Wrapping text">dynamic word wrap</a> on or
off.</p></dd><dt><a name="variable-end-of-line"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>eol | end-of-line</strong></span></span> [STRING]</p></div></span></dt><dd><p>Set the end of line mode. Valid settings are
<strong class="userinput"><code>unix</code></strong>, <strong class="userinput"><code>mac</code></strong> and <strong class="userinput"><code>dos</code></strong>.</p></dd><dt><a name="variable-folding-markers"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>folding-markers</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Set the display of
<a class="link" href="advanced-editing-tools-code-folding.html" title="Using Code Folding">folding markers</a>
on or off.
</p></dd><dt><a name="variable-folding-preview"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>folding-preview</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Enable folding preview in the editor border.</p></dd><dt><a name="variable-font-size"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>font-size</strong></span></span> [INT]</p></div></span></dt><dd><p>Set the point size of the document font.</p></dd><dt><a name="variable-font"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>font</strong></span></span> [STRING]</p></div></span></dt><dd><p>Set the font of the document. The value should be a valid font
name, for example <strong class="userinput"><code>courier</code></strong>.</p></dd><dt><a name="variable-syntax"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>hl | syntax</strong></span></span> [STRING]</p></div></span></dt><dd><p>Set the syntax highlighting. Valid strings are all the names available
in the menus.  For instance, for C++ simply write <strong class="userinput"><code>C++</code></strong>.</p></dd><dt><a name="variable-icon-bar-color"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>icon-bar-color</strong></span></span> [STRING]</p></div></span></dt><dd><p>Set the icon bar color. The  value must be something that can
be evaluated to a valid color, for example <strong class="userinput"><code>#ff0000</code></strong>.</p></dd><dt><a name="variable-icon-border"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>icon-border</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Set the display of the icon border on or off.</p></dd><dt><a name="variable-indent-mode"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>indent-mode</strong></span></span> [STRING]</p></div></span></dt><dd><p>Set the auto-indentation mode. The options <strong class="userinput"><code>none</code></strong>,
<strong class="userinput"><code>normal</code></strong>, <strong class="userinput"><code>cstyle</code></strong>, <strong class="userinput"><code>haskell</code></strong>,
<strong class="userinput"><code>lilypond</code></strong>, <strong class="userinput"><code>lisp</code></strong>, <strong class="userinput"><code>python</code></strong>,
<strong class="userinput"><code>ruby</code></strong> and <strong class="userinput"><code>xml</code></strong> are recognized. See the section
<a class="xref" href="kate-part-autoindent.html" title="Using automatic indenting">the section called “Using automatic indenting”</a> for details.</p></dd><dt><a name="variable-indent-pasted-text"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>indent-pasted-text</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Enable/disable adjusting indentation of text pasted from the clipboard.</p><p>Since: <span class="application">Kate</span> 3.11 (<span class="orgname">KDE</span> 4.11)</p></dd><dt><a name="variable-indent-width"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>indent-width</strong></span></span> [INT]</p></div></span></dt><dd><p>Set the indentation width.</p></dd><dt><a name="variable-keep-extra-spaces"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>keep-extra-spaces</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Set whether to keep extra spaces when calculating indentation width.</p></dd><dt><a name="variable-line-numbers"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>line-numbers</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Set the display of line numbers on or off.</p></dd><dt><a name="variable-newline-at-eof"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>newline-at-eof</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Add an empty line at the end of the file (EOF) when saving the document.</p><p>Since: <span class="application">Kate</span> 3.9 (<span class="orgname">KDE</span> 4.9)</p></dd><dt><a name="variable-overwrite-mode"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>overwrite-mode</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Set overwrite mode on or off.</p></dd><dt><a name="variable-persistent-selection"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>persistent-selection</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Set <a class="link" href="kate-part-selection.html#kate-part-selection-persistent" title="Using Persistent Selection">persistent selection</a>
on or off.</p></dd><dt><a name="variable-replace-tabs-save"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>replace-tabs-save</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Set tab to space conversion on save on or off.</p></dd><dt><a name="variable-replace-tabs"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>replace-tabs</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Set dynamic tab to space conversion on or off.</p></dd><dt><a name="variable-remove-trailing-spaces"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>remove-trailing-spaces</strong></span></span> [STRING]</p></div></span></dt><dd><p>Removes trailing spaces when saving the document. Valid options are:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><strong class="userinput"><code>none</code></strong>, <strong class="userinput"><code>-</code></strong> or <strong class="userinput"><code>0</code></strong>: never remove trailing spaces.</p></li><li class="listitem"><p><strong class="userinput"><code>modified</code></strong>, <strong class="userinput"><code>mod</code></strong>, <strong class="userinput"><code>+</code></strong> or <strong class="userinput"><code>1</code></strong>: remove trailing spaces only in
modified lines. The modified lines are marked by the line modification system.</p></li><li class="listitem"><p><strong class="userinput"><code>all</code></strong>, <strong class="userinput"><code>*</code></strong> or <strong class="userinput"><code>2</code></strong>: remove trailing spaces in the entire document.</p></li></ul></div></dd><dt><a name="variable-scrollbar-minimap"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>scrollbar-minimap</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Show scrollbar minimap.</p></dd><dt><a name="variable-scrollbar-preview"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>scrollbar-preview</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Show scrollbar preview.</p></dd><dt><a name="variable-scheme"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>scheme</strong></span></span> [STRING]</p></div></span></dt><dd><p>Set the color scheme. The string must be the name of a color
scheme that exists in your configuration to have any effect.</p></dd><dt><a name="variable-selection-color"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>selection-color</strong></span></span> [STRING]</p></div></span></dt><dd><p>Set the selection color. The  value must be something that can
be evaluated to a valid color, for example <strong class="userinput"><code>#ff0000</code></strong>.</p></dd><dt><a name="variable-show-tabs"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>show-tabs</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Set the visual tab character on or off.</p></dd><dt><a name="variable-smart-home"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>smart-home</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Set <a class="link" href="config-dialog.html#pref-edit-cursor-selection" title="Text Navigation">smart home navigation</a>
on or off.</p></dd><dt><a name="variable-tab-indents"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>tab-indents</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Set <span class="keycap"><strong>Tab</strong></span> key indentation on or off.</p></dd><dt><a name="variable-tab-width"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>tab-width</strong></span></span> [INT]</p></div></span></dt><dd><p>Set the tab character display width.</p></dd><dt><a name="variable-undo-steps"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>undo-steps</strong></span></span> [INT]</p></div></span></dt><dd><p>Set the number of undo steps to remember.</p><p>Note: Deprecated since <span class="application">Kate</span> 3 in <span class="orgname">KDE</span>4. This variable is ignored. The maximal count of undo steps is unlimited.</p></dd><dt><a name="variable-word-wrap-column"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>word-wrap-column</strong></span></span> [INT]</p></div></span></dt><dd><p>Set the <a class="link" href="kate-part-auto-wrap.html" title="Automatically Wrapping text">static word wrap</a>
width. </p></dd><dt><a name="variable-word-wrap-marker-color"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>word-wrap-marker-color</strong></span></span> [STRING]</p></div></span></dt><dd><p>Set the word wrap marker color. The value must be something
that can be evaluated to a valid color, for example <strong class="userinput"><code>#ff0000</code></strong>.</p></dd><dt><a name="variable-word-wrap"></a><span class="term"><div class="cmdsynopsis"><p><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>word-wrap</strong></span></span> [BOOL]</p></div></span></dt><dd><p>Set static word wrapping on or off.</p></dd></dl></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="kateconfig-extended-options"></a>Extended Options in <code class="filename">.kateconfig</code> files</h3></div></div></div><p><span class="application">KatePart</span> always search for a <code class="filename">.kateconfig</code> file for local files (not remote files).
In addition, it is possible to set options based on wildcards (file extensions) as follows:</p><pre class="programlisting">kate: tab-width 4; indent-width 4; replace-tabs on;
kate-wildcard(*.xml): indent-width 2;
kate-wildcard(Makefile): replace-tabs off;
</pre><p>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 <code class="filename">*.xml</code>
files, the indent width is set to 2 spaces.
And Makefiles use tabs, <abbr class="abbrev">i.e.</abbr> tabs are not replaced with spaces.</p><p>Wildcards are semicolon separated, <abbr class="abbrev">i.e.</abbr> you can also specify multiple file extensions as follows:
</p><pre class="programlisting">kate-wildcard(*.json;*.xml): indent-width 2;</pre><p>Further, you can also use the <acronym class="acronym">MIME</acronym> type to match certain files, <abbr class="abbrev">e.g.</abbr> to indent
all C++ source files with 4 spaces, you can write:
</p><pre class="programlisting">kate-mimetype(text/x-c++src): indent-width 4;</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Next to the support in <code class="filename">.kateconfig</code> files, wildcard and <acronym class="acronym">MIME</acronym> type
dependent document variables are also supported in the files itself as comments.
</p></div></div></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="config-dialog.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="credits.html">Next</a></td></tr><tr><td class="prevCell">Configure <span class="application">KatePart</span> </td><td class="upCell">Configure <span class="application">KatePart</span></td><td class="nextCell"> Credits and License</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="dev-scripting.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="config-variables.html">Next</a></td></tr><tr><td class="prevCell">Scripting with <span class="application">JavaScript</span> </td><td class="upCell"> </td><td class="nextCell"> Configuring With Document Variables</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="credits.html"><html><head><title>Chapter 8. Credits and License</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="index.html" title="The KatePart Handbook"><link rel="prev" href="config-variables.html" title="Configuring With Document Variables"><link rel="next" href="vi-input-mode-chapter.html" title="Chapter 9. The VI Input Mode"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Credits and License</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="config-variables.html">Prev</a></td><td class="upCell"> </td><td class="nextCell"><a accesskey="n" href="vi-input-mode-chapter.html">Next</a></td></tr></table></div><div id="contentBody"><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="credits"></a>Chapter 8. Credits and License</h1></div></div></div><p><span class="application">KatePart</span> and <span class="application">KWrite</span> Copyright 2001-2022 by the <span class="application">Kate</span> team.</p><p>
Based on the original <span class="application">KWrite</span>, which was Copyright 2000 by Jochen Wilhelmy
<code class="email">(digisnap AT cs.tu-berlin.de)</code>
</p><p>Contributions:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="firstname">Christoph</span> <span class="surname">Cullmann</span> <code class="email">(cullmann AT kde.org)</code></p></li><li class="listitem"><p>Michael Bartl <code class="email">(michael.bartl1 AT chello.at)</code></p></li><li class="listitem"><p>Phlip <code class="email">(phlip_cpp AT my-deja.com)</code></p></li><li class="listitem"><p><span class="firstname">Anders</span> <span class="surname">Lund</span> <code class="email">(anders AT alweb.dk)</code></p></li><li class="listitem"><p>Matt Newell <code class="email">(newellm AT proaxis.com)</code></p></li><li class="listitem"><p><span class="firstname">Joseph</span> <span class="surname">Wenninger</span> <code class="email">(kde AT jowenn.at)</code></p></li><li class="listitem"><p>Jochen Wilhelmy <code class="email">(digisnap AT cs.tu-berlin.de)</code></p></li><li class="listitem"><p><span class="firstname">Michael</span> <span class="surname">Koch</span> <code class="email">(koch AT kde.org)</code></p></li><li class="listitem"><p><span class="firstname">Christian</span> <span class="surname">Gebauer</span> <code class="email">(gebauer AT kde.org)</code></p></li><li class="listitem"><p><span class="firstname">Simon</span> <span class="surname">Hausmann</span> <code class="email">(hausmann AT kde.org)</code></p></li><li class="listitem"><p>Glen Parker <code class="email">(glenebob AT nwlink.com)</code></p></li><li class="listitem"><p>Scott Manson <code class="email">(sdmanson AT altel.net)</code></p></li><li class="listitem"><p><span class="firstname">John</span> <span class="surname">Firebaugh</span> <code class="email">(jfirebaugh AT kde.org)</code></p></li><li class="listitem"><p>Nibaldo González <code class="email">(nibgonz AT gmail.com)</code></p></li></ul></div><p>
The <span class="application">KatePart</span> documentation is based on the original <span class="application">KWrite</span> documentation,
modified to be relevant to all <span class="application">KatePart</span> consumers.
</p><p>
The original <span class="application">KWrite</span> documentation was written by <span class="firstname">Thad</span> <span class="surname">McGinnis</span>
<code class="email">(ctmcginnis AT compuserve.com)</code>, with lots of modifications from
<span class="firstname">Christian</span> <span class="surname">Tibirna</span> <code class="email">(tibirna AT kde.org)</code>. Converted to docbook/proofreading by
<span class="firstname">Lauri</span> <span class="surname">Watts</span> <code class="email">(lauri AT kde.org)</code> and updated by <span class="firstname">Anne-Marie</span> <span class="surname">Mahfouf</span>
<code class="email">(annma AT kde.org)</code> and <span class="firstname">Anders</span> <span class="surname">Lund</span> <code class="email">(anders AT alweb.dk)</code>
</p><p>The current <span class="application">KatePart</span> documentation is maintained by <span class="firstname">T.C.</span> <span class="surname">Hollingsworth</span>
<code class="email">(tchollingsworth AT gmail.com)</code>.  Please send comments or suggestions to the <span class="application">KatePart</span>
development mailing list at <code class="email">(kwrite-devel AT kde.org)</code> or file a bug
in the <a class="ulink" href="https://bugs.kde.org/" target="_top"><span class="orgname">KDE</span> Bugtracking System</a>.</p><p><a name="gnu-fdl"></a>This documentation is licensed under the terms of the <a class="ulink" href="help:/kdoctools5-common/fdl-license.html" target="_top">GNU Free Documentation
License</a>.</p><p>This program is licensed under the terms of the <a class="ulink" href="help:/kdoctools5-common/gpl-license.html" target="_top">GNU General Public License</a>.</p></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="config-variables.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="vi-input-mode-chapter.html">Next</a></td></tr><tr><td class="prevCell">Configuring With Document Variables </td><td class="upCell"> </td><td class="nextCell"> The VI Input Mode</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="vi-input-mode-chapter.html"><html><head><title>Chapter 9. The VI Input Mode</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="index.html" title="The KatePart Handbook"><link rel="prev" href="credits.html" title="Chapter 8. Credits and License"><link rel="next" href="regular-expressions.html" title="Appendix A. Regular Expressions"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> The VI Input Mode</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="credits.html">Prev</a></td><td class="upCell"> </td><td class="nextCell"><a accesskey="n" href="regular-expressions.html">Next</a></td></tr></table></div><div id="contentBody"><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="vi-input-mode-chapter"></a>Chapter 9. The VI Input Mode</h1></div><div><div class="authorgroup"><p class="author"><span class="firstname">Erlend</span> <span class="surname">Hamberg</span> <code class="email">&lt;ehamberg@gmail.com&gt;</code></p></div></div></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vi-mode-sect1"></a>VI Input Mode</h2></div></div></div><p>The goal of the VI mode is not to be a complete replacement
for Vim and support all Vim’s features. Its aim is to make
the <span class="quote">“<span class="quote">Vim way</span>”</span> of text editing - and the Vim habits learned -
available for programs using the <span class="application">KatePart</span> text editor as their internal editor.</p><p>The VI mode aims to integrate nicely with the program and deviate
from Vim’s behavior where it makes sense. For example,
<strong class="userinput"><code><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>:w</strong></span></span></code></strong> will open a save dialog in <span class="application">KatePart</span>’s VI mode.</p><p>To enable the VI Input Mode for all new views, go to
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Settings</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Configure <span class="application">KatePart</span>...</span></span>+<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Editing</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">VI Input Mode</span></span>.
On this tab you can set options for the VI Input Mode and define and edit
the key mapping in this mode.
VI Input Mode can also be toggled with the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">VI Input Mode</span></span>
setting in the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Edit</span></span> menu. (The default shortcut key is
<span class="keysym">Meta</span>+<span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>V</strong></span>
 - where <span class="keysym">Meta</span> usually is the <span class="keysym">Windows</span> key).</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Many Vi Mode keyboard commands are case-sensitive, unlike most <span class="orgname">KDE</span>
keyboard shortcuts.  That means that <strong class="userinput"><code>y</code></strong> and
<strong class="userinput"><code>Y</code></strong> are different commands.  To enter the
<strong class="userinput"><code>y</code></strong> (yank) command, make sure <span class="keysym">Caps Lock</span> is
disabled and press <span class="keycap"><strong>Y</strong></span>.  To enter the <strong class="userinput"><code>Y</code></strong>
(yank to end of line) command,
<span class="keycap"><strong>Shift</strong></span>+<span class="keycap"><strong>Y</strong></span>.</p><p>This does not apply to commands that use the <span class="keycap"><strong>Ctrl</strong></span> key, which may be
entered regardless of <span class="keycap"><strong>Caps Lock</strong></span> mode and without pressing
<span class="keycap"><strong>Shift</strong></span>.  However, some commands require the use of a <span class="keycap"><strong>Ctrl</strong></span>-key combination
followed by another key which is case sensitive.  For instance, to input
<span class="quote">“<span class="quote"><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>W</strong></span>,
<strong class="userinput"><code>h</code></strong></span>”</span> (switch to split view right) make sure
<span class="keycap"><strong>Caps Lock</strong></span> is disabled, press
<span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>W</strong></span>, release, and
then press <span class="keycap"><strong>H</strong></span>.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="vi-incompatibilities"></a>Incompatibilities with Vim</h3></div></div></div><p>There are only a few features of <span class="application">KatePart</span>’s VI mode which are incompatible
with Vim (not counting things missing). They are listed below together
with the respective reasons.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="application">KatePart</span>: <strong class="userinput"><code>U</code></strong> and
<span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>R</strong></span> is redo.</p><p>Vim: <span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>R</strong></span> is
normal redo, <span class="keycap"><strong>U</strong></span> is used to undo all latest changes on one line.</p><p>The reason for having <span class="keycap"><strong>U</strong></span> act as redo in <span class="application">KatePart</span>’s VI mode is
that the shortcut <span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>R</strong></span>
by default is taken by <span class="application">KatePart</span>’s replace function (search and replace). By default,
the VI mode won’t override <span class="application">KatePart</span>’s shortcuts (this can be configured in
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Settings</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Configure <span class="application">KatePart</span>...</span></span>+<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Editing</span></span> → <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenuitem">Vi Input Mode</span></span>),
therefore a redo-action needs to be available as a <span class="quote">“<span class="quote">regular</span>”</span> key press, too.
Besides, the behavior of the <strong class="userinput"><code>U</code></strong> command in Vim does not map well
to <span class="application">KatePart</span>’s internal undo system, so it would be non-trivial to support anyway.</p></li><li class="listitem"><p><span class="application">KatePart</span>: <strong class="userinput"><code><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>print</strong></span></span></code></strong> shows the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guilabel">Print</span></span> dialog.</p><p>Vim: <strong class="userinput"><code><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>print</strong></span></span></code></strong> prints the lines of
the given range like its grandfather ed.</p><p>Commands like <strong class="userinput"><code><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>:print</strong></span></span></code></strong> are available
not only in the VI mode but for users using <span class="quote">“<span class="quote">regular</span>”</span> <span class="application">KatePart</span>, too - therefore
the <strong class="userinput"><code><span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>:print</strong></span></span></code></strong> command opens
the print dialog - following the principle of least surprise instead of
mimicking Vim’s behavior.</p></li><li class="listitem"><p><span class="application">KatePart</span>: <strong class="userinput"><code>Y</code></strong> yanks to end of line.</p><p>Vim: <strong class="userinput"><code>Y</code></strong> yanks whole line, just like
<strong class="userinput"><code>y</code></strong><strong class="userinput"><code>y</code></strong>.</p><p>VI’s behavior for the <strong class="userinput"><code>Y</code></strong> command is in practice a bug.
For both change and delete commands,
<strong class="userinput"><code>c</code></strong><strong class="userinput"><code>c</code></strong>/
<strong class="userinput"><code>d</code></strong><strong class="userinput"><code>d</code></strong> will do its action on
the current line and <strong class="userinput"><code>C</code></strong>/<strong class="userinput"><code>D</code></strong> will work from the
cursor column to the end of the line. However, both
<strong class="userinput"><code>y</code></strong><strong class="userinput"><code>y</code></strong> and <strong class="userinput"><code>Y</code></strong>
yanks the current line. In <span class="application">KatePart</span>’s VI Mode <strong class="userinput"><code>Y</code></strong> will yank to the end
of the line. This is described as <span class="quote">“<span class="quote">more logical</span>”</span> in the Vim
<a class="ulink" href="http://vimdoc.sourceforge.net/htmldoc/change.html#Y" target="_top">documentation</a>.
</p></li><li class="listitem"><p><span class="application">KatePart</span>: <strong class="userinput"><code>O</code></strong> and <strong class="userinput"><code>o</code></strong> opens [<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>count</code></em></span>] new lines
and puts you in insert mode.</p><p>Vim: <strong class="userinput"><code>O</code></strong> and <strong class="userinput"><code>o</code></strong> opens a new line and inserts
text [<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>count</code></em></span>] times when leaving insert mode.</p><p>This is mostly done as a consequence of witnessing many people being
confused by this behavior on a vim <acronym class="acronym">IRC</acronym> channel (#vim on Libera Chat).</p></li></ul></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="vi-switching-modes"></a>Switching Modes</h3></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="emphasis"><em>Normal Mode</em></span> permits you to enter commands to navigate or edit
a document, and is the default mode.  You can return to it from any other mode by
pressing <span class="keycap"><strong>Esc</strong></span>.
</p></li><li class="listitem"><p><span class="emphasis"><em>Visual Mode</em></span> permits you to highlight text in a document.
Most Normal Mode commands are also valid in this mode.  You can enter it by pressing
<strong class="userinput"><code>v</code></strong> to select characters or <strong class="userinput"><code>V</code></strong> to select lines.
</p></li><li class="listitem"><p><span class="emphasis"><em>Insert Mode</em></span> permits you to edit the document directly. You
can enter it by pressing <strong class="userinput"><code>i</code></strong> or one of several other commands
listed below.
</p></li><li class="listitem"><p><span class="emphasis"><em>Command Mode</em></span> invokes <span class="application">KatePart</span>'s command line,
permitting you to run many commands available in Vi implementations as well as
some specific to <span class="application">KatePart</span>.  For more information on these commands, see
<a class="xref" href="advanced-editing-tools-commandline.html" title="The Editor Component Command Line">the section called “The Editor Component Command Line”</a>.  To use it,
press <span class="keycap"><strong>:</strong></span>, enter the command, and press <span class="keysym">Enter</span>.</p></li></ul></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="vi-integration"></a>Integration with <span class="application">Kate</span> features</h3></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>Visual Mode is entered automatically when text is selected with the mouse.
It is also entered when using functions of <span class="application">Kate</span> that select text, such as Select
All (either from the menu or via <span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>A</strong></span>.)</p></li><li class="listitem"><p>Vi marks and <a class="link" href="kate-part-bookmarks.html" title="Using Bookmarks"><span class="application">Kate</span> bookmarks</a> are
integrated.  When a mark is created in Vi Mode, a corresponding <span class="application">Kate</span> bookmark is
created and appears in the <span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="guiitem"><span class="guimenu">Bookmarks</span></span> menu.  Conversely, when
a <span class="application">Kate</span> bookmark is created, a corresponding Vi mark at the 0 column is also
created.</p></li></ul></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="vi-normal-visual-mode-commands"></a>Supported normal/visual mode commands</h3></div></div></div><div class="informaltable"><table class="informaltable" border="1"><colgroup><col><col></colgroup><tbody><tr><td><p><strong class="userinput"><code>a</code></strong></p></td><td><p>Enter Insert Mode; append after cursor</p></td></tr><tr><td><p><strong class="userinput"><code>A</code></strong></p></td><td><p>Enter Insert Mode; append after line</p></td></tr><tr><td><p><strong class="userinput"><code>i</code></strong></p></td><td><p>Enter Insert Mode; insert before cursor</p></td></tr><tr><td><p><span class="keycap"><strong>Ins</strong></span></p></td><td><p>Enter Insert Mode; insert before cursor</p></td></tr><tr><td><p><strong class="userinput"><code>I</code></strong></p></td><td><p>Enter Insert Mode; insert before first non-blank char on line</p></td></tr><tr><td><p><strong class="userinput"><code>gi</code></strong></p></td><td><p>Enter Insert Mode; insert before place, where leaving the last insert mode</p></td></tr><tr><td><p><strong class="userinput"><code>v</code></strong></p></td><td><p>Enter Visual Mode; select characters</p></td></tr><tr><td><p><strong class="userinput"><code>V</code></strong></p></td><td><p>Enter Visual Mode; select lines</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>v</strong></span></p></td><td><p>Enter Visual Mode; select blocks</p></td></tr><tr><td><p><strong class="userinput"><code>gb</code></strong></p></td><td><p>Enter Visual Mode; reselect the last selection</p></td></tr><tr><td><p><strong class="userinput"><code>o</code></strong></p></td><td><p>Open a new line below current line</p></td></tr><tr><td><p><strong class="userinput"><code>O</code></strong></p></td><td><p>Open a new line above current line</p></td></tr><tr><td><p><strong class="userinput"><code>J</code></strong></p></td><td><p>Join lines</p></td></tr><tr><td><p><strong class="userinput"><code>c</code></strong></p></td><td><p>Change:  follow by a motion to delete and enter Insert mode</p></td></tr><tr><td><p><strong class="userinput"><code>C</code></strong></p></td><td><p>Change to end of line:  Delete to end of line and enter Insert Mode</p></td></tr><tr><td><p><strong class="userinput"><code>cc</code></strong></p></td><td><p>Change line:  Delete line and enter Insert Mode</p></td></tr><tr><td><p><strong class="userinput"><code>s</code></strong></p></td><td><p>Substitute character</p></td></tr><tr><td><p><strong class="userinput"><code>S</code></strong></p></td><td><p>Substitute line</p></td></tr><tr><td><p><strong class="userinput"><code>dd</code></strong></p></td><td><p>Delete line</p></td></tr><tr><td><p><strong class="userinput"><code>d</code></strong></p></td><td><p>Follow by a motion to delete</p></td></tr><tr><td><p><strong class="userinput"><code>D</code></strong></p></td><td><p>Delete to end of line</p></td></tr><tr><td><p><strong class="userinput"><code>x</code></strong></p></td><td><p>Delete character to right of cursor</p></td></tr><tr><td><p><span class="keycap"><strong>Del</strong></span></p></td><td><p>Delete character to right of cursor</p></td></tr><tr><td><p><strong class="userinput"><code>X</code></strong></p></td><td><p>Delete character to left of cursor</p></td></tr><tr><td><p><strong class="userinput"><code>gu</code></strong></p></td><td><p>Follow with a motion to make lowercase</p></td></tr><tr><td><p><strong class="userinput"><code>guu</code></strong></p></td><td><p>Make the current line lowercase</p></td></tr><tr><td><p><strong class="userinput"><code>gU</code></strong></p></td><td><p>Follow with a motion to make uppercase</p></td></tr><tr><td><p><strong class="userinput"><code>gUU</code></strong></p></td><td><p>Make the current line uppercase</p></td></tr><tr><td><p><strong class="userinput"><code>y</code></strong></p></td><td><p>Follow by a motion to <span class="quote">“<span class="quote">yank</span>”</span> (copy)</p></td></tr><tr><td><p><strong class="userinput"><code>yy</code></strong></p></td><td><p>Yank (copy) line</p></td></tr><tr><td><p><strong class="userinput"><code>Y</code></strong></p></td><td><p>Yank (copy) line</p></td></tr><tr><td><p><strong class="userinput"><code>p</code></strong></p></td><td><p>Paste after cursor</p></td></tr><tr><td><p><strong class="userinput"><code>P</code></strong></p></td><td><p>Paste before cursor</p></td></tr><tr><td><p><strong class="userinput"><code>]p</code></strong></p></td><td><p>Paste after cursor indented</p></td></tr><tr><td><p><strong class="userinput"><code>[p</code></strong></p></td><td><p>Paste before cursor indented</p></td></tr><tr><td><p><strong class="userinput"><code>r</code></strong></p></td><td><p>Follow with a character to replace the character after the cursor</p></td></tr><tr><td><p><strong class="userinput"><code>R</code></strong></p></td><td><p>Enter Replace Mode</p></td></tr><tr><td><p><strong class="userinput"><code>:</code></strong></p></td><td><p>Enter Command Mode</p></td></tr><tr><td><p><strong class="userinput"><code>/</code></strong></p></td><td><p>Search</p></td></tr><tr><td><p><strong class="userinput"><code>u</code></strong></p></td><td><p>Undo</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>R</strong></span></p></td><td><p>Redo</p></td></tr><tr><td><p><strong class="userinput"><code>U</code></strong></p></td><td><p>Redo</p></td></tr><tr><td><p><strong class="userinput"><code>m</code></strong></p></td><td><p>Set mark (can be used by motions later)</p></td></tr><tr><td><p><strong class="userinput"><code>n</code></strong></p></td><td><p>Find next</p></td></tr><tr><td><p><strong class="userinput"><code>N</code></strong></p></td><td><p>Find previous</p></td></tr><tr><td><p><strong class="userinput"><code>&gt;&gt;</code></strong></p></td><td><p>Indent line</p></td></tr><tr><td><p><strong class="userinput"><code>&lt;&lt;</code></strong></p></td><td><p>Unindent line</p></td></tr><tr><td><p><strong class="userinput"><code>&gt;</code></strong></p></td><td><p>Indent lines</p></td></tr><tr><td><p><strong class="userinput"><code>&lt;</code></strong></p></td><td><p>Unindent lines</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>F</strong></span></p></td><td><p>Page down</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>B</strong></span></p></td><td><p>Page up</p></td></tr><tr><td><p><strong class="userinput"><code>ga</code></strong></p></td><td><p>Print the <acronym class="acronym">ASCII</acronym> value of the character</p></td></tr><tr><td><p><strong class="userinput"><code>.</code></strong></p></td><td><p>Repeat last change</p></td></tr><tr><td><p><strong class="userinput"><code>==</code></strong></p></td><td><p>commandAlignLine</p></td></tr><tr><td><p><strong class="userinput"><code>=</code></strong></p></td><td><p>commandAlignLines</p></td></tr><tr><td><p><strong class="userinput"><code>~</code></strong></p></td><td><p>Change case of current character</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>S</strong></span></p></td><td><p>Split view horizontally</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>V</strong></span></p></td><td><p>Split view vertically</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>W</strong></span>, <strong class="userinput"><code>w</code></strong></p></td><td><p>Cycle to next split window</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>W</strong></span>, <strong class="userinput"><code>h</code></strong></p>
<p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>W</strong></span> <span class="keysym">Left</span></p></td><td><p>Go to left split window</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>W</strong></span>, <strong class="userinput"><code>l</code></strong></p>
<p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>W</strong></span> <span class="keysym">Right</span></p></td><td><p>Go to right split window</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>W</strong></span>, <strong class="userinput"><code>k</code></strong></p>
<p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>W</strong></span> <span class="keysym">Up</span></p></td><td><p>Go to above split window</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>W</strong></span>, <strong class="userinput"><code>j</code></strong></p>
<p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>W</strong></span> <span class="keysym">Down</span></p></td><td><p>Go to below split window</p></td></tr></tbody></table></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="vi-supported-motions"></a>Supported motions</h3></div></div></div><p>These may be used to move around a document in Normal or Visual mode, or in
conjunction with one of the above commands.  They may be preceded by a count,
which indicates how many of the appropriate movements to make.</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col><col></colgroup><tbody><tr><td><p><strong class="userinput"><code>h</code></strong></p></td><td><p>Left</p></td></tr><tr><td><p><span class="keysym">Left</span></p></td><td><p>Left</p></td></tr><tr><td><p><span class="keysym">Backspace</span></p></td><td><p>Left</p></td></tr><tr><td><p><strong class="userinput"><code>j</code></strong></p></td><td><p>Down</p></td></tr><tr><td><p><span class="keysym">Down</span></p></td><td><p>Down</p></td></tr><tr><td><p><strong class="userinput"><code>k</code></strong></p></td><td><p>Up</p></td></tr><tr><td><p><span class="keysym">Up</span></p></td><td><p>Up</p></td></tr><tr><td><p><strong class="userinput"><code>l</code></strong></p></td><td><p>Right</p></td></tr><tr><td><p><span class="keysym">Right</span></p></td><td><p>Right</p></td></tr><tr><td><p><span class="keysym">Space</span></p></td><td><p>Right</p></td></tr><tr><td><p><strong class="userinput"><code>$</code></strong></p></td><td><p>End of line</p></td></tr><tr><td><p><span class="keycap"><strong>End</strong></span></p></td><td><p>End of line</p></td></tr><tr><td><p><strong class="userinput"><code>0</code></strong></p></td><td><p>First character of line (Column 0)</p></td></tr><tr><td><p><span class="keycap"><strong>Home</strong></span></p></td><td><p>First character of line</p></td></tr><tr><td><p><strong class="userinput"><code>^</code></strong></p></td><td><p>First non-blank character of line</p></td></tr><tr><td><p><strong class="userinput"><code>f</code></strong></p></td><td><p>Follow by character to move to right of cursor</p></td></tr><tr><td><p><strong class="userinput"><code>F</code></strong></p></td><td><p>Follow by character to move to left of cursor</p></td></tr><tr><td><p><strong class="userinput"><code>t</code></strong></p></td><td><p>Follow by character to move to right of cursor, placing the cursor on character before it</p></td></tr><tr><td><p><strong class="userinput"><code>T</code></strong></p></td><td><p>Follow by character to move to left of cursor, placing the cursor on character before it</p></td></tr><tr><td><p><strong class="userinput"><code>gg</code></strong></p></td><td><p>First line</p></td></tr><tr><td><p><strong class="userinput"><code>G</code></strong></p></td><td><p>Last line</p></td></tr><tr><td><p><strong class="userinput"><code>w</code></strong></p></td><td><p>Next Word</p></td></tr><tr><td><p><strong class="userinput"><code>W</code></strong></p></td><td><p>Next word separated by whitespace</p></td></tr><tr><td><p><strong class="userinput"><code>b</code></strong></p></td><td><p>Previous word</p></td></tr><tr><td><p><strong class="userinput"><code>B</code></strong></p></td><td><p>Previous word separated by whitespace</p></td></tr><tr><td><p><strong class="userinput"><code>e</code></strong></p></td><td><p>End of word</p></td></tr><tr><td><p><strong class="userinput"><code>E</code></strong></p></td><td><p>End of word separated by whitespace</p></td></tr><tr><td><p><strong class="userinput"><code>ge</code></strong></p></td><td><p>End of previous word</p></td></tr><tr><td><p><strong class="userinput"><code>gE</code></strong></p></td><td><p>End of previous word separated by whitespace</p></td></tr><tr><td><p><strong class="userinput"><code>|</code></strong></p></td><td><p>Follow by a column number to move to that column</p></td></tr><tr><td><p><strong class="userinput"><code>%</code></strong></p></td><td><p>Follow by an item to move to that item</p></td></tr><tr><td><p><strong class="userinput"><code>`</code></strong></p></td><td><p>Mark</p></td></tr><tr><td><p><strong class="userinput"><code>‘</code></strong></p></td><td><p>First non-whitespace character of the line the mark is on</p></td></tr><tr><td><p><strong class="userinput"><code>[[</code></strong></p></td><td><p>Previous opening bracket</p></td></tr><tr><td><p><strong class="userinput"><code>]]</code></strong></p></td><td><p>Next opening bracket</p></td></tr><tr><td><p><strong class="userinput"><code>[]</code></strong></p></td><td><p>Previous closing bracket</p></td></tr><tr><td><p><strong class="userinput"><code>][</code></strong></p></td><td><p>Next closing bracket</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>I</strong></span></p></td><td><p>Jump to next location</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>O</strong></span></p></td><td><p>Jump to previous location</p></td></tr><tr><td><p><strong class="userinput"><code>H</code></strong></p></td><td>Go to first line of screen</td></tr><tr><td><p><strong class="userinput"><code>M</code></strong></p></td><td>Go to middle line of screen</td></tr><tr><td><p><strong class="userinput"><code>L</code></strong></p></td><td>Go to last line of screen</td></tr><tr><td><p><strong class="userinput"><code>%<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>percentage</code></em></span></code></strong></p></td><td><p>Go to specified percentage of the document</p></td></tr><tr><td><p><strong class="userinput"><code>gk</code></strong></p></td><td><p>Go one line up visually (when using dynamic word wrap)</p></td></tr><tr><td><p><strong class="userinput"><code>gj</code></strong></p></td><td><p>Go one line down visually (when using dynamic word wrap)</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keysym">Left</span></p></td><td><p>Move one word left</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keysym">Right</span></p></td><td><p>Move one word right</p></td></tr></tbody></table></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="vi-supported-text-objects"></a>Supported text objects</h3></div></div></div><p>These may be used to select certain portions of a document.</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col><col></colgroup><tbody><tr><td><p><strong class="userinput"><code>iw</code></strong></p></td><td><p>Inner word: word including whitespace</p></td></tr><tr><td><p><strong class="userinput"><code>aw</code></strong></p></td><td><p>A word: word excluding whitespace</p></td></tr><tr><td><p><strong class="userinput"><code>i"</code></strong></p></td><td><p>Previous double-quote (<strong class="userinput"><code>"</code></strong>) to next double-quote,
including quotation marks</p></td></tr><tr><td><p><strong class="userinput"><code>a”</code></strong></p></td><td><p>Previous double-quote (<strong class="userinput"><code>"</code></strong>) to next double-quote,
excluding quotation marks</p></td></tr><tr><td><p><strong class="userinput"><code>i'</code></strong></p></td><td><p>Previous single-quote (<strong class="userinput"><code>'</code></strong>) to next single-quote,
including quotation marks</p></td></tr><tr><td><p><strong class="userinput"><code>a'</code></strong></p></td><td><p>Previous single-quote (<strong class="userinput"><code>'</code></strong>) to next single-quote,
excluding quotation marks</p></td></tr><tr><td><p><strong class="userinput"><code>i(</code></strong></p></td><td><p>Previous opening parenthesis [<strong class="userinput"><code>(</code></strong>] to next closing
parenthesis [<strong class="userinput"><code>)</code></strong>], including the parenthesis</p></td></tr><tr><td><p><strong class="userinput"><code>a(</code></strong></p></td><td><p>Previous opening parenthesis [<strong class="userinput"><code>(</code></strong>] to next closing
parenthesis [<strong class="userinput"><code>)</code></strong>], excluding the parenthesis</p></td></tr><tr><td><p><strong class="userinput"><code>i[</code></strong></p></td><td><p>Previous opening square bracket (<strong class="userinput"><code>[</code></strong>) to next closing
square bracket (<strong class="userinput"><code>]</code></strong>), including the brackets</p></td></tr><tr><td><p><strong class="userinput"><code>a[</code></strong></p></td><td><p>Previous opening square bracket (<strong class="userinput"><code>[</code></strong>) to next closing
square bracket (<strong class="userinput"><code>]</code></strong>), excluding the brackets</p></td></tr><tr><td><p><strong class="userinput"><code>i{</code></strong></p></td><td><p>Previous opening curly bracket (<strong class="userinput"><code>{</code></strong>) to next closing
curly bracket (<strong class="userinput"><code>}</code></strong>), including the brackets</p></td></tr><tr><td><p><strong class="userinput"><code>a{</code></strong></p></td><td><p>Previous opening curly bracket (<strong class="userinput"><code>{</code></strong>) to next closing
curly bracket (<strong class="userinput"><code>}</code></strong>), excluding the brackets</p></td></tr><tr><td><p><strong class="userinput"><code>i&lt;</code></strong></p></td><td><p>Previous opening angle bracket (<strong class="userinput"><code>&lt;</code></strong>) to next closing
angle bracket (<strong class="userinput"><code>&gt;</code></strong>), including the brackets</p></td></tr><tr><td><p><strong class="userinput"><code>a&lt;</code></strong></p></td><td><p>Previous opening angle bracket (<strong class="userinput"><code>&lt;</code></strong>) to next closing
square bracket (<strong class="userinput"><code>&gt;</code></strong>), excluding the brackets</p></td></tr><tr><td><p><strong class="userinput"><code>i`</code></strong></p></td><td><p>Previous backtick (<strong class="userinput"><code>`</code></strong>) to next backtick,
including the backticks</p></td></tr><tr><td><p><strong class="userinput"><code>a`</code></strong></p></td><td><p>Previous backtick (<strong class="userinput"><code>`</code></strong>) to next backtick,
excluding the backticks</p></td></tr></tbody></table></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="vi-insert-mode-commands"></a>Supported insert mode commands</h3></div></div></div><div class="informaltable"><table class="informaltable" border="1"><colgroup><col><col></colgroup><tbody><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>D</strong></span></p></td><td><p>Unindent</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>T</strong></span></p></td><td><p>Indent</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>E</strong></span></p></td><td><p>Insert from below</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Y</strong></span></p></td><td><p>Delete word</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>W</strong></span></p></td><td><p>Delete word</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>U</strong></span></p></td><td><p>Delete line</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>J</strong></span></p></td><td><p>New line</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>H</strong></span></p></td><td><p>Delete char backward</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Home</strong></span></p></td><td><p>Move to first character in the document</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>R</strong></span>
<strong class="userinput"><code>n</code></strong></p></td><td>Insert the contents of register <code class="literal">n</code></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>O</strong></span>,
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="replaceable"><em class="replaceable"><code>command</code></em></span></p></td><td><p>Enter normal mode for one command only</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>A</strong></span></p></td><td><p>Increment currently selected number</p></td></tr><tr><td><p><span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>X</strong></span></p></td><td><p>Decrement currently selected number</p></td></tr></tbody></table></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="vi-text-object"></a>The Comma Text Object</h3></div></div></div><p>This object is missing in Vim. The comma text object
makes it easy to modify parameter lists in C-like languages and other comma
separated lists. It is basically the area between two commas or between a comma
and a bracket. In the line shown in the illustration, the three
ranges this text object can span are highlighted.</p><div class="screenshot"><a name="screenshot-resources"></a><div xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="mediaobject"><img src="comma-to.png" alt="An example of Comma Text Object"><div class="caption"><p>Comma text object ranges. If the cursor is over <abbr class="abbrev">e.g.</abbr>
<span class="replaceable"><em class="replaceable"><code>arg2</code></em></span>, pressing
<strong class="userinput"><code>ci</code></strong>, (<span class="quote">“<span class="quote">change inner comma</span>”</span>)
would delete <span class="replaceable"><em class="replaceable"><code>double arg2</code></em></span> and place the cursor between
the two commas in insert mode. A very convenient way to change a function's
parameters.</p></div></div></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="vi-missing-features"></a>Missing Features</h3></div></div></div><p>As stated earlier, the goal of <span class="application">KatePart</span>’s VI Mode is not to support 100% of
Vim’s features.</p></div></div></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="credits.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="regular-expressions.html">Next</a></td></tr><tr><td class="prevCell">Credits and License </td><td class="upCell"> </td><td class="nextCell"> Regular Expressions</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="regular-expressions.html"><html><head><title>Appendix A. Regular Expressions</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="index.html" title="The KatePart Handbook"><link rel="prev" href="vi-input-mode-chapter.html" title="Chapter 9. The VI Input Mode"><link rel="next" href="regex-patterns.html" title="Patterns"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Regular Expressions</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="vi-input-mode-chapter.html">Prev</a></td><td class="upCell"> </td><td class="nextCell"><a accesskey="n" href="regex-patterns.html">Next</a></td></tr></table></div><div id="contentBody"><div class="appendix"><div class="titlepage"><div><div><h1 class="title"><a name="regular-expressions"></a>Appendix A. Regular Expressions</h1></div><div><div class="authorgroup"><p class="author"><span class="firstname">Anders</span> <span class="surname">Lund</span> <code class="email">&lt;anders@alweb.dk&gt;</code></p></div></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="sect1"><a href="regular-expressions.html#idm10001">Introduction</a></span></dt><dt><span class="sect1"><a href="regex-patterns.html">Patterns</a></span></dt><dd><dl><dt><span class="sect2"><a href="regex-patterns.html#idm10059">Escaping characters</a></span></dt><dt><span class="sect2"><a href="regex-patterns.html#idm10070">Character Classes and abbreviations</a></span></dt><dt><span class="sect2"><a href="regex-patterns.html#idm10240">Alternatives: matching <span class="quote">“<span class="quote">one of</span>”</span></a></span></dt><dt><span class="sect2"><a href="regex-patterns.html#idm10249">Sub Patterns</a></span></dt><dt><span class="sect2"><a href="regex-patterns.html#special-characters-in-patterns">Characters with a special meaning inside patterns</a></span></dt></dl></dd><dt><span class="sect1"><a href="quantifiers.html">Quantifiers</a></span></dt><dd><dl><dt><span class="sect2"><a href="quantifiers.html#idm10425">Greed</a></span></dt><dt><span class="sect2"><a href="quantifiers.html#idm10432">In context examples</a></span></dt></dl></dd><dt><span class="sect1"><a href="assertions.html">Assertions</a></span></dt></dl></div><pre class="synopsis">This Appendix contains a brief but hopefully sufficient and
covering introduction to the world of <span class="emphasis"><em>regular
expressions</em></span>. It documents regular expressions in the form
available within <span class="application">KatePart</span>, which is not compatible with the regular
expressions of perl, nor with those of for example
<span xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" class="command"><span class="command"><strong>grep</strong></span></span>.</pre><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idm10001"></a>Introduction</h2></div></div></div><p><span class="emphasis"><em>Regular Expressions</em></span> provides us with a way
to describe some possible contents of a text string in a way
understood by a small piece of software, so that it can investigate if
a text matches, and also in the case of advanced applications with the
means of saving pieces or the matching text.</p><p>An example: Say you want to search a text for paragraphs that
starts with either of the names <span class="quote">“<span class="quote">Henrik</span>”</span> or
<span class="quote">“<span class="quote">Pernille</span>”</span> followed by some form of the verb
<span class="quote">“<span class="quote">say</span>”</span>.</p><p>With a normal search, you would start out searching for the
first name, <span class="quote">“<span class="quote">Henrik</span>”</span> maybe followed by <span class="quote">“<span class="quote">sa</span>”</span>
like this: <strong class="userinput"><code>Henrik sa</code></strong>, and while looking for
matches, you would have to discard those not being the beginning of a
paragraph, as well as those in which the word starting with the
letters <span class="quote">“<span class="quote">sa</span>”</span> was not either <span class="quote">“<span class="quote">says</span>”</span>,
<span class="quote">“<span class="quote">said</span>”</span> or so.  And then of course repeat all of that with
the next name...</p><p>With Regular Expressions, that task could be accomplished with a
single search, and with a larger degree of preciseness.</p><p>To achieve this, Regular Expressions defines rules for
expressing in details a generalization of a string to match. Our
example, which we might literally express like this: <span class="quote">“<span class="quote">A line
starting with either <span class="quote">‘<span class="quote">Henrik</span>’</span> or <span class="quote">‘<span class="quote">Pernille</span>’</span>
(possibly following up to 4 blanks or tab characters) followed by a
whitespace followed by <span class="quote">‘<span class="quote">sa</span>’</span> and then either
<span class="quote">‘<span class="quote">ys</span>’</span> or <span class="quote">‘<span class="quote">id</span>’</span></span>”</span> could be expressed with
the following regular expression:</p><p><strong class="userinput"><code>^[
\t]{0,4}(Henrik|Pernille) sa(ys|id)</code></strong></p><p>The above example demonstrates all four major concepts of modern
Regular Expressions, namely:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>Patterns</p></li><li class="listitem"><p>Assertions</p></li><li class="listitem"><p>Quantifiers</p></li><li class="listitem"><p>Back references</p></li></ul></div><p>The caret (<code class="literal">^</code>) starting the expression is an
assertion, being true only if the following matching string is at the
start of a line.</p><p>The strings <code class="literal">[ \t]</code> and
<code class="literal">(Henrik|Pernille) sa(ys|id)</code> are patterns. The first
one is a <span class="emphasis"><em>character class</em></span> that matches either a
blank or a (horizontal) tab character; the other pattern contains
first a subpattern matching either <code class="literal">Henrik</code>
<span class="emphasis"><em>or</em></span> <code class="literal">Pernille</code>, then a piece
matching the exact string <code class="literal"> sa</code> and finally a
subpattern matching either <code class="literal">ys</code>
<span class="emphasis"><em>or</em></span> <code class="literal">id</code></p><p>The string <code class="literal">{0,4}</code> is a quantifier saying
<span class="quote">“<span class="quote">anywhere from 0 up to 4 of the previous</span>”</span>.</p><p>Because regular expression software supporting the concept of
<span class="emphasis"><em>back references</em></span> saves the entire matching part of
the string as well as sub-patterns enclosed in parentheses, given some
means of access to those references, we could get our hands on either
the whole match (when searching a text document in an editor with a
regular expression, that is often marked as selected) or either the
name found, or the last part of the verb.</p><p>All together, the expression will match where we wanted it to,
and only there.</p><p>The following sections will describe in details how to construct
and use patterns, character classes, assertions, quantifiers and
back references, and the final section will give a few useful
examples.</p></div><FILENAME filename="regex-patterns.html"><html><head><title>Patterns</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="regular-expressions.html" title="Appendix A. Regular Expressions"><link rel="prev" href="regular-expressions.html" title="Appendix A. Regular Expressions"><link rel="next" href="quantifiers.html" title="Quantifiers"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Patterns</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="regular-expressions.html">Prev</a></td><td class="upCell">Regular Expressions</td><td class="nextCell"><a accesskey="n" href="quantifiers.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="regex-patterns"></a>Patterns</h2></div></div></div><p>Patterns consists of literal strings and character
classes. Patterns may contain sub-patterns, which are patterns enclosed
in parentheses.</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="idm10059"></a>Escaping characters</h3></div></div></div><p>In patterns as well as in character classes, some characters
have a special meaning.  To literally match any of those characters,
they must be marked or <span class="emphasis"><em>escaped</em></span> to let the regular
expression software know that it should interpret such characters in
their literal meaning.</p><p>This is done by prepending the character with a backslash
(<code class="literal">\</code>).</p><p>The regular expression software will silently ignore escaping a
character that does not have any special meaning in the context, so
escaping for example a <span class="quote">“<span class="quote">j</span>”</span> (<strong class="userinput"><code>\j</code></strong>) is
safe. If you are in doubt whether a character could have a special
meaning, you can therefore escape it safely.</p><p>Escaping of course includes the backslash character itself, to
literally match a such, you would write
<strong class="userinput"><code>\\</code></strong>.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="idm10070"></a>Character Classes and abbreviations</h3></div></div></div><p>A <span class="emphasis"><em>character class</em></span> is an expression that
matches one of a defined set of characters. In Regular Expressions,
character classes are defined by putting the legal characters for the
class in square brackets, <code class="literal">[]</code>, or by using one of
the abbreviated classes described below.</p><p>Simple character classes just contains one or more literal
characters, for example <strong class="userinput"><code>[abc]</code></strong> (matching either
of the letters <span class="quote">“<span class="quote">a</span>”</span>, <span class="quote">“<span class="quote">b</span>”</span> or <span class="quote">“<span class="quote">c</span>”</span>)
or <strong class="userinput"><code>[0123456789]</code></strong> (matching any digit).</p><p>Because letters and digits have a logical order, you can
abbreviate those by specifying ranges of them:
<strong class="userinput"><code>[a-c]</code></strong> is equal to <strong class="userinput"><code>[abc]</code></strong>
and <strong class="userinput"><code>[0-9]</code></strong> is equal to
<strong class="userinput"><code>[0123456789]</code></strong>.  Combining these constructs, for
example <strong class="userinput"><code>[a-fynot1-38]</code></strong> is completely legal (the
last one would match, of course, either of
<span class="quote">“<span class="quote">a</span>”</span>,<span class="quote">“<span class="quote">b</span>”</span>,<span class="quote">“<span class="quote">c</span>”</span>,<span class="quote">“<span class="quote">d</span>”</span>,
<span class="quote">“<span class="quote">e</span>”</span>,<span class="quote">“<span class="quote">f</span>”</span>,<span class="quote">“<span class="quote">y</span>”</span>,<span class="quote">“<span class="quote">n</span>”</span>,<span class="quote">“<span class="quote">o</span>”</span>,<span class="quote">“<span class="quote">t</span>”</span>,
<span class="quote">“<span class="quote">1</span>”</span>,<span class="quote">“<span class="quote">2</span>”</span>,<span class="quote">“<span class="quote">3</span>”</span> or
<span class="quote">“<span class="quote">8</span>”</span>).</p><p>As capital letters are different characters from their
non-capital equivalents, to create a caseless character class matching
<span class="quote">“<span class="quote">a</span>”</span> or <span class="quote">“<span class="quote">b</span>”</span>, in any case, you need to write it
<strong class="userinput"><code>[aAbB]</code></strong>.</p><p>It is of course possible to create a <span class="quote">“<span class="quote">negative</span>”</span>
class matching as <span class="quote">“<span class="quote">anything but</span>”</span> To do so put a caret
(<code class="literal">^</code>) at the beginning of the class: </p><p><strong class="userinput"><code>[^abc]</code></strong> will match any character
<span class="emphasis"><em>but</em></span> <span class="quote">“<span class="quote">a</span>”</span>, <span class="quote">“<span class="quote">b</span>”</span> or
<span class="quote">“<span class="quote">c</span>”</span>.</p><p>In addition to literal characters, some abbreviations are
defined, making life still a bit easier:

</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><strong class="userinput"><code>\a</code></strong></span></dt><dd><p> This matches the <acronym class="acronym">ASCII</acronym> bell character (BEL, 0x07).</p></dd><dt><span class="term"><strong class="userinput"><code>\f</code></strong></span></dt><dd><p> This matches the <acronym class="acronym">ASCII</acronym> form feed character (FF, 0x0C).</p></dd><dt><span class="term"><strong class="userinput"><code>\n</code></strong></span></dt><dd><p> This matches the <acronym class="acronym">ASCII</acronym> line feed character (LF, 0x0A, Unix newline).</p></dd><dt><span class="term"><strong class="userinput"><code>\r</code></strong></span></dt><dd><p> This matches the <acronym class="acronym">ASCII</acronym> carriage return character (CR, 0x0D).</p></dd><dt><span class="term"><strong class="userinput"><code>\t</code></strong></span></dt><dd><p> This matches the <acronym class="acronym">ASCII</acronym> horizontal tab character (HT, 0x09).</p></dd><dt><span class="term"><strong class="userinput"><code>\v</code></strong></span></dt><dd><p> This matches the <acronym class="acronym">ASCII</acronym> vertical tab character (VT, 0x0B).</p></dd><dt><span class="term"><strong class="userinput"><code>\xhhhh</code></strong></span></dt><dd><p> This matches the Unicode character corresponding to
the hexadecimal number hhhh (between 0x0000 and 0xFFFF). \0ooo (<abbr class="abbrev">i.e.</abbr>,
\zero ooo) matches the <acronym class="acronym">ASCII</acronym>/Latin-1 character
corresponding to the octal number ooo (between 0 and
0377).</p></dd><dt><span class="term"><strong class="userinput"><code>.</code></strong> (dot)</span></dt><dd><p> This matches any character (including newline).</p></dd><dt><span class="term"><strong class="userinput"><code>\d</code></strong></span></dt><dd><p> This matches a digit. Equal to <code class="literal">[0-9]</code></p></dd><dt><span class="term"><strong class="userinput"><code>\D</code></strong></span></dt><dd><p> This matches a non-digit. Equal to <code class="literal">[^0-9]</code> or <code class="literal">[^\d]</code></p></dd><dt><span class="term"><strong class="userinput"><code>\s</code></strong></span></dt><dd><p> This matches a whitespace character. Practically equal to <code class="literal">[ \t\n\r]</code></p></dd><dt><span class="term"><strong class="userinput"><code>\S</code></strong></span></dt><dd><p> This matches a non-whitespace. Practically equal to <code class="literal">[^ \t\r\n]</code>, and equal to <code class="literal">[^\s]</code></p></dd><dt><span class="term"><strong class="userinput"><code>\w</code></strong></span></dt><dd><p>Matches any <span class="quote">“<span class="quote">word character</span>”</span> - in this case any letter, digit or underscore.
Equal to <code class="literal">[a-zA-Z0-9_]</code></p></dd><dt><span class="term"><strong class="userinput"><code>\W</code></strong></span></dt><dd><p>Matches any non-word character - anything but letters, numbers or underscore.
Equal to <code class="literal">[^a-zA-Z0-9_]</code> or <code class="literal">[^\w]</code></p></dd></dl></div><p>

</p><p>The <span class="emphasis"><em>POSIX notation of classes</em></span>,
<strong class="userinput"><code>[:&lt;class name&gt;:]</code></strong> are also supported.
For example, <strong class="userinput"><code>[:digit:]</code></strong> is equivalent to <strong class="userinput"><code>\d</code></strong>,
and <strong class="userinput"><code>[:space:]</code></strong> to <strong class="userinput"><code>\s</code></strong>.
See the full list of POSIX character classes
<a class="ulink" href="https://www.regular-expressions.info/posixbrackets.html" target="_top">here</a>.</p><p>The abbreviated classes can be put inside a custom class, for
example to match a word character, a blank or a dot, you could write
<strong class="userinput"><code>[\w \.]</code></strong></p><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="idm10215"></a>Characters with special meanings inside character classes</h4></div></div></div><p>The following characters has a special meaning inside the
<span class="quote">“<span class="quote">[]</span>”</span> character class construct, and must be escaped to be
literally included in a class:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><strong class="userinput"><code>]</code></strong></span></dt><dd><p>Ends the character class. Must be escaped unless it is the very first character in the
class (may follow an unescaped caret).</p></dd><dt><span class="term"><strong class="userinput"><code>^</code></strong> (caret)</span></dt><dd><p>Denotes a negative class, if it is the first character. Must be escaped to match literally if it is the first character in the class.</p></dd><dt><span class="term"><strong class="userinput"><code>-</code></strong> (dash)</span></dt><dd><p>Denotes a logical range. Must always be escaped within a character class.</p></dd><dt><span class="term"><strong class="userinput"><code>\</code></strong> (backslash)</span></dt><dd><p>The escape character. Must always be escaped.</p></dd></dl></div></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="idm10240"></a>Alternatives: matching <span class="quote">“<span class="quote">one of</span>”</span></h3></div></div></div><p>If you want to match one of a set of alternative patterns, you
can separate those with <code class="literal">|</code> (vertical bar character).</p><p>For example to find either <span class="quote">“<span class="quote">John</span>”</span> or <span class="quote">“<span class="quote">Harry</span>”</span> you would use an expression <strong class="userinput"><code>John|Harry</code></strong>.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="idm10249"></a>Sub Patterns</h3></div></div></div><p><span class="emphasis"><em>Sub patterns</em></span> are patterns enclosed in
parentheses, and they have several uses in the world of regular
expressions.</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="idm10253"></a>Specifying alternatives</h4></div></div></div><p>You may use a sub pattern to group a set of alternatives within
a larger pattern. The alternatives are separated by the character
<span class="quote">“<span class="quote">|</span>”</span> (vertical bar).</p><p>For example to match either of the words <span class="quote">“<span class="quote">int</span>”</span>,
<span class="quote">“<span class="quote">float</span>”</span> or <span class="quote">“<span class="quote">double</span>”</span>, you could use the
pattern <strong class="userinput"><code>int|float|double</code></strong>. If you only want to
find one if it is followed by some whitespace and then some letters,
put the alternatives inside a subpattern:
<strong class="userinput"><code>(int|float|double)\s+\w+</code></strong>.</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="regex-capturing"></a>Capturing matching text (back references)</h4></div></div></div><p>If you want to use a back reference, use a sub pattern <strong class="userinput"><code>(PATTERN)</code></strong>
to have the desired part of the pattern remembered.
To prevent the sub pattern from being remembered, use a non-capturing group
<strong class="userinput"><code>(?:PATTERN)</code></strong>.</p><p>For example, if you want to find two occurrences of the same
word separated by a comma and possibly some whitespace, you could
write <strong class="userinput"><code>(\w+),\s*\1</code></strong>. The sub pattern
<code class="literal">\w+</code> would find a chunk of word characters, and the
entire expression would match if those were followed by a comma, 0 or
more whitespace and then an equal chunk of word characters.  (The
string <code class="literal">\1</code> references <span class="emphasis"><em>the first sub pattern
enclosed in parentheses</em></span>.)</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>To avoid ambiguities with usage of <strong class="userinput"><code>\1</code></strong> with some digits behind it (<abbr class="abbrev">e.g.</abbr> <strong class="userinput"><code>\12</code></strong> can be 12th subpattern or just the first subpattern with <strong class="userinput"><code>2</code></strong>) we use <strong class="userinput"><code>\{12}</code></strong> as syntax for multi-digit subpatterns.</p><p>Examples:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><strong class="userinput"><code>\{12}1</code></strong> is <span class="quote">“<span class="quote">use subpattern 12</span>”</span></p></li><li class="listitem"><p><strong class="userinput"><code>\123</code></strong> is <span class="quote">“<span class="quote">use capture 1 then 23 as the normal text</span>”</span></p></li></ul></div></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="lookahead-assertions"></a>Lookahead Assertions</h4></div></div></div><p>A lookahead assertion is a sub pattern, starting with either
<code class="literal">?=</code> or <code class="literal">?!</code>.</p><p>For example to match the literal string <span class="quote">“<span class="quote">Bill</span>”</span> but
only if not followed by <span class="quote">“<span class="quote"> Gates</span>”</span>, you could use this
expression: <strong class="userinput"><code>Bill(?! Gates)</code></strong>.  (This would find
<span class="quote">“<span class="quote">Bill Clinton</span>”</span> as well as <span class="quote">“<span class="quote">Billy the kid</span>”</span>,
but silently ignore the other matches.)</p><p>Sub patterns used for assertions are not captured.</p><p>See also <a class="link" href="assertions.html" title="Assertions">Assertions</a>.</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="lookbehind-assertions"></a>Lookbehind Assertions</h4></div></div></div><p>A lookbehind assertion is a sub pattern, starting with either
<code class="literal">?&lt;=</code> or <code class="literal">?&lt;!</code>.</p><p>Lookbehind has the same effect as the lookahead, but works backwards.
For example to match the literal string <span class="quote">“<span class="quote">fruit</span>”</span> but
only if not preceded by <span class="quote">“<span class="quote">grape</span>”</span>, you could use this
expression: <strong class="userinput"><code>(?&lt;!grape)fruit</code></strong>.</p><p>Sub patterns used for assertions are not captured.</p><p>See also <a class="link" href="assertions.html" title="Assertions">Assertions</a></p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="special-characters-in-patterns"></a>Characters with a special meaning inside patterns</h3></div></div></div><p>The following characters have meaning inside a pattern, and
must be escaped if you want to literally match them:

</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><strong class="userinput"><code>\</code></strong> (backslash)</span></dt><dd><p>The escape character.</p></dd><dt><span class="term"><strong class="userinput"><code>^</code></strong> (caret)</span></dt><dd><p>Asserts the beginning of the string.</p></dd><dt><span class="term"><strong class="userinput"><code>$</code></strong></span></dt><dd><p>Asserts the end of string.</p></dd><dt><span class="term"><strong class="userinput"><code>()</code></strong> (left and right parentheses)</span></dt><dd><p>Denotes sub patterns.</p></dd><dt><span class="term"><strong class="userinput"><code>{}</code></strong> (left and right curly braces)</span></dt><dd><p>Denotes numeric quantifiers.</p></dd><dt><span class="term"><strong class="userinput"><code>[]</code></strong> (left and right square brackets)</span></dt><dd><p>Denotes character classes.</p></dd><dt><span class="term"><strong class="userinput"><code>|</code></strong> (vertical bar)</span></dt><dd><p>logical OR. Separates alternatives.</p></dd><dt><span class="term"><strong class="userinput"><code>+</code></strong> (plus sign)</span></dt><dd><p>Quantifier, 1 or more.</p></dd><dt><span class="term"><strong class="userinput"><code>*</code></strong> (asterisk)</span></dt><dd><p>Quantifier, 0 or more.</p></dd><dt><span class="term"><strong class="userinput"><code>?</code></strong> (question mark)</span></dt><dd><p>An optional character. Can be interpreted as a quantifier, 0 or 1.</p></dd></dl></div><p>

</p></div></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="regular-expressions.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="quantifiers.html">Next</a></td></tr><tr><td class="prevCell">Regular Expressions </td><td class="upCell">Regular Expressions</td><td class="nextCell"> Quantifiers</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="quantifiers.html"><html><head><title>Quantifiers</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="regular-expressions.html" title="Appendix A. Regular Expressions"><link rel="prev" href="regex-patterns.html" title="Patterns"><link rel="next" href="assertions.html" title="Assertions"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Quantifiers</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="regex-patterns.html">Prev</a></td><td class="upCell">Regular Expressions</td><td class="nextCell"><a accesskey="n" href="assertions.html">Next</a></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="quantifiers"></a>Quantifiers</h2></div></div></div><p><span class="emphasis"><em>Quantifiers</em></span> allows a regular expression to
match a specified number or range of numbers of either a character,
character class or sub pattern.</p><p>Quantifiers are enclosed in curly brackets (<code class="literal">{</code>
and <code class="literal">}</code>) and have the general form
<code class="literal">{[minimum-occurrences][,[maximum-occurrences]]}</code>
</p><p>The usage is best explained by example:

</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><strong class="userinput"><code>{1}</code></strong></span></dt><dd><p>Exactly 1 occurrence</p></dd><dt><span class="term"><strong class="userinput"><code>{0,1}</code></strong></span></dt><dd><p>Zero or 1 occurrences</p></dd><dt><span class="term"><strong class="userinput"><code>{,1}</code></strong></span></dt><dd><p>The same, with less work;)</p></dd><dt><span class="term"><strong class="userinput"><code>{5,10}</code></strong></span></dt><dd><p>At least 5 but maximum 10 occurrences.</p></dd><dt><span class="term"><strong class="userinput"><code>{5,}</code></strong></span></dt><dd><p>At least 5 occurrences, no maximum.</p></dd></dl></div><p>

</p><p>Additionally, there are some abbreviations:

</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><strong class="userinput"><code>*</code></strong> (asterisk)</span></dt><dd><p>similar to <code class="literal">{0,}</code>, find any number of occurrences.</p></dd><dt><span class="term"><strong class="userinput"><code>+</code></strong> (plus sign)</span></dt><dd><p>similar to <code class="literal">{1,}</code>, at least 1 occurrence.</p></dd><dt><span class="term"><strong class="userinput"><code>?</code></strong> (question mark)</span></dt><dd><p>similar to <code class="literal">{0,1}</code>, zero or 1 occurrence.</p></dd></dl></div><p>

</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="idm10425"></a>Greed</h3></div></div></div><p>When using quantifiers with no maximum, regular expressions
defaults to match as much of the searched string as possible, commonly
known as <span class="emphasis"><em>greedy</em></span> behavior.</p><p>Modern regular expression software provides the means of
<span class="quote">“<span class="quote">turning off greediness</span>”</span>, though in a graphical
environment it is up to the interface to provide you with access to
this feature. For example a search dialog providing a regular
expression search could have a check box labeled <span class="quote">“<span class="quote">Minimal
matching</span>”</span> as well as it ought to indicate if greediness is the
default behavior.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="idm10432"></a>In context examples</h3></div></div></div><p>Here are a few examples of using quantifiers:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><strong class="userinput"><code>^\d{4,5}\s</code></strong></span></dt><dd><p>Matches the digits in <span class="quote">“<span class="quote">1234 go</span>”</span> and <span class="quote">“<span class="quote">12345 now</span>”</span>, but neither in <span class="quote">“<span class="quote">567 eleven</span>”</span>
nor in <span class="quote">“<span class="quote">223459 somewhere</span>”</span>.</p></dd><dt><span class="term"><strong class="userinput"><code>\s+</code></strong></span></dt><dd><p>Matches one or more whitespace characters.</p></dd><dt><span class="term"><strong class="userinput"><code>(bla){1,}</code></strong></span></dt><dd><p>Matches all of <span class="quote">“<span class="quote">blablabla</span>”</span> and the <span class="quote">“<span class="quote">bla</span>”</span> in <span class="quote">“<span class="quote">blackbird</span>”</span> or <span class="quote">“<span class="quote">tabla</span>”</span>.</p></dd><dt><span class="term"><strong class="userinput"><code>/?&gt;</code></strong></span></dt><dd><p>Matches <span class="quote">“<span class="quote">/&gt;</span>”</span> in <span class="quote">“<span class="quote">&lt;closeditem/&gt;</span>”</span> as well as
<span class="quote">“<span class="quote">&gt;</span>”</span> in <span class="quote">“<span class="quote">&lt;openitem&gt;</span>”</span>.</p></dd></dl></div></div></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="regex-patterns.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="assertions.html">Next</a></td></tr><tr><td class="prevCell">Patterns </td><td class="upCell">Regular Expressions</td><td class="nextCell"> Assertions</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME><FILENAME filename="assertions.html"><html><head><title>Assertions</title><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-default.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-docs.css"><link rel="stylesheet" type="text/css" href="help:/kdoctools5-common/kde-localised.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><meta name="keywords" content="KDE, KatePart, KWrite, text, editor"><link rel="home" href="index.html" title="The KatePart Handbook"><link rel="up" href="regular-expressions.html" title="Appendix A. Regular Expressions"><link rel="prev" href="quantifiers.html" title="Quantifiers"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="GENERATOR" content="KDE XSL Stylesheet V1.14 using libxslt"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div id="content"><div id="header"><div id="header_content"><div id="header_left"><div id="header_right"><img src="help:/kdoctools5-common/top-kde.jpg" width="36" height="34"> Assertions</div></div></div></div><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="quantifiers.html">Prev</a></td><td class="upCell">Regular Expressions</td><td class="nextCell"></td></tr></table></div><div id="contentBody"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="assertions"></a>Assertions</h2></div></div></div><p><span class="emphasis"><em>Assertions</em></span> allows a regular expression to
match only under certain controlled conditions.</p><p>An assertion does not need a character to match, it rather
investigates the surroundings of a possible match before acknowledging
it. For example the <span class="emphasis"><em>word boundary</em></span> assertion does
not try to find a non word character opposite a word one at its
position, instead it makes sure that there is not a word
character. This means that the assertion can match where there is no
character, <abbr class="abbrev">i.e.</abbr> at the ends of a searched string.</p><p>Some assertions actually do have a pattern to match, but the
part of the string matching that will not be a part of the result of
the match of the full expression.</p><p>Regular Expressions as documented here supports the following
assertions:

</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><strong class="userinput"><code>^</code></strong> (caret: beginning of
string)</span></dt><dd><p>Matches the beginning of the searched
string.</p><p>The expression <strong class="userinput"><code>^Peter</code></strong> will
match at <span class="quote">“<span class="quote">Peter</span>”</span> in the string <span class="quote">“<span class="quote">Peter, hey!</span>”</span>
but not in <span class="quote">“<span class="quote">Hey, Peter!</span>”</span> </p></dd><dt><span class="term"><strong class="userinput"><code>$</code></strong> (end of string)</span></dt><dd><p>Matches the end of the searched string.</p><p>The expression <strong class="userinput"><code>you\?$</code></strong> will match at the
last you in the string <span class="quote">“<span class="quote">You didn't do that, did you?</span>”</span> but
nowhere in <span class="quote">“<span class="quote">You didn't do that, right?</span>”</span></p></dd><dt><span class="term"><strong class="userinput"><code>\b</code></strong> (word boundary)</span></dt><dd><p>Matches if there is a word character at one side and not a word character at the
other.</p><p>This is useful to find word ends, for example both ends to find
a whole word. The expression <strong class="userinput"><code>\bin\b</code></strong> will match
at the separate <span class="quote">“<span class="quote">in</span>”</span> in the string <span class="quote">“<span class="quote">He came in
through the window</span>”</span>, but not at the <span class="quote">“<span class="quote">in</span>”</span> in
<span class="quote">“<span class="quote">window</span>”</span>.</p></dd><dt><span class="term"><strong class="userinput"><code>\B</code></strong> (non word boundary)</span></dt><dd><p>Matches wherever <span class="quote">“<span class="quote">\b</span>”</span> does not.</p><p>That means that it will match for example within words: The expression
<strong class="userinput"><code>\Bin\B</code></strong> will match at in <span class="quote">“<span class="quote">window</span>”</span> but not in <span class="quote">“<span class="quote">integer</span>”</span> or <span class="quote">“<span class="quote">I'm in love</span>”</span>.</p></dd><dt><span class="term"><strong class="userinput"><code>(?=PATTERN)</code></strong> (Positive lookahead)</span></dt><dd><p>A lookahead assertion looks at the part of the string following a possible match.
The positive lookahead will prevent the string from matching if the text following the possible match
does not match the <span class="emphasis"><em>PATTERN</em></span> of the assertion, but the text matched by that will
not be included in the result.</p><p>The expression <strong class="userinput"><code>handy(?=\w)</code></strong> will match at <span class="quote">“<span class="quote">handy</span>”</span> in
<span class="quote">“<span class="quote">handyman</span>”</span> but not in <span class="quote">“<span class="quote">That came in handy!</span>”</span></p></dd><dt><span class="term"><strong class="userinput"><code>(?!PATTERN)</code></strong> (Negative lookahead)</span></dt><dd><p>The negative lookahead prevents a possible match to be
acknowledged if the following part of the searched string does match
its <span class="emphasis"><em>PATTERN</em></span>.</p><p>The expression <strong class="userinput"><code>const \w+\b(?!\s*&amp;)</code></strong>
will match at <span class="quote">“<span class="quote">const char</span>”</span> in the string <span class="quote">“<span class="quote">const
char* foo</span>”</span> while it can not match <span class="quote">“<span class="quote">const QString</span>”</span>
in <span class="quote">“<span class="quote">const QString&amp; bar</span>”</span> because the
<span class="quote">“<span class="quote">&amp;</span>”</span> matches the negative lookahead assertion
pattern.</p></dd><dt><span class="term"><strong class="userinput"><code>(?&lt;=PATTERN)</code></strong> (Positive lookbehind)</span></dt><dd><p>Lookbehind has the same effect as the lookahead, but works backwards.
A lookbehind looks at the part of the string previous a possible match. The positive
lookbehind will match a string only if it is preceded by the <span class="emphasis"><em>PATTERN</em></span>
of the assertion, but the text matched by that will not be included in the result.</p><p>The expression <strong class="userinput"><code>(?&lt;=cup)cake</code></strong> will match at <span class="quote">“<span class="quote">cake</span>”</span>
if it is succeeded by <span class="quote">“<span class="quote">cup</span>”</span> (in <span class="quote">“<span class="quote">cupcake</span>”</span> but not in
<span class="quote">“<span class="quote">cheesecake</span>”</span> or in <span class="quote">“<span class="quote">cake</span>”</span> alone).</p></dd><dt><span class="term"><strong class="userinput"><code>(?&lt;!PATTERN)</code></strong> (Negative lookbehind)</span></dt><dd><p>The negative lookbehind prevents a possible match to be acknowledged if
the previous part of the searched string does match its <span class="emphasis"><em>PATTERN</em></span>.</p><p>The expression <strong class="userinput"><code>(?&lt;![\w\.])[0-9]+</code></strong> will match at <span class="quote">“<span class="quote">123</span>”</span>
in the strings <span class="quote">“<span class="quote">=123</span>”</span> and <span class="quote">“<span class="quote">-123</span>”</span> while it can not match <span class="quote">“<span class="quote">123</span>”</span>
in <span class="quote">“<span class="quote">.123</span>”</span> or <span class="quote">“<span class="quote">word123</span>”</span>.</p></dd><dt><span class="term"><strong class="userinput"><code>(PATTERN)</code></strong> (Capturing group)</span></dt><dd><p>The sub pattern within the parentheses is captured and remembered,
so that it can be used in back references. For example, the expression
<strong class="userinput"><code>(&amp;quot;+)[^&amp;quot;]*\1</code></strong> matches
<strong class="userinput"><code>""""text""""</code></strong> and
<strong class="userinput"><code>"text"</code></strong>.</p><p>See the section <a class="link" href="regex-patterns.html#regex-capturing" title="Capturing matching text (back references)">Capturing matching text (back references)</a>
for more information.</p></dd><dt><span class="term"><strong class="userinput"><code>(?:PATTERN)</code></strong> (Non-capturing group)</span></dt><dd><p>The sub pattern within the parentheses is not captured and
is not remembered. It is preferable to always use non-capturing groups if
the captures will not be used.</p></dd></dl></div><p>

</p></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="quantifiers.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"></td></tr><tr><td class="prevCell">Quantifiers </td><td class="upCell">Regular Expressions</td><td class="nextCell"> </td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"><a accesskey="p" href="vi-input-mode-chapter.html">Prev</a></td><td class="upCell"><a accesskey="h" href="index.html">Contents</a></td><td class="nextCell"><a accesskey="n" href="regex-patterns.html">Next</a></td></tr><tr><td class="prevCell">The VI Input Mode </td><td class="upCell"> </td><td class="nextCell"> Patterns</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME></div></div><div id="footer"><div class="navCenter"><table class="navigation"><tr><td class="prevCell"></td><td class="upCell"> </td><td class="nextCell"><a accesskey="n" href="introduction.html">Next</a></td></tr><tr><td class="prevCell"> </td><td class="upCell"> </td><td class="nextCell"> Introduction</td></tr></table></div><div id="footer_text">Would you like to make a comment or contribute an update to this page?<br>Send feedback to the <a href="mailto:kde-doc-english@kde.org" class="footer_email">KDE Docs Team</a></div></div></div></body></html></FILENAME>

Generated by dwww version 1.15 on Thu Jun 20 14:24:23 CEST 2024.