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

# Working with Plugins

&kate; offers several types of plugin. There are plugins for the &kate; editor component, which are available to any application using the editor component, such as KDevelop, Quanta, Kile, &kwrite; and many others. There are also plugins only available in the &kate; editor itself. There are two types of these plugins: some are written in native C++, while others are written in the Python programming language. There are subtle differences in these, described below.

You can enable any type of plugin in the configuration dialog, which also provides access to additional configuration options for plugins that require it.

There are many plugins for various purposes available and you can search the web for more. A few plugins are shipped with the editor component, for inserting automatic braces, inserting files, and exporting text as &HTML;.

&plugins-part-sections;

## Scripts

Tools Scripts Emmet
  Tools Scripts Emmet Expand abbreviation

    Converts the selected text to a pair of opening and closing &HTML; or &XML; tags. For example, if `div` is selected, this item will replace that with `<div></div>`.

  Tools Scripts Emmet Wrap with tag

    Wraps the selected text with the tag provided on the command line.

  Tools Scripts Emmet Select &HTML;/&XML; tag contents inwards

    When the cursor is inside a pair of &HTML;/&XML; tags, this option will change the selection to include the contents of those &HTML;/&XML; tags, without selecting the tags themselves.

  Tools Scripts Emmet Select &HTML;/&XML; tag contents outwards

    When the cursor is inside a pair of &HTML;/&XML; tags, this item will change the selection to include the contents of those &HTML;/&XML; tags, including the tags themselves.

  Tools Scripts Emmet Move cursor to matching tag

    If the cursor is inside an opening &HTML;/&XML; 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.

  Tools Scripts Emmet Toggle Comment

    If the selected portion is not a comment, this item will enclose that portion in &HTML;/&XML; comments (&eg; `<!-- selected text -->`). If the selected portion is a comment, the comment tags will be removed instead.

  Tools Scripts Emmet Delete tag under cursor

    If the cursor is presently inside a &HTML;/&XML; tag, this item will delete the entire tag.

  Tools Scripts Emmet Decrement number by 1

    This item will subtract one from the currently selected text, if it is a number. For example, if `5` is selected, it will become `4`.

  Tools Scripts Emmet Decrement number by 10

    This item will subtract 10 from the currently selected text, if it is a number. For example, if `15` is selected, it will become `5`.

  Tools Scripts Emmet Decrement number by 0.1

    This item will subtract 0.1 from the currently selected text, if it is a number. For example, if `4.5` is selected, it will become `4.4`.

  Tools Scripts Emmet Increment number by 1

    This item will add one to the currently selected text, if it is a number. For example, if `5` is selected, it will become `6`.

  Tools Scripts Emmet Increment number by 10

    This item will add 10 to the currently selected text, if it is a number. For example, if `5` is selected, it will become `15`.

  Tools Scripts Emmet Increment number by 0.1

    This item will add 0.1 to the currently selected text, if it is a number. For example, if `4.5` is selected, it will become `4.6`.

Tools Scripts Navigation
  &Alt;&Shift;Up Tools Scripts Navigation Move cursor to previous matching indent

    Moves the cursor to the first line above the current line that is indented at the same level as the current line.

  &Alt;&Shift;Down Tools Scripts Navigation Move cursor to next matching indent

    Moves the cursor to the first line below the current line that is indented at the same level as the current line.

Tools Scripts Editing
  Tools Scripts Editing Sort Selected Text

    Sorts the selected text or whole document in ascending order.

  &Ctrl;&Shift;Down Tools Scripts Editing Move Lines Down

    Move selected lines down.

  &Ctrl;&Shift;Up Tools Scripts Editing Move Lines Up

    Move selected lines up.

  &Ctrl;&Alt;Down Tools Scripts Editing Duplicate Selected Lines Down

    Duplicates the selected lines down.

  &Ctrl;&Alt;Up Tools Scripts Editing Duplicate Selected Lines Up

    Duplicates the selected lines up.

  Tools Scripts Editing URI-encode selected text

    Encodes the selected text so that it can be used as part of a query string in a &URL;, replacing the selection with the encoded text.

  Tools Scripts Editing URI-decode selected text

    If part of the query string of a &URL; is selected, this will decode it and replace the selection with the original raw text.

## &kate; Application Plugins

&kate; plugins are additional functions for the &kate; editor. They can add extra menus and shortcuts, and extend &kate;'s features. You can install as many or as few as you like, from within &kate;. Open &kate;'s configuration dialog with Settings Configure &kate;... Select Application Plugins to choose the wanted plugins.

The available application plugins are:

- Backtrace Browser - Backtrace navigation tool view

- Build Plugin - Compile or Make and parse error messages

