<chapter id="fundamentals">
<chapterinfo>
<authorgroup>
<author><personname><firstname></firstname></personname></author>
<!-- TRANS:ROLES_OF_TRANSLATORS -->
</authorgroup>
</chapterinfo>
<title>The Fundamentals</title>

<para>
If you have ever used a text editor, you will have no problem using
&kate;. In the next two sections, <link linkend="starting-kate">Starting
&kate; </link> and in <link linkend="working-with-kate">Working with
&kate;</link>, we will show you everything you need to get up and running
quickly.
</para>

<sect1 id="starting-kate">
<title>Starting &kate;</title>

<para>
You can start &kate; from the application launcher or from the
command line.
</para>

<sect2 id="starting-from-the-menu">
<title>From the Menu</title>
<para>
Open the &kde; program menu by clicking on the
application launcher icon on the toolbar at the bottom left of your
screen. This will raise a menu. Move your
cursor up the menu to the <menuchoice><guimenu>Applications</guimenu><guisubmenu>Utilities</guisubmenu>
<guimenuitem>Advanced Text Editor &kate;</guimenuitem></menuchoice> menu item.
</para>

</sect2>

<sect2 id="starting-from-the-command-line">
<title>From the Command Line</title>

<para>
You can start &kate; by typing its name on the command line. If you give
it a file name, as in the example below, it will open or create that
file.
</para>

<informalexample>
<screen>
<prompt>%</prompt><userinput><command>kate</command> <option><replaceable>myfile.txt</replaceable></option></userinput>
</screen>
</informalexample>

<para>
If you have an active connection, and permission, you can take advantage
of &kde;'s network transparency to open files on the internet.
</para>

<informalexample>
<screen>
<prompt>%</prompt><userinput><command>kate</command> <option><replaceable>&kde-ftp;README</replaceable></option></userinput>
</screen>
</informalexample>

<para>To change the directory for temporary files, which defaults to <filename class="directory">/tmp</filename>
set the <envar>TMPDIR</envar> environment variable before starting &kate;, &eg;
<informalexample>
<screen>
<prompt>%</prompt><userinput><command>mkdir</command> /tmp/kate -p &amp;&amp; export TMPDIR=/tmp/kate &amp;&amp; kate</userinput>
</screen>
</informalexample>
</para>

<sect3 id="command-line-options">
<title>Command Line Options</title>
<para>&kate; accepts following command line options:</para>

<variablelist>
<varlistentry>
<term><userinput><command>kate</command> <option>--help</option></userinput></term>
<listitem>
<para>
This lists the options available at the command line.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><userinput><command>kate</command>
<option>-s</option> <option>--start</option> <parameter>name</parameter></userinput></term>
<listitem>
<para>
Starts &kate; with the session <parameter>name</parameter>. The session is created
if it does not exist already. If a &kate; instance running the specified session
exists, the specified files are loaded in that instance.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><userinput><command>kate</command>
<option>-p</option> <option>--pid</option> <parameter>PID</parameter></userinput></term>
<listitem>
<para>
Only reuses an instance with the specified PID (Process ID).
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><userinput><command>kate</command>
<option>-e</option> <option>--encoding</option> <parameter>encoding</parameter>
<parameter>URL</parameter></userinput></term>
<listitem><para>Uses the specified encoding for the document.
</para></listitem>
</varlistentry>

<varlistentry>
<term><userinput><command>kate</command>
<option>-l</option> <option>--line</option> <parameter>line</parameter>
<parameter>URL</parameter></userinput></term>
<listitem><para>Navigates to the specified line after opening the document.
</para></listitem>
</varlistentry>

<varlistentry>
<term><userinput><command>kate</command>
<option>-c</option> <option>--column</option> <parameter>column</parameter>
<parameter>URL</parameter></userinput></term>
<listitem><para>Navigates to the specified column after opening the document.
</para></listitem>
</varlistentry>

<varlistentry>
<term><userinput><command>kate</command>
<option>-i</option> <option>--stdin</option></userinput></term>
<listitem><para>Reads the document content from STDIN. This
is similar to the common option <option>-</option> used in many command line
programs, and allows you to pipe command output into &kate;.</para></listitem>
</varlistentry>

<varlistentry>
<term><userinput><command>kate</command>
<option>--startanon</option></userinput></term>
<listitem><para>Start &kate; with a new anonymous session, implies
<option>-n</option>.</para></listitem>
</varlistentry>

