# The &kwrite; Handbook

&Thad.McGinnis; &Thad.McGinnis.mail;
&Christoph.Cullmann; &Christoph.Cullmann.mail;
&Lauri.Watts; &Lauri.Watts.mail;
2000 2001 &Thad.McGinnis;
&FDLNotice;
2004-08-27
2.00.00

&kwrite; is a text editor for &kde;

KDE KWrite text editor

## Introduction

&kwrite; is more than a text editor for the &kde; Desktop. It is meant to be a programmer's editor, and could be considered as at least a partial alternative to more powerful editors. It may be best used in conjunction with &konqueror; for source file browsing for different languages. &kwrite; also works very well as a simple text editor. One of &kwrite;'s main features is the colorized syntax, customized for many different programming languages such as: C/C++, &Java;, Python, Perl, Bash, Modula 2, HTML, and Ada.

## Some Fundamentals

&kwrite; is very simple to use. Anyone that has used a text editor should have no problems.

### Drag and Drop

&kwrite; uses the &kde; Drag and Drop protocol. Files may be dragged and dropped onto &kwrite; from the Desktop, &konqueror; or some remote &FTP; site opened in one of &konqueror;'s windows.

### Command Line Options

Though &kwrite; may most often be started from the KDE program menu, or a desktop icon, it can also be opened at the command line prompt of a terminal window. There are a few useful options that are available when doing this.

#### Specify a File

By specifying the path and name of a particular file the user can have &kwrite; open (or create) that file immediately upon startup. This option might look something like the following:

    % kwrite
    /home/myhome/docs/myfile.txt

#### Specify a file on the internet

The above-mentioned method could even be used to open files on the internet (if the user has an active connection at the time.) An example of this might look like the following:

    % kwrite
    ftp://ftp.kde.org/pub/kde/Welcome.msg

#### Other Command Line Options

The following command line help options are available

``kwrite` `--help``

  This lists the most basic options available at the command line.

``kwrite` `--help-qt``

  This lists the options available for changing the way &kwrite; interacts with &Qt;.

``kwrite` `--help-kde``

  This lists the options available for changing the way &kwrite; interacts with &kde;.

``kwrite` `--help-all``

  This lists all of the command line options.

``kwrite` `--author``

  Lists &kwrite;'s authors in the terminal window

``kwrite` `--version``

  Lists version information for &Qt;, &kde;, and &kwrite;. Also available through ``kwrite` `-V``

### Key Bindings

Many of the key bindings (shortcuts) are configurable by way of the Settings menu. By default &kwrite; honors the following key bindings.

Insert | 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.
Left Arrow | Move the cursor one character to the left
Right Arrow | Move the cursor one character to the right
Up Arrow | Move the cursor up one line
Down Arrow | Move the cursor down one line
Page Up | Move the cursor up one page
Page Down | Move the cursor down one page
Backspace | Delete the character to the left of the cursor
Home | Move the cursor to the beginning of the line
End | Move the cursor to the end of the line
Delete | Delete the character to the right of the cursor (or any selected text)
&Shift;Left Arrow | Mark text one character to the left
&Shift;Right Arrow | Mark text one character to the right
F1 | Help
&Shift;F1 | What's this?
&Ctrl;F | Find
F3 | Find again
&Ctrl;C | Copy the marked text to the clipboard.
&Ctrl;B | Set a Bookmark
&Ctrl;N | New document
&Ctrl;P | Print
&Ctrl;Q | Quit - close active copy of editor
&Ctrl;R | Replace
&Ctrl;S | Invokes the Save command.
&Ctrl;V | Paste the clipboard text into line edit.
&Ctrl;X | Delete the marked text and copy it to the clipboard.
&Ctrl;Z | Undo
&Ctrl;&Shift;Z | Redo

## The Menu Entries

### The File Menu

&Ctrl;N File New

  This starts a new Document in the editor. If there is a current document with unsaved changes the user is given a chance to save it.

&Ctrl;O File Open...

  Displays a standard &kde; Open File dialog. Use the file view to select the file you want to open, and click on Open to open it. You can find more information about the &kde; Open File dialog in the &kde; User Guide.

File Open Recent

  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 &kwrite; - if the file still resides at the same location.

&Ctrl;S File Save

  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.

File Save As...

  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 Open section of this help file.

&Ctrl;P File Print...

  Opens a simple print dialog allowing the user to specify what, where, and how to print