- Close Except/Like - Close group of documents based on a common path or file extension

- CTags - Look up definitions/declarations with CTags

- File system browser - File system browser tool view

- File Templates - Create new files from templates

- &gdb; - Provides a simple &gdb; frontend

- Jovie Text-to-Speech - Adds a menu entry for speaking the text

- Mail files - Send files via email

- Multiline Tab Bar - Add a tab bar with multiple rows to &kate;'s main window

- Open Header - Opens the corresponding .h/[.cpp|.c] file

- Project Plugin - Project plugin for kate

- Python Plugins - &pate; host for Python plugins

- Search & Replace - Search or replace patterns in opened documents or in files on disk

- Snippets tool view - Tool view embedding the snippets management

- SQL Plugin - Execute query on SQL databases

- Symbol Viewer - Extract and show reference symbols from source

- Tab Bar - Adds a standard tab bar to &kate;'s main window

- Terminal tool view - Tool view embedding a terminal widget

- Text Filter - Easy text filtering

- &XML;Completetion - Lists &XML; elements, attributes, attribute values and entities allowed by DTD

- &XML; Validation- Validates &XML; files using xmllint

## Python &pate; Plugins

The &pate; Python Plugin host makes available many plugins written in the Python programming language.

To enable &pate; plugins, you must first enable the Python Plugins plugin in the Plugins page of &kate;'s configuration dialog. You may then enable, disable, and configure them in the Python Plugins page of the configuration dialog. For more information about configuring &pate; plugins, see .

### Available Plugins

block

  Plugins to help code editing

cmake_utils

  CMake helper plugin

color_tools

  Class encapsuling the ability to show color swatches (colored tooltips)

commentar

  Move an inlined comment before the current line with the same indentation level

django_utils

  Django utilities: Snippets, and template utilities

expand

  User-defined text expansions.

  Each text expansion is a simple function which must return a string. This string will be inserted into a document by the `expandAtCursor` action. For example, if you have a function foo in the `all.expand` file which is defined as:

      def foo:
        return 'Hello from foo!'

  after typing foo, the action will replace foo with Hello from foo!. The expansion function may have parameters as well. For example, the `text_x-c++src.expand` file contains the `cl` function which creates a class (or class template). This will expand cl(test) into:

      /**
       * \\brief Class \c test
       */
      class test
      {
      public:
          /// Default constructor
          explicit test()
          {
          }
          /// Destructor
          virtual ~test()
          {
          }
      };

  but cl(test, T1, T2, T3) will expand to:

      /**
       * \\brief Class \c test
       */
      template <typename T1, typename T2, typename T3>
      class test
      {
      public:
          /// Default constructor
          explicit test()
          {
          }
          /// Destructor
          virtual ~test()
          {
          }
      };

format

  Plugins to work with C++ code formatting

gid

  Browse the tokens in a GNU idutils ID file, and use it to navigate within a codebase.

  The necessary parts of the ID file are held in memory to allow sufficient performance for token completion, when looking up the usage of a token, or jumping to the definition. `etags(1)` is used to locate the definition.

js_utils

  JavaScript utilities: Autocomplete, Autocomplete jQuery, Checker JSLint, Pretty JSON, Snippets

python_autocomplete

  Python Autocompletion (beta, only for Python 2)

python_console_classic

  Interactive console for inspecting &kate;'s internals and playing about

python_console_ipython

  IPython console for hacking &kate; and doing science

python_utils

  Python Utilities: Parse Checker, PEP8 Checker, Pyflakes Checker, Snippets

xml_pretty

  A simple &XML; pretty printer. It formats &XML; with good indentation.

### Configuring &pate;

#### The Manager Tab

This tab contains a list of &pate; plugins. To enable or disable them, simply select or unselect the checkbox to the left of the plugin name.

To refresh the list of plugins, reload any currently running plugins, or start any newly selected plugins, select the Reload Plugins button at the bottom of the window.

Reloading a plugin may have unpredictable effects. Consider saving your work before using this command.

#### The Documentation Tab

The Documentation tab contains information about the actions, menu items, keyboard shortcuts, and configuration pages offered by &pate; plugins, as well as a reference for programmers using the functionality of the plugins.

The following tabs are available:

Actions

  Lists all the actions offered by the plugin, including the menu item, icon, and keyboard shortcut that will invoke the action.

Configuration Pages

  Lists all the configuration pages offered by the plugin, including their titles and icons.

Programmer's Reference

  Includes information about all the modules, classes, and functions offered by a plugin, as generated by `pydoc`.

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

## File Templates

The File Templates plugin allows you to create files based on other files.

When you first install &kate;, you need to enable the plugin:

1. Click Settings Configure &kate;

2. In the tree on the left of the screen, click Plugins.

3. In the Plugin Manager panel on the right, select File Templates, and then click OK.

You can now use any file as a template (this creates a copy of the file with an empty &URL;.) Special template files can contain macros to fill in information such as your name, email address, the current date, and position the cursor at a convenient position in the new file.

You can easily create a new template from an open document.

Templates that you save to the template folder are listed under the menu item File New from Template.

The template folder is part of the &kde; file system, and consists of at least

- `$`KDEDIR`/share/applications/kate/plugins/katefiletemplates/templates`

- `$`KDEHOME`/share/applications/kate/plugins/katefiletemplates/templates.`

If your `KDEDIRS` environment variable contains additional directories, those are searched for a similar subdirectory as well. If equally named templates are found, the one in the local (KDEHOME) folder is chosen.

### Menu Structure

File New From Template Any File...

  Presents you with an Open File dialog that allows you to use any file as a template. If the chosen file has the extension `katetemplate` it will be parsed for template information and macros.

File New From Template

  The remainder of submenus contain links to templates. Click a menu item to create a file as described by the menu item text.

Settings Manage Templates...

  This will launch a dialog with a list of all templates found within the template directories, along with options to add, edit or remove templates.

### Using a &kate; Template

When creating a file from a template that contains template macros, some macros appear as editable variables in the text. Such variables appear as underlined words in the text.

The first variable will be selected, so you just have to type to edit it. If the document text contains more instances of the same variable, they are changed as you edit. To move to the next editable variable, press the &Tab; key. When the last variable is edited, the list is dropped, and your &Tab; key works as normal.

### Creating your own templates

To create a new template, use the Settings Manage Templates Item to launch the template management dialog. In that, click New... to launch the File Template Wizard. You will be asked for an optional file to turn into a template and prompted for template information settings, and a template file will be created for you.

Alternatively, you can create a template manually by adding template information to the top of any file, add text and macros, and save it with the `katetemplate` extension.

The template menu is automatically updated if you chose to store your template in the template directory.

### Editing templates

To edit a template, use the Settings Manage Templates.... Select the template you want to work on and click Edit..., and the template file will be opened. Close the dialog, edit the template file as desired, save it and close it. Changes to templates take immediate effect; you can activate the template to test your changes after saving it.

### The &kate; Template Format

If you use files with the extension `katetemplate`, they will be parsed for template information, macros and a cursor position.

#### Template information

While reading in the file, the parser keeps lines beginning with the phrase `katetemplate:` and searches them for template information in the form VARIABLENAME=VALUE. The first line not starting with `katetemplate:` will be taken as the start of the template contents. VALUE may contain any character but equal sign (=). Legal variable names are:

`Template`

  This is the template name, displayed in the File New from Template menu.

`Group`

  The group places the template in a submenu of the File New from Template menu.

`Name`

  This is the name that will be set for the document, and displayed in the file list and title bar. If the name contains `%N` that will be replaced with a number, incrementing if more documents have the same name.

`Highlight`

  The plugin will try to set the Highlight for the new document to the value of this variable. The value should be the name, as found in Tools Highlighting .

`Description`

  A short informative description of the template. This is currently used to set a What's this? string for the menu item, but may be used for additional purposes in the future.

Author

  A string identifying the author, for example in the form `Name <email address>`. This is currently used to set a What's this? string for the menu item, but may be used for additional purposes in the future.

#### Template Macros

While parsing the template contents, macros in the form `%{NAME}` or `${NAME}` are expanded. If you use the `$` prefix, the expanded macro will be treated as a editable variable when a document is created from the template, whereas if you use `%` it is not, unless expanding failed.

The following macros are expanded:

`time`

  Expands to the current time in your locale format.

`date`

  Expands to the current date in short format.

`datetime`

  Expands to the current date and time, formatted as a string according to your locale.

`year`

  The current year as a four digit number.

`month`

  The full name of the current month, according to your locale.

`day`

  Expands to the current day of the month.

`hostname`

  Expands to the hostname of your computer.

`index`

  Expands to 'i'.

`fullname`

  Expands to your full name, as defined in the owner addressee in your standard &kde; addressbook.

`firstname`

  Expands to your first name, as defined in the owner addressee in your standard &kde; addressbook.

`lastname`

  Expands to your last name, as defined in the owner addressee in your standard &kde; addressbook.

email

  Expands to your email address, as defined in the owner address in your standard &kde; addressbook.

Any macro not in the above list is treated as an editable variable no matter the prefix. If the same variable occurs multiple times in the template, they can be edited at once after creating a document from the template.

#### Setting the cursor position