<varlistentry>
<term><userinput><command>kate</command>
<option>-n</option> <option>--new</option></userinput></term>
<listitem><para>Force start of a new &kate; instance (is ignored if <option>start</option> is
used and another &kate; instance already has the given session opened), forced
if no parameters and no URLs are given at all.</para></listitem>
</varlistentry>

<varlistentry>
<term><userinput><command>kate</command>
<option>-b</option> <option>--block</option></userinput></term>
<listitem><para>If using an already running &kate; instance, block until it exits, if URLs
given to open.</para>
<para>
You can use &kate; with this option as editor for typing in commit messages for version
control systems like &git; or <application>Subversion</application>.
These systems expect to block the editor till you have entered your
message, because they then open the temporary file, which would be empty
if &kate; immediately returned to the caller.
</para>
<para>This option is also needed with KIO (&kde; Input/Output), if you open a remote file (which has been
downloaded to a temporary) and should be reuploaded, after you saved it.
</para></listitem>
</varlistentry>

<varlistentry>
<term><userinput><command>kate</command>
<option>--tempfile</option></userinput></term>
<listitem><para>When used, the specified files are treated as temporary files and
deleted (if they are local files and you have sufficient permissions) when
closed, unless they were modified since they were opened.</para></listitem>
</varlistentry>

<varlistentry>
<term><userinput><command>kate</command>
<option>--desktopfile</option> <parameter>filename</parameter></userinput></term>
<listitem><para>The base file name of the desktop entry for this application.</para>
<para>This is in particular useful for wrapper applications and
applications having in general multiple desktop files. Thus each desktop
file can have its own command line for the <option>Exec</option> entry.
</para></listitem>
</varlistentry>

<varlistentry>
<term><userinput><command>kate</command>
<option>--author</option></userinput></term>
<listitem>
<para>
Lists &kate;'s authors in the terminal window.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><userinput><command>kate</command>
<option>-v</option> <option>--version</option></userinput></term>
<listitem>
<para>
Lists version information for &kate;.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><userinput><command>kate</command>
<option>--license</option></userinput></term>
<listitem>
<para>
Shows license information.
</para>
</listitem>
</varlistentry>
</variablelist>

</sect3>
</sect2>

<sect2 id="drag-and-drop">
<title>Drag and Drop</title>
<para>
&kate; uses the &kde; Drag and Drop protocol. Files may be dragged and
dropped onto &kate; from the Desktop, the filemanager &dolphin; or some remote &FTP;
site opened in one of &dolphin;'s windows.
</para>
</sect2>
</sect1>

<sect1 id="working-with-kate">
<title>Working with &kate;</title>
<para>
<link linkend="quick-start">Quick Start</link> will show you how to
toggle four simple options that will let you configure some of &kate;'s
more powerful features right away. <link linkend="keystroke-commands">
Shortcuts</link> lays out some of the default keystroke
shortcuts for those who can't or don't want to use a mouse.
</para>

<sect2 id="quick-start">
<title>Quick Start</title>

<para>
This section will describe some of the items on the
<guimenu>View</guimenu> menu so that you can quickly configure
&kate; to work the way you want it.
</para>

<para> When you start &kate; for the first time you will see two windows
with white backgrounds. Above the two windows is a toolbar with the
usual labeled icons. And above that, a menubar.
</para>

<para>
The left-hand window is a side bar. It combines the <guilabel>Documents</guilabel>
and <guilabel>Filesystem Browser</guilabel> windows. Switch between the two by clicking on the tabs
to the left of the window. </para>

<para>
If you've started &kate; with a file, the right-hand window will show
the file you are editing and the <guilabel>Documents</guilabel> on the side bar will show the
name of the file. Use the <guilabel>Filesystem Browser</guilabel> window to open files.
</para>

<para>
You can toggle all sidebar windows on and off in
<menuchoice><guimenu>View</guimenu><guisubmenu>Tool Views</guisubmenu></menuchoice>
menu or use <keycombo action="simul">&Ctrl;&Alt;&Shift;<keycap>F</keycap></keycombo>.
This menu offers you your first glimpse into &kate;'s power and
flexibility.
</para>

<para>In <guisubmenu>Tool Views</guisubmenu> you have a list of all enabled plugins.
Click the checkbox in front of each item or click with the &LMB; on the tool buttons
in the sidebar to toggle this tool view on and off.
</para>

</sect2>

<sect2 id="keystroke-commands">
<title>Shortcuts</title>