&Ctrl;Q File Quit

  This will close the editor window, if you have more than one instance of &kwrite; running, through the New View or New Window menu items, those instances will not be closed.

### The Edit Menu

&Ctrl;Z Edit Undo

  This is used to eliminate or reverse the most recent user action or operation.

&Ctrl;&Shift;Z Edit Redo

  This will reverse the most recent change (if any) made using Undo

&Ctrl;X Edit Cut

  This command deletes the current selection and places it on the clipboard. The clipboard is a feature of KDE that works invisibly to provide a way to transfer data between applications.

&Ctrl;C Edit Copy

  This copies the currently selected text to the clipboard so that it may be pasted elsewhere. The clipboard is a feature of KDE that works invisibly to provide a way to transfer data between applications.

&Ctrl;V Edit Paste

  This will insert the contents of the clipboard at the cursor position. The clipboard is feature of KDE that works invisibly to provide a way to transfer data between applications.

&Ctrl;A Edit Select All

  This will select the entire document. This could be very useful for copying the entire file to another application.

&Ctrl;G Edit Go to line

  This opens the goto line dialog box 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. There is also a slide control to the right of the text box which allows the user to move the goto point in the document in an analog manner.

&Ctrl;F Edit Find

  This opens the find dialog which is used to specify the Text to Find in the document. There is small text box for entering the search pattern which also doubles as a dropdown box. Clicking on the dropdown arrow at the side of the box makes available other recent search patterns. Other parameters are included to make the search more efficient. Selecting Case Sensitive will limit finds to entries that match the case (upper or lower) of each of the characters in the search pattern. Find Backwards directs the search to proceed in an upwardly direction. The Selected Text option keeps the search within currently selected text. Checking Whole Words Only prevents the search from stopping on words that contain the searched for pattern. The Search from Cursor option begins the search from the current position of the cursor within the document rather than from the beginning.

F3 Edit Find Next

  This repeats the last find operation, if any, without calling the find dialog box.

&Shift;F3 Edit Find Previous

  This repeats the last find operation, if any, without calling the find dialog box, and searching backwards instead of forwards through the document.

&Ctrl;R Edit Replace

  This command opens the replace dialog box. The replace dialog is almost identical to the above-mentioned find dialog. In addition to the features in the find dialog it contains a Replace With: text entry/dropdown box. Using this dialog the user can specify both the text to be found and text with which to replace it. The additional Prompt On Replace option allows the user to have &kwrite; ask for confirmation before each replacement.

### The Bookmarks Menu

Bookmarks Clear All Bookmarks

  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.

At the bottom of this menu, a list of markers appears if any markers are available for this window.

### The Tools Menu

Tools Spelling...

  This initiates the spell checking program - a program designed to help the user catch and correct any spelling errors. 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:

  Unknown word:

    Here, the spell checker 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.

  Replace with:

    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.

  Suggested Words:

    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 Replacement: box, above.

  Language:

    If you have installed multiple dictionaries, here you can select which dictionary/language should be used.

  On the right side of the dialog box are 5 buttons that allow the user to control the spell check process. They are:

  Add to Dictionary

    Pressing this button adds the word in the Misspelled Word: box to the checker's dictionary. This means that in the future the checker will always consider this word to be correctly spelled.

  Replace

    This button has the checker replace the word under consideration in the document with the word in the Replacement: box.

  Replace All

    This button causes the checker to replace not only the current Unknown word: but to automatically make the same substitution for any other occurrences of this Misspelled Word: in the document.

  Ignore

    Activating this button will have the checker move on without making any changes.

  Ignore All

    This button tells the checker to do nothing with the current Unknown word: and to pass over any other instances of the same word.

    This only applies to the current spell check run. If the checker is run again later it will stop on this same word.

  Three more buttons are located horizontally along the bottom of the spell check dialog. They are:

  Help

    This invokes the KDE help system starting at the &kwrite; help pages (this document).

  Finished

    This button ends the spell check process, and returns to the document.

  Cancel

    This button cancels the spell check process, all modifications are reverted, and you will return to your document.

  &Ctrl;I Tools Indent

    This increases the paragraph's indentation by one step. The size of the step depends on the indentation settings.

  &Ctrl;&Shift;I Tools Unindent

    This reduces the paragraph's indentation by one step. The size of the step depends on the indentation settings.

  Tools Clean Indentation

    Not yet implemented

  &Ctrl;D Tools Comment

    This adds one space to the beginning of the line where the text cursor is located or to the beginning of any selected lines.

  &Ctrl;&Shift;D Tools Uncomment

    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.