The special macro `${cursor}` will be replaced with a vertical bar and added to the end of the list of editable variables, independent of its location in the text.

### Thanks and Acknowledgments

&kate; Plugin File Templates copyright 2004 &Anders.Lund; &Anders.Lund.mail;.

Documentation copyright 2004 &Anders.Lund;

&Daniel.Naber; &Daniel.Naber.mail;

## &XML; Validation

This plugin checks &XML; files for validity and being well-formed.

This plugin checks the current file. A list of warnings and errors will appear at the bottom of &kate;'s main window. You can click on an error message to jump to the corresponding place in the file. If the file has a DOCTYPE the DTD given with this doctype will be used to check the file for validity. The DTD is expected at a position relative to the current file, &eg; if the doctype refers to DTD/xhtml1-transitional.dtd and the file is `/home/peter/test.xml` the DTD is expected to be located at `/home/peter/DTD/xhtml1-transitional.dtd`. However, remote DTDs specified via http are supported.

If the file has no doctype it will be checked for being well-formed.

To learn more about &XML; check out the official W3C &XML; pages.

Internally this plugin calls the external command `xmllint`, which is part of libxml2. If this command is not correctly installed on your system, the plugin will not work.

A temporary file needs to be written to the same folder as the file that is being checked is in, so you need to have write access to that folder.

To load this plugin open &kate;'s configuration dialog under Settings Configure &kate;.... Then select &XML; Validation which will appear in the Application / Plugins section and close the dialog.

### Menu Structure

&XML; Validate &XML;

  This will start the check, as described above.

### Thanks and Acknowledgments

&kate; Plugin &XML; Validation copyright 2002 &Daniel.Naber; &Daniel.Naber.mail;.

Documentation copyright 2002 &Daniel.Naber;

&Daniel.Naber; &Daniel.Naber.mail;

## &XML; Completion

This plugin gives hints about what is allowed at a certain position in an &XML; file, according to the file's DTD. It will list possible elements, attributes, attribute values or entities, depending on the cursor position (&eg; all entities are listed if the character on the left of the cursor is &). It's also possible to close the nearest open tag on the left.

The DTD must exist in &XML; format, as produced by the Perl program `dtdparse`. We will call a DTD in this format meta DTD. Some meta DTDs are supplied. They are installed in `$KDEDIR/share/apps/katexmltools/`, which is also the default folder when you choose Assign Meta DTD.... To produce your own meta DTDs, get `dtdparse` from http://dtdparse.sourceforge.net.

### How to Use

Start &kate; and open the configuration dialog under Settings Configure &kate;.... Then select &XML; Completion which will appear in the Application/Plugins section and close the dialog. After that, select &XML;Assign Meta DTD.... If your document contains no DOCTYPE or the doctype is unknown, you will have to select a meta DTD from the file system. Otherwise the meta DTD that matches the current document's DOCTYPE will be loaded automatically.

You can now use the plugin while typing your text:

< (less than key)

  This will trigger a list of possible elements unless the cursor is inside a tag already. Note that you currently cannot use this to insert the top level element (&eg; <html>).

</(less than key + slash)

  Entering these characters will offer to close the current element (nearest open one to the left of the cursor). Press &Enter; to accept the suggestion. Unlike the Close Element menu item, this works only with a DTD assigned.

" (quote key)

  The quote key will trigger a list of possible attribute values (if there are any) if you are inside a tag.

(space key)

  This key will trigger a list of possible attributes for the current element if you are inside a tag.

& (ampersand key)

  This key will trigger a list of named entities.

### Features and Limitations

You can test all functions and limitations by loading `$KDEDIR/share/apps/katexmltools/testcases.xml` into &kate; and following the instructions.

### Menu Structure

&Ctrl;Return &XML; Insert Element...

  This will open a dialog that lets you insert an &XML; element. The <, > characters and the closing tag will be inserted automatically. If you have selected text when this menu item is selected, the selected text will be surrounded by the opening and the closing tag. The dialog also offers completion of all elements that may be inserted at the current cursor position if you have assigned a meta DTD by using Assign Meta DTD....

&Ctrl;< &XML; Close Element

  This will search your text for a tag that is not yet closed and will close it by inserting the corresponding closing tag. The search starts at the cursor position and goes left. If it cannot find an open tag nothing will happen.

&XML; Assign Meta DTD...

  This will tell the plugin which meta DTD to use for the current document. Note that this assignment will not be saved. You will have to repeat it when you start &kate; the next time.

### Thanks and Acknowledgments

&kate; Plugin &XML; Completion copyright 2001,2002 &Daniel.Naber; &Daniel.Naber.mail;.