<para>
Many of &kate;'s keystroke commands (shortcuts) are configurable by
way of the <link linkend="settings-help-menu">Settings</link> menu.  By default
&kate; honors the following key bindings.
</para>

<informaltable>
<tgroup cols="2">
<tbody>

<row>
<entry><para><keycombo action="simul"><keycap>F1</keycap></keycombo></para></entry>
<entry><para> Help</para></entry>
</row>
<row>
<entry><para><keycombo action="simul">&Shift;<keycap>F1</keycap></keycombo></para></entry>
<entry><para><link linkend="whats-this">What's this?</link></para></entry>
</row>
<row>
<entry><para><keycombo action="simul">&Ctrl;<keycap>N</keycap></keycombo></para></entry>
<entry><para> <link linkend="file-new">New</link> document</para></entry>
</row>
<row>
<entry><para><keycombo action="simul">&Ctrl;<keycap>L</keycap></keycombo></para></entry>
<entry><para> Save All</para></entry>
</row>
<row>
<entry><para><keycombo
action="simul">&Ctrl;<keycap>O</keycap></keycombo></para></entry>
<entry><para><link linkend="file-open">Open a document</link> </para></entry>
</row>
<row>
<entry><para><keycombo action="simul">&Ctrl;&Alt;<keycap>O</keycap></keycombo> </para></entry>
<entry><para>Quick Open</para></entry>
</row>
<row>
<entry><para><keycombo action="simul">&Ctrl;&Shift;<keycap>F</keycap></keycombo> </para></entry>
<entry><para>Full Screen Mode</para></entry>
</row>
<row>
<entry><para><keycombo action="simul">&Ctrl;&Shift;<keycap>,</keycap></keycombo> </para></entry>
<entry><para>Configure &kate;</para></entry>
</row>
<row>
<entry><para><keycombo
action="simul">&Ctrl;<keycap>W</keycap></keycombo> /
<keycombo action="simul">&Ctrl;&Esc;</keycombo></para></entry>
<entry><para><link linkend="file-close">Close</link> </para></entry>
</row>
<row>
<entry><para><keycombo action="simul">&Ctrl;<keycap>Q</keycap></keycombo> </para></entry>
<entry><para>Quit - close active copy of editor </para></entry>
</row>
<row>
<entry><para><keycombo action="simul">&Ctrl;&Alt;&Shift;<keycap>F</keycap></keycombo> </para></entry>
<entry><para>Show Sidebars</para></entry>
</row>
<row>
<entry><para><keycombo action="simul">&Ctrl;&Shift;<keycap>T</keycap></keycombo> </para></entry>
<entry><para>Split Horizontal</para></entry>
</row>
<row>
<entry><para><keycombo action="simul">&Ctrl;&Shift;<keycap>L</keycap></keycombo> </para></entry>
<entry><para>Split Vertical</para></entry>
</row>
<row>
<entry><para><keycap>F8</keycap></para></entry>
<entry><para>Next Split View</para></entry>
</row>
<row>
<entry><para><keycombo action="simul">&Shift;<keycap>F8</keycap></keycombo> /
<keycombo action="simul">&Ctrl;&Esc;</keycombo></para></entry>
<entry><para>Previous Split View</para></entry>
</row>
<row>
<entry><para><keycombo action="simul">&Ctrl;&Shift;<keycap>R</keycap></keycombo> </para></entry>
<entry><para>Close Current View</para></entry>
</row>
<row>
<entry><para><keycombo action="simul">&Alt;&Right;</keycombo></para></entry>
<entry><para>Next Tab</para></entry>
</row>
<row>
<entry><para><keycombo action="simul">&Alt;&Left;</keycombo></para></entry>
<entry><para>Previous Tab</para></entry>
</row>
<row>
<entry><para><keycombo action="simul">&Ctrl;&Shift;<keycap>T</keycap></keycombo></para></entry>
<entry><para>Reopen Latest Closed Document(s)</para></entry>
</row>

</tbody>
</tgroup>
</informaltable>

<para>Additionally you can use the shortcuts provided by the <ulink 
url="help:/katepart/keybindings.html">&katepart;</ulink> component and by all activated <link linkend="plugins">&kate; plugins</link>.</para>

</sect2>

</sect1>

<sect1 id="kate-mdi">
<title>Working With the &kate; <acronym>MDI</acronym></title>

<sect2 id="kate-mdi-overview">
<title>Overview</title>