### The Settings Menu

Settings Show Toolbar

  When checked, this displays a movable toolbar containing buttons used to initiate frequently used commands. When unchecked the toolbar is hidden.

Settings Show Statusbar

  When checked, this displays a small bar at the bottom of the editor containing information about the status of the current document. When unchecked the statusbar is hidden.

Settings Show Path

  When selected, this displays in the title bar the path (its location in the file system) of the current document. When unchecked the path is hidden.

Settings Configure Editor...

  This menu item opens a dialog whereby several different settings may be adjusted.

Settings Configure Shortcuts...

  This command opens a dialog box whereby the key bindings may be changed. A display window at the top of the dialog box shows the list of commands (actions) that can have keyboard shortcuts. Below the display are three radio buttons. The user may choose between No Key, Default Key, and Custom Key. (Note that a set of radio buttons only allows the selection of one of the offered items - in the way that buttons on a car radio only offer the selection of one preset station. Also, the Default Key selection is only available for those commands that actually have a 'default' shortcut.) Selecting the Custom Key option activates the three check boxes and key button at the bottom of the dialog. The user may then select a key combination for the command in question by means of the check boxes and key button. For example, with the About KDE command selected in the display window, the user could select &Ctrl; and Alt, click on the key button, and then press the K key on the keyboard. This would mean that anytime he or she held down the &Ctrl; and Alt buttons and pressed K (while using &kwrite;) the About KDE display box would be called.

Settings Configure Toolbars...

  This will open the dialog whereby the toolbar configuration may be changed. The user can choose which shortcut buttons should appear on the toolbar. A display window on the left lists the commands available to placed on the toolbar. A display on the right lists those commands already on the toolbar. A set of four arrow buttons between the two displays manipulates the selections. The right pointing arrow places any command selected in the left pane onto the right pane, i.e., it is added to the toolbar. The left arrow does just the opposite, removing any action selected in the right window from the toolbar. The up and down pointing arrows change the position of an action selected in the right window which changes the position of its button in the toolbar.

### The Help Menu

&help.menu.documentation;

## Configure &kwrite;

Selecting Settings Configure Editor from the menu brings up the Configure Editor 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.

She or he may invoke the Help system, accept the current settings and close the dialog by means of the OK button, or Cancel the process. The categories Colors, Fonts Indent, Select, Edit, Spelling and Highlighting are detailed below.

### Colors

This section provides access to two different color settings, described below. Each of these settings may be changed by clicking on its corresponding button. These are special wide buttons that are the color of the current setting. Clicking on one of the buttons calls a special color dialog box used to change the setting.

The color dialog box provides a convenient and graphical way to select a color. In the upper left of the box is a rectangular display of a spectrum of colors. To the immediate right of this, is vertical bar displaying a range of intensity from the most dark at the bottom to the most light at the top. The user may select and adjust a color by clicking in these two boxes. Clicking in the rectangular display selects a particular mix of red, green, and blue colors and in the vertical bar selects a level of intensity (value). The various color attributes are displayed in numerical form in small text boxes located directly below the spectral rectangle and the user can see them change as the color is adjusted. These attributes include the mix of the basic color components (red, green, and blue) as well as hue and saturation levels. Alternatively the user can enter figures directly in these boxes. There is also a square at the bottom center of the dialog box which displays the color which is under consideration at any time. To the right of this display is another text box labeled HTML: This shows the user the color code that would be used to specify the particular displayed color in HTML code which is widely used for web pages.

In addition to the above, the color dialog allows the capture of any color currently displayed on the desktop or in another program. Clicking on the button with the dropper icon (located on the right side of the dialog box,) changes the shape of the mouse cursor to a set of crosshairs. Clicking again will pick up the color attributes of whatever color is displayed under the cross hairs.

Furthermore the user has the option of adding any color to a personal palette of Custom Colors by clicking on the wide button labeled Add to Custom Colors (which is located directly above the display square.) This adds the current color to the custom color palette. This palette and any other available palettes can be displayed using the drop down selection box located directly above the palette display at the top right of the dialog box. Besides the custom colors, the user can access a number of pre-prepared palettes.

Background

  Here the user can specify a color for the general background of &kwrite;.

Selected

  This allows the user to select a color to be used for indicating selected (or highlighted) portions of the document.

### Fonts

Here you can choose the default font for &kwrite;. You can choose from any font available on your system, and set a default size and encoding. A sample text displays at the bottom of the dialog, so you can see the effect of your choices.