KDE SC 4 version copyright 2010 Tomáš Trnka

Documentation copyright 2001,2002 &Daniel.Naber;

## Exporter

### Menu Structure

File Export as &HTML;...

  Export your file in &HTML; format so your document can be viewed as a web page.

Edit Copy as &HTML;...

  Copies selected text with the syntax highlight as &HTML; text.

&TC.Hollingsworth; &TC.Hollingsworth.mail;

## Search & Replace

### Introduction

&kappname;'s Search & Replace plugin allows you to search for text or regular expressions in many different files at once. You can search all open files, all the files in one directory and optionally its subdirectories, or all files in the current project. You can even filter by filename, for instance searching only files that end with a particular file extension.

### Interface

#### Search Query

The following options are always displayed at the top of the Search in Files tool view:

New Tab

  You can have as many searches as you want open at the same time. Simply click the New Tab button at the top-left corner of the Search tool view and a new results tab will open permitting you to perform another search.

Toggle Results

  The down arrow in the top right-corner of the Search in Files tool view will toggle the bottom half of the tool view between displaying additional options for the Search in Folder mode and the results of your search.

Find

  This is where you type in what you want to find. You may enter standard text, or a regular expression if enabled.

Replace (text box)

  Replacement text that will be added to file(s) in place of the text in the Find text box.

Search

  When you've finished configuring everything, just press the Search button to perform your search. You may also press &Enter; in the Find text box to do the same.

Replace

  When you've finished configuring everything, just press the Replace button to replace the text entered in the Find text box with that of the Replace text box. You may also press &Enter; in the Replace text box to do the same.

Next

  Go to the next match of your search query, switching files if necessary.

Replace checked

  The same as Replace, but will only perform replacements in files that are checked in the pane below.

#### Search in Folder Options

These options are displayed below the aforementioned query options. If search results are being displayed instead, press the Toggle Results button to display them.

Match case

  Restricts search results to only those that have the exact same combination of upper and lower case letters as your search query.

Regular expressions

  Permits you to use regular expressions instead of simple text as your search query.

Expand results

  Display all the results found in each file, instead of just a list of files that contain the search query.

Search

  This has three options. Select in Open files to search all files currently open in &kappname;. Select in Folder to search inside a folder and optionally its subfolders. Select in Project to search all the files listed in the currently open project.

Folder

  You may enter the path of the folder you wish to search. For instance, you might enter `~/development/kde/kate/` if you wished to search the &kate; source code. This option is only available when using in Folder mode.

Open file dialog

  Press this button to locate the folder in your desktop's folder browser. This button only works when using in Folder mode.

Up

  Press this button to change Folder to the parent of the currently selected folder. This button only works when using in Folder mode.

Restore Current Folder

  This button will set the Folder entry to the folder in which the currently open document is located. This button only works when using in Folder mode.

Filter

  This permits you to only search filenames that match a particular pattern. For instance, to only search files written in C++, change it to `*.cpp`. To search only files beginning with `kate`, change it to `kate*`. You can enter multiple filters separated with a comma (`,`). This option is not available when using in Open files mode.

Exclude

  The opposite of Filter, this prevents &kappname; from searching files that match the specified patterns. As with Filter, you can enter multiple patterns separated with a comma (`,`). This option is not available when using in Open files mode.

Recursive

  If this option is enabled, &kappname; will also search in all subfolders of the selected folder. This option is only available when using in Folder mode.

Include hidden

  If this option is enabled, &kappname; will also search in files or folders that are typically hidden by your &OS;. This option is only available when using in Folder mode.

Follow symbolic links

  The Search in Files plugin typically doesn't follow symbolic links. When this option is enabled, the plugin will follow them instead and search inside the files or folders they reference. This option is only available when using in Folder mode.

  It's possible for symbolic links to reference a folder that is the parent of the folder currently being searched, or other folders that contain symbolic links to their parent. If there is such a link in the folder being searched and this option is enabled, &kappname; will repeatedly follow the link and search the folder, and the search will never complete.

Include binary files

  If enabled, &kappname; will also search in files that do not appear to be text files.

#### Search Results

The results of your search are displayed below the query options. If options for Search in Folder mode are displayed, simply press the Toggle Results button to display them. They will also automatically be displayed as soon as a search is performed.

The search results display a list of files that contains text that matches your search query, followed by the number of matches found in that file.

To see a list of matches in that file, simply click the expansion arrow to the left of the file name. (If you selected the Expand results option, this will already be done for you.) The line number each match is found on will be displayed, followed by the contents of that line, with your search query indicated in bold text.

To open the file your result was found in, simply double-click it. &kappname; will open the file if needed. You can also move the cursor to the location of a particular match by double-clicking on its listing instead of the file name.