<para>Window, View, Document, Frame, Editor... What are they all in
the terminology of &kate;, and how do you get the most out of it? This
chapter will explain all of that, and even more.</para>

<sect3 id="kate-mdi-overview-mainwindow">

<title>The Main Window</title>

<para><indexterm><primary>Main window</primary></indexterm>
The &kate; Main Window is a standard &kde; application window,
with the addition of side bars containing tool views. It has a
menubar with all the common menus, and some more, and a toolbar
providing access to commonly used commands.</para>

<para>The most important part of the window is the editing area, by
default displaying a single text editor component, in which you can
work with your documents.</para>

<para>The docking capabilities of the window is used for the tool
windows of any plugin enabled in the settings dialog.</para>

<para>Tool views can be positioned in any sidebar, to move a tool right click
its sidebar button and select from the &RMB; menu</para>

<para>A tool view can be marked as <emphasis>persistent</emphasis> in the &RMB;
menu for its sidebar button. The sidebar can contain
more tools at one time so that when a tool is persistent other tools can be
shown simultaneously.</para>

<para>If a plugin has configuration options you can use the first item
in the context menu to open the corresponding page in &kate;'s
settings dialog.</para>

</sect3>

</sect2>

<sect2 id="kate-mdi-editor">

<title>The Editor area</title>

<para><indexterm><primary>Editing Area</primary></indexterm>
&kate; is capable of having more than one document open at the
same time, and also of splitting the editing area into any number of
frames, similar to how for example &konqueror; or the popular
<application>emacs</application> text editor works. This way you can
view several documents at the same time, or more instances of the same
document, handy for example if your document contains definitions in
the top that you want to see often for reference. Or you could view a
program source header in one frame, while editing the implementation
file in another.</para>

<para>When a document is available in more than one editor, changes
made in one editor will immediately be reflected in the others as
well. This includes changing the text as well as selecting
text. Search operations or cursor movement is only reflected in the
current editor.</para>

<para>It is currently not possible to have more instances of the same
document open in the sense that one instance will be edited while the
other will not.</para>

<para>When splitting an editor into two frames, it is divided into two
equally sized frames, both displaying the current document of that
editor. The new frame will be at the bottom (in the case of a
horizontal split) or at the right (for a vertical split). The new
frame gets the focus, which is visualized by the blinking cursor bar in the
focused frame.</para>

</sect2>

</sect1>

<sect1 id="fundamentals-using-sessions">
<title>Using Sessions</title>

<para>Sessions is how &kate; lets you keep more than one list of files and
&GUI; configuration around. You can have as many named sessions as you want,
and you can use unnamed or anonymous sessions for files you want to use only
once. Currently &kate; can save the list of open files, and the general window
configuration in the session; future versions of &kate; may add more features
that can be saved in sessions. With the introduction of sessions, &kate; also
allows you to open any number of instances of the application instead of just
one as it used to do as the default behavior.</para>

<para>Sessions are supported in three areas:

<itemizedlist>
<listitem><para><link linkend="command-line-options"><emphasis>Command line
options</emphasis></link> that lets you select and start sessions when launching
&kate; from the command line.</para>
</listitem>
<listitem><para><link linkend="sessions-menu"><emphasis>The Sessions
menu</emphasis></link> that lets you switch, save, start and manage your
sessions.</para></listitem>
<listitem><para><link linkend="config-dialog-sessions"><emphasis>Configuration
options</emphasis></link> that lets you decide how sessions generally should
behave.</para></listitem>
</itemizedlist>

</para>

<para>When starting a new session, the &GUI; configuration of <guilabel>Default
Session</guilabel> is loaded. To save window configuration in the default
session, you need to enable saving window configuration in the sessions
configuration page of the configuration dialog and then load the default
session, set up the window as desired and save the session again.</para>

<para>When a named session is loaded, &kate; will display the session name at
the start of the window title, which then has the form
<quote><replaceable>Session Name</replaceable>: <replaceable>Document name or
&URL;</replaceable> - &kate;</quote>.</para>

<para>When opening files on the command line with <option>--start
<replaceable>name</replaceable></option> or if a session is selected using the
session chooser, the specified session is loaded prior to the files specified
on the command line. To open files from the command line in a new, unnamed
session, configure &kate; to start a new session as default in the session page of
the configuration dialog or use <option>--start</option> with an empty string:
<replaceable>''</replaceable>.</para>