### Indent

Auto Indent

  This causes new lines to begin with the same indentation level as the previous line.

Indent With Spaces

  This replaces tabs with the number of spaces selected in the Tab Width window in the Edit section of the preferences dialog.

Backspace Key Indents

  This allows the backspace key to be used to indent.

Tab Key Indents

  This allows the tab key to be used to indent.

Keep Extra Spaces

  Indentations of more than the selected number of spaces will not be shortened.

### Edit

Static Word Wrap

  Word wrap is a feature that causes the editor to automatically start a new line of text and move (wrap) the cursor to the beginning of that new line. &kwrite; will automatically start a new line of text when the current line reaches the length specified by the Wrap Words At: option.

Wrap Words At:

  If the Word Wrap option is selected this entry determines the length (in characters) at which the editor will automatically start a new line.

Replace Tabs By Spaces

  &kwrite; will replace any tabs with the number of spaces indicated in the Tab Width: entry.

Tab Width

  If the Replace Tabs By Spaces option is selected this entry determines the number of spaces with which the editor will automatically replace tabs.

Remove Trailing Spaces

  &kwrite; will automatically eliminate extra spaces at the ends of lines of text.

Auto Brackets

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

Show Tabs

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

Page Up/Down Moves Cursor

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

Wrap Cursor

  When this option is chosen, moving the cursor with the arrow keys off the end of a line (to the right) causes it to jump down to the beginning of the next line. Likewise when the cursor is moved past the beginning of a line (to the left) it jumps up to the end of the preceding line. When this option is not selected, moving the cursor right past the end of a line merely causes it to continue horizontally in the same line and trying to move it left past the beginning does nothing.

  When this option is chosen, clicking with the mouse past the end of a line of text will place the insert cursor at the end of the text, and not in the place you clicked. This avoids accidentally adding an empty space in the middle of text, and is the default behavior of most editors.

Undo steps:

  Here the user may specify the number of steps &kwrite; will retain in memory for purposes of undoing entries and actions. This means that the higher the number of steps set the more memory &kwrite; will use for this. Setting this entry to 10 would mean that the user would be be able reverse the last ten operations, i.e. click the undo button 10 times and obtain results.

### Spelling

A spell checker is a program designed to help the user catch and correct any spelling errors. This section of the preferences dialog allows certain important settings to be adjusted in this regard.

Create root/affix combinations not in dictionary

  Selecting this option allows the spell checker to register as 'correct' combinations of root words with suffixes or prefixes even if the particular combination is not listed in its dictionary data base of words.

Consider run-together words as spelling errors

  Selecting this will cause the spell checker to register as 'misspelled' two or more correctly spelled words that are 'run-together', i.e., that do not have spaces separating them.

Dictionary:

  Depending on the user's installation one or more different language spelling dictionaries may be available. This drop down box allows the user to choose which language the spell checker should use.

Encoding:

  There are different coding systems used to associate particular codes with particular characters and symbols. If the user knows which code he or she is using this drop down box allows this code to be specified so that the spell checker can do its job correctly.

Client:

  Since &kwrite; does not contain its own spell checker, an external one must be chosen. This is where the user may specify which spell check program to use.

## Credits and Licenses

&kwrite; Copyright 2001 by the &kate; team.

Based on the original &kwrite;, which was Copyright 2000 by Jochen Wilhelmy digisnap@cs.tu-berlin.de

Contributions:

- &Christoph.Cullmann; &Christoph.Cullmann.mail;

- Michael Bartl michael.bartl1@chello.at

- Phlip phlip_cpp@my-deja.com

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

- Matt Newell newellm@proaxis.com

- &Joseph.Wenninger; &Joseph.Wenninger.mail;

- Jochen Wilhely digisnap@cs.tu-berlin.de

- &Michael.Koch; &Michael.Koch.mail;

- &Christian.Gebauer; &Christian.Gebauer.mail;

- &Simon.Hausmann; &Simon.Hausmann.mail;

- Glen Parker glenebob@nwlink.com

- Scott Manson sdmanson@altel.net

- &John.Firebaugh; &John.Firebaugh.mail;

Original documentation by &Thad.McGinnis; &Thad.McGinnis.mail;

This version of the &kwrite; Handbook is based on the original by &Cristian.Tibirna; &Cristian.Tibirna.mail;

Converted to docbook/proofreading by &Lauri.Watts; &Lauri.Watts.mail;

&underFDL; &underGPL;
&documentation.index;