### Menu Structure

Edit Search in Files

  Launches the Search and Replace tool view.

Edit Go to Next Match

  Go to the next match in a search performed by the Search and Replace plugin.

Edit Go to Previous Match

  Go to the previous match in a search performed by the Search and Replace plugin.

View Tool Views Show Search and Replace

  Toggle the display of &kappname;'s Search and Replace tool.

## Mail Files

### Menu Structure

File Mail...

  Open your mail client and attach the file in the mail.

## Filesystem Browser

The Filesystem Browser is a folder viewer, allowing you to open files from a displayed folder in the current frame.

### Menu Structure

View Tool Views Show Filesystem Browser

  Toggle the display of &kate;'s Filesystem Browser.

### Interface

From the top down, the Filesystem Browser consists of the following elements:

A Toolbar

  This contains standard navigations tool buttons:

  Back

    Causes the folder view to `cd` to the previously displayed folder in the history. This button is disabled, if there is no previous item.

  Forward

    Causes the folder view to `cd` to the next folder in the history. This button is disabled, if there is no next folder.

  Bookmarks

    Opens a submenu to edit or add bookmarks and to add a new bookmark folder.

  Current Document Folder

    This button will cause the folder view to `cd` to the folder of the currently active document if possible. This button is disabled, if the active document is a new, unsaved file, or the folder in which it resides can not be decided.

  Options
    Short View

      Displays only the filenames.

    Detailed View

      Displays Name, Date, Size and Type of the files.

    Tree View

      Like Short View, but folders can be expanded to view their contents.

    Detailed Tree View

      This also allows folders to be expanded, but displays the additional columns available in Detailed View.

    Show Hidden Files

      Displays files normally hidden by your &OS;.

    Automatically synchronize with current document

      When this option is enabled the filesystem browser will automatically `cd` to the folder of the document currently open in the editing area every time it changes.

A Location Entry

  This displays a breadcrumb navigation to the currently open folder, similarly to &dolphin;. You can click on a any folder to browse to it, or click on one of the arrows to the left of a folder to select any folders beneath it. You may also select from your list of Places by clicking the leftmost icon in the breadcrumb navigation, which displays an icon that represents your current Place.

  You can also click to the right of the breadcrumbs to change them to a text box where you can type the path of a folder to browse. The &URL; entry maintains a list of previously typed paths. To choose one, use the arrow button to the right of the entry.

  The &URL; entry has folder auto-completion. The completion method can be set using the &RMB; menu of the text entry.

A Folder View

  This is a standard &kde; folder view.

A Filter Entry

  The Filter entry allows you to enter a filter for the files displayed in the folder view. The filter uses standard globs; patterns must be separated by white space. Example: `*.cpp *.h *.moc`

  To display all files, enter a single asterisk `*`.

  The filter entry saves the last 10 filters entered between sessions. To use one, press the arrow button on the right of the entry and select the desired filter string. You can disable the filter by pressing the Clear text button to the left of the autocompletion arrow button.

### Configuration

This plugin can be configured on the Filesystem Browser page of &kate;'s configuration.

Toolbar

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

Salma
Sultana
&TC.Hollingsworth; &TC.Hollingsworth.mail;

## Build Plugin

### Introduction

The Build plugin allows you to run actions like build, clean and compile on a project.

### Using the Build Plugin

The Build plugin adds a Build Output tool view at the bottom and a Build menu on the menubar. The tool view can be used to configure build target settings, while the menu can be used to perform build, clean and compile actions.

The Build Output tool view has three tabs:

- Target Settings

- Output

- Errors & Warnings

#### Target Settings tab

The target settings tab can be used to configure various build targets.

Each target contains four configuration options:

Working Directory

  You can set the path to the project here. Leave this empty to use the directory the current document is located in.

Build

  This option lets you define the build command. It is set to `make` by default.

Clean

  The option lets you define the clean command. It is set to `make clean` by default.

Quick Compile

  This option lets you define the quick compile command. It is set to `gcc -Wall -g %f` by default.

One can create a new target by using the New button. The Copy button can be used to make a copy of an existing target. To delete a target, use the Delete button.

#### Output tab

The Output tab shows the console output generated by the last command.

#### Errors & Warnings

The Errors & Warnings tab lists the errors and warnings generated by the last command.

Each line contains a message and the file name and line number if available. Clicking on the error or warning takes you to the appropriate file and places the cursor on the corresponding line number.

There are Errors, Warnings, and Others buttons at the top that allow you to show or hide those categories of output.

To navigate to the previous error, press &Ctrl;&Alt;Left. To navigate to the next error, press &Ctrl;&Alt;Right.