<para>Since &kate; 2.5.1 the <acronym>PID</acronym> of the current instance is
exported to the environment variable <envar>KATE_PID</envar>. When opening files
from the built in terminal Kate will automatically select the current instance
if nothing else is indicated on the command line.</para>

</sect1>

<sect1 id="fundamentals-quick-open">
<title>Quick Open</title>

<para>To be able to quickly open/switch between files, Kate comes with a built-in quick open
dialog. You can open it with <keycombo action="simul">&Ctrl;&Alt;<keycap>O</keycap></keycombo>.
</para>

<para>
Quick open can show all open documents in Kate as well as all files in open projects. To
be able to see project files, you need to enable <link linkend="kate-application-plugin-projects">Project Plugin</link>.
</para>

<sect2>
<title>Using Quick Open</title>

<para>
Using quick open is very simple. Once you open it, just type the name or portions of the name of the file
you want to open and quick open will filter the list based on what you typed. Hitting &Enter; opens the selected file,
while &Esc; hides the quick open.
</para>
<para>
By default, only the file name is matched while filtering. If you want to match path, you need
to have a "/" in the typed text. For example: "doc/index" will match all the files that contain
"index" inside the folder "doc".
</para>
<para>
The documents which are already open are highlighted in bold and are listed at the top when the dialog
opens. Also, when quick open shows up the previous open document is already selected so you can just
press &Enter; and it will take you to that document.
</para>

</sect2>

<sect2>
<title>Configuring Quick Open</title>
<screenshot id="screenshot-project-quickopen">
<screeninfo>Quick Open</screeninfo>
<mediaobject>
<imageobject><imagedata fileref="project-quickopen.png" format="PNG"/></imageobject>
</mediaobject>
</screenshot>
<para>
Quick open provides a couple of config options. To access these options, right-click in the input line edit.
</para>
<variablelist>
<varlistentry>
<term>Currently available options are:</term>
<listitem>
<para><userinput>Current Project</userinput> - Show files from current project only</para>
<para><userinput>All Projects</userinput> - Show files from all open projects</para>
<para><userinput>Fuzzy Filtering</userinput> - Use fuzzy matching algorithm to filter files</para>
<para><userinput>Wildcard Filtering</userinput>- Use wildcard matching to filter files</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>

</sect1>

<sect1 id="fundamentals-getting-help">

<title>Getting Help</title>

<sect2>

<title>With &kate;</title>
<variablelist>

<varlistentry>
<term>This manual</term>

<listitem>
<para>Offers detailed documentation on all menu commands,
configuration options, tools, dialogs, plugins &etc; as well as
descriptions of the &kate; window, the editor and various concepts
used in the application.</para>

<para>Press <keycap>F1</keycap> or use the
<menuchoice><guimenu>Help</guimenu>
<guimenuitem>&kate; Handbook</guimenuitem></menuchoice> menu topic to view this
manual.</para></listitem>

</varlistentry>

<varlistentry id="whats-this">
<term>What's This Help</term>
<listitem>
<para>What's This help offers immediate help with single elements of
graphical windows, such as buttons or other window areas.</para>

<para>We strive to provide What's This help for any elements for which
it makes sense. It is available throughout the configuration dialog,
and in many other dialogs as well.</para>

<para>To employ What's This help, press
<keycombo action="simul">&Shift;<keycap>F1</keycap></keycombo> or use the
<menuchoice><guimenu>Help</guimenu><guimenuitem>What's
This</guimenuitem></menuchoice> menu item to enable What's This
mode. The cursor will turn into an arrow with a question mark, and you
can now click any element in the window to read the What's This help
for that element, if it is available.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>Help Buttons in Dialogs</term>
<listitem>
<para>Some dialogs have a <guibutton>Help</guibutton> Button. Pressing
it will start the &khelpcenter; and open the relevant
documentation.</para>
</listitem>
</varlistentry>
</variablelist>

</sect2>

<sect2>
<title>With Your Text Files</title>

<para>&kate; does not (yet!) provide any means for reading document
related documentation. Depending on the file you are editing, you may
find the <link linkend="kate-application-plugin-konsole">Built in
Terminal Emulator</link> helpful for viewing related &UNIX; manual pages or
info documentation, or you can use &konqueror;.</para>

</sect2>

<sect2>
<title>Articles on &kate;</title>

<para>&kate;'s homepage provides some <ulink url="https://kate-editor.org/featured-articles">
Articles and Howtos</ulink> with further information beyond the scope of this handbook.</para>

</sect2>

</sect1>

</chapter>