### Menu Structure

Build Build

  Runs the Build command for the currently selected target.

Build Clean

  Runs the Clean command for the currently selected target.

Build Quick Compile

  Runs the Quick Compile command for the currently selected target.

&Ctrl;&Alt;Left Build Previous Error

  Moves the cursor to the location of the previous error in the document.

&Ctrl;&Alt;Right Build Next Error

  Moves the cursor to the location of the next error in the document.

Build Targets

  Select from a list of targets configured by the user.

Build Next Target

  Switch to the next target configured by the user.

### Thanks and Acknowledgments

The &kate; Build Plugin was written by Kåre Särs.

Special thanks to Google Code-In 2011 participant Salma Sultana for writing much of this section.

Ömer
Faruk
ORUÇ
&TC.Hollingsworth; &TC.Hollingsworth.mail;

## SQL Plugin

### Introduction

The Structured Query Language (SQL) is a specialized language for updating, deleting, and requesting information from databases.

The &kate; SQL Plugin allows you to:

- Create a database

- Connect to existing databases

- Insert and delete data in the database

- Execute queries

- Display results in a table

### Connecting to a Database

Select Add Connection from the SQL menu or toolbar, and then select the Qt database driver you want to use (including QSQLITE, QMYSQL3, QMYSQL, QODBC3, QODBC, QPSQL7, and QPSQL). If you can't see the desired driver, you need to install it. Then, press Next.

If the database you selected uses a file, simply indicate the database's location and press the Next button. If it requires connecting to a server, you must enter the hostname of the server, your username and password, and any other information that particular driver may require. Then press Next.

Finally, give a name to your connection, and press Finish.

### Running Queries

#### INSERT/DELETE/UPDATE

You can insert, delete, and update data using the SQL plugin just as you would from the command line or from within a program. Simply enter a query and press the Run query.

##### Some Example Queries

`INSERT`

      INSERT INTO table_name ("feature1", "feature2", "feature3", "feature4", "feature5")
      VALUES ("value1", "value2", "value3", "value4", "value5" )

`DELETE`

      DELETE FROM table_name WHERE name = "text"

`UPDATE`

      UPDATE table_name SET "feature1" = "text", "feature2" = "text", "feature3" = "text", "feature4" = "text", "feature5" = "text"

#### SELECT

After running a `SELECT` query, you can view the results as a table that will appear in the SQL Data Output tool view at the bottom of &kappname;, or as text in the SQL Text Output. If there is an error, you can see it in the text output.

##### Example `SELECT` Query

    SELECT * FROM table_name

In the SQL Data Output tool view, there are several buttons:

Resize columns to contents

  Changes the size of columns to fit their contents.

Resize rows to contents

  Changes the size of rows to fit their contents.

Copy

  Selects all of the table contents and copies it to the clipboard buffer.

Export

  Exports all of the table contents to a file, the clipboard, or the current document in the Comma Separated Values format.

Clear

  Removes everything from the table view

You can now change the colors displayed in the table in the SQL section of Settings Configure &kate; .

### Browsing

You can browse your database using the SQL Schema Browser tool view on the left. The information displayed varies depending on which database driver you are using.

To refresh this list, right-click anywhere in the tool view and select Refresh. To generate a query on any entry in the list, right-click on an entry, select Generate, and select the query type (SELECT, UPDATE, INSERT, or DELETE) from the submenu that appears.

### Menu Structure

SQL Add connection...

  Adds a new connection using any database driver.

SQL Remove connection

  Removes the selected connection.

SQL Edit connection...

  Edits the current connection's settings.

Connections

  All database connections you have created are listed between the Edit connection and Run query menu items. Select one to run queries or make modifications to it.

&Ctrl;E SQL Run query

  Runs your query.

### Thanks and Acknowledgments

The SQL Plugin was written by Marco Mentasti.

Special thanks to Google Code-In 2011 participant Ömer Faruk ORUÇ for writing much of this section.

Martin
Gergov
&TC.Hollingsworth; &TC.Hollingsworth.mail;

## &gdb; Plugin

### Introduction

&kappname;'s &gdb; plugin provides a simple frontend to the popular &GNU; Project Debugger.

Previous experience with &gdb; is strongly recommended. For more information on using &gdb;, visit the &gdb; website.

You can enable the &gdb; plugin in the Plugins section of &kappname;'s configuration.

For the plugin to work properly, you must have a source file (of any type supported by &gdb;) and an executable.

If you compile using &gcc;/`g++` you might want to use the ``-ggdb`` command line argument.

After these preparations are made, open the source file in &kappname;, enter the path to the executable in the Settings tab of the Debug View tool view, and select Debug Start Debugging from the menu to get started.

### Menu and Toolbar Structure

All of these options are available in &kappname;'s menus, and many are available on the Debug toolbar as well.

View Tool View Show Debug View

  Shows a tool view containing &gdb; output, the &gdb; command line used, and other settings.

View Tool View Show Locals

  Shows a list of all currently loaded variables and their values.

View Tool View Show Call Stack

  Shows a &gdb; backtrace.

Debug Targets

  A submenu containing a list of targets (executables).

Debug Arg Lists

  A submenu containing all argument lists.

Debug Start Debugging

  Starts &gdb; with a target.

Debug Kill / Stop Debugging

  Stops &gdb;.

Debug Restart Debugging

  Restarts &gdb;.

Debug Toggle Breakpoint / Break

  Set a breakpoint at the current cursor position.

Debug Step In

  Execute the present statement (function call will be debugged).

Debug Step Over

  Execute the present statement (function call will not be debugged).

Debug Step Out

  Resumes execution until the program that is executing terminates.

Debug Move PC

  Move program counter (next execution).

Debug Run To Cursor

  Runs the program until it reaches current cursor position.

Debug Continue

  Ignores any breakpoints and executes program until it terminates (successfully or not).

Debug Print Value

  Prints the value of the variable that the cursor is currently pointing to.

Settings Toolbars Shown&gdb; Plugin

  Display the debugging toolbar.

### Debug View

The Debug View tool view consists of several tabs:

&gdb; Output

  Contains output from &gdb; and a &gdb; command line.

  The Output Tab
  The Output tab.

  The Output tab displaying the output from a debugging session.

Settings
  Target

    Path to the target (executable) for debugging.

  Working Directory

    The current working directory provided to the target.

  Arg List

    Arguments passed to the program.

  Keep focus

    Keeps focus on the &gdb; command line.

  Redirect IO

    Opens a new IO tab in the Debug View where you can view output and provide input to the running program.

  The Settings Tab
  The Settings tab.

  The Settings tab displaying the configuration of a debugging session.

IO

  Contains an area that displays output from the running program and a command line where you may provide input to it.

  The IO Tab
  The IO tab.

  The IO tab displaying output from a simple test program.

### Call Stack and Locals

The Call Stack tool view contains a list of the formatted backtrace returned from &gdb;.

The &gdb; Call Stack Tool View
The Call Stack tool view.

The &gdb; Plugin's Call Stack tool view.

The Locals tool view contains a list of all currently loaded variables from the program and their corresponding values.

The &gdb; Locals Tool View
The Locals tool view.

The &gdb; Plugin's Locals tool view.

### Thanks and Acknowledgments

Special thanks to Google Code-In 2011 participant Martin Gergov for writing much of this section.

## Terminal Tool View Plugin

The built in Terminal Emulator is a copy of the &kde; &konsole; terminal application, for your convenience. It is available from the View Tool Views Show Terminal menu item and will get the focus whenever displayed. Additionally, if the Automatically synchronize the terminal with the current document when possible option is enabled, it will change to the directory of the current document if possible when it is displayed, or when the current document changes.

The default location in the &kate; window is at the bottom, below the editing area.

You can configure the &konsole; using its &RMB; menu, for more information, see the &konsole; manual.

The built-in terminal emulator is provided by the Terminal Tool View plugin, which is enabled by default.

### Menu Structure

View Tool Views Show Terminal

  Toggles the display of the built-in terminal emulator.

  When activated for the first time, the terminal will be created.

  When the terminal emulator is displayed, it will get the focus, so that you can start typing in commands immediately. If the Automatically synchronize the terminal with the current document when possible option is enabled in the Terminal page of the Main configuration dialog the shell session will change to the directory of the active document, if it is a local file.

Tools Pipe to Terminal

  Feed the currently selected text into the built-in terminal emulator. No newline is added after the text.

Tools Synchronize Terminal with Current Document

  This will cause the built-in Terminal to `cd` into the directory of the active document.

  Alternatively, you can configure &kappname; to always keep the terminal in sync with the current document. See for more information.

Tools Focus/Defocus Terminal

  Switch the focus from the current document to the terminal and vice versa.

### Configuration

You can configure the Terminal Tool View plugin on the Terminal page of the configuration dialog.

The following options are available:

Automatically synchronize the terminal with the current document when possible

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

Set EDITOR environment variable to 'kate -b'

  This sets the `EDITOR` environment variable so programs run in the built-in terminal that automatically open a file in an editor will open them in &kate; instead of the default editor configured in your shell. You will not be able to continue using the terminal until you have closed the file in &kate;, so the calling program is aware you have finished editing the file.