Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

ped

Photon editor

Syntax:

ped [-adfr] [-c function] [-g line]
    [-h height[%]] [-l locale] [-p filespec]
    [-S i|m|n] [-s server] [-t space]
    [-w width[%]] [-x position[%][r]]
    [-y position[%][r]]

Runs on:

Neutrino

Options:

-a
Save and load files with attributes (special fonts, bold, italic, etc.).
-c function
Go to the specified function after loading.
-d
Use the default locale list, which provides the following locales:
-f
Forces soft newlines due to wrapping to be saved as hard newlines.
-g line
Go to the specified line after loading.
-h height[%]
The height of the window, in pixels, or as a percentage of the screen height if % is specified.
-l locale
Use the given locale to encode and decode when loading and saving files. The default is “C” for English and UTF-2.
-p filespec
Use this default file specification pattern in the save/open/load file selector.
-r
Open the file in read-only (View) mode
-Si|m|n
The initial state of the main window (iconified, maximized, or normal).
-s server_name
The name of the Photon server:
If server_name is: This server is used:
node_path node_path/dev/photon
fullpath fullpath
relative_path /dev/relative_path
-t space
Set tab stop spacing.
-w width[%]
The width of the window, in pixels, or as a percentage of the screen width if % is specified.
-x position[%][r]
The x coordinate of the upper-left corner of the window, in pixels, or as a percentage of screen width if % is specified. If r is specified, the coordinate is relative to the current console.
-y position[%][r]
The y coordinate of the upper-left corner of the window, in pixels, or as a percentage of screen height if % is specified. If r is specified, the coordinate is relative to the current console.

Description:

The ped application is a simple editor designed to support Unicode (UTF-8) formatted files only. It also provides simple search and replace capabilities.


Editing with ped


Editing with ped.

The name and path of the file opened in the editor appear in the top window frame. At the bottom of the window, the line and column indicators as well as the filename (no path) appear.


Caution: Depending on the preferences you set, ped might append a block of text to the end of your files, which might upset any applications that read the files. With the default preferences, ped doesn't write this block. You can control this behavior by choosing Preferences from the Edit menu and setting the options in the Styles & Markers tab.

The font button in the top right corner indicates the current font of the text at the cursor position. Clicking on this button is the same as selecting the Font option from the Type menu (Ctrl-Alt-F). The colored rectangle beside the text field indicates the text color at the current cursor position. Clicking on this rectangle is the same as selecting the Color option from the Type menu (Ctrl-Alt-C).

You can use the following mouse shortcuts to select text:

If you want to: Do this:
Position the cursor Single-click
Select the word under the cursor Double-click or
Alt-click
Select the current line Triple-click
Select the current paragraph Quadruple-click
Select all Quintuple-click
Extend the highlighted region Shift-click
Select text Hold down the left mouse button and drag.
Copy selected range to clipboard While holding down the left mouse button, press the right mouse button.

You can use keyboard commands to select, copy, paste, and format text, as well as select items from the menu.

Cursor movement commands

If you hold down the Shift key when using any of the following cursor movements, all of the text covered by that movement is highlighted.

If you want to move: Press:
The cursor one position in the direction of the arrow ↑, ↓, ←, →
To the beginning of the line Home
To the beginning of the document Ctrl-Home
To the end of the line End
To the end of the document Ctrl-End
Up one page Page Up
Down one page Page Down
Forward one word Ctrl
Back one word Ctrl
Find the matching brace or quote for “( )”, “{ }”, “[ ]”, single quote, or double quotes F10

Note: Matching quotes are searched in the forward direction only.

Deletion commands

If you want to delete: Press:
The line Ctrl-U
To the end of the line Ctrl-K
The character to the right of the cursor position Delete
The character to the left of the cursor position Backspace
Selected text Any key that deletes or inserts text.

When you have text selected for deletion, any key that types or deletes text replaces the selected text. The deleted text is moved to the clipboard until it's replaced by the next deletion or explicit clipboard loading operation.

Formatting commands

To format text as: Press:
Bold Alt-B
Italic Alt-I

If text is selected, only the selected text is formatted. If no text is selected, begin to format text when typed.

Centering commands

To align the text: Press: Description:
Left margin Alt-L Align the line of text that the cursor is on to the left margin.
Center Alt-C Center the line that the cursor is on.
Right margin Alt-R Align the line of text that the cursor is on to the right margin.

Clipboard commands

If you want to: Press:
Copy selected text to the clipboard. Ctrl-C
Move selected text to the clipboard (and delete the selected text). Ctrl-X or
Ctrl-Alt-X
Delete the current line. Ctrl-U
Paste the clipboard text at the current cursor position. Ctrl-V or
Ctrl-Alt-V

Note: When you're in overwrite mode, each character you type gets saved to the clipboard.

If a paste replaces text, the replaced text is moved to the clipboard.

Special commands

If you want to: Press: Description:
Invoke Helpviewer Ctrl-Alt-H Searches for the selected text in Helpviewer.

File menu operations

Menu item: Hotkey: Description:
File menu Alt-F Displays the File drop-down menu.
New Ctrl-N or Alt-F-N Clears the current buffer and filename after you confirm the action.
Open Ctrl-O or Alt-F-O Opens a new buffer, replacing the current buffer after you confirm the action.
Save Ctrl-S or Alt-F-S Saves the current buffer to the current filename.
Save As Ctrl-A or Alt-F-A Saves the current buffer to a specified filename.
Print Ctrl-P or Alt-F-P Prints the file.
Exit Alt-X or Alt-F-X Exits after you confirm the action (if changes to current buffer haven't been saved).

Note: You can also open a file by dragging it from a pfm window and dropping it into ped. Each dragged file is opened as a new buffer.

Search menu operations

Menu item: Hotkey: Description:
Search menu Alt-S Displays the Search drop-down menu.
Find Ctrl-F or Alt-S-F Finds the next occurrence of the specified string.
Search & Replace Ctrl-R or Alt-S-R Finds the next occurrence of the search string and replaces it with the replace string.
Search & Replace F2 Searches for the text that was last entered as the search string.
Search & Replace F3 Replaces the selected text with the “replace” text and repeats the search.
Goto Line Ctrl-G or Alt-S-G Goes to the specified line.

When the Find dialog is displayed, Enter finds the next occurrence when the search field has focus. F2 repeats the search; the search window doesn't have to be in focus or even open.

When the Search and Replace dialog is displayed, Enter repeats the operation while the Replace field has focus. F2 finds the next occurrence of the search string. F3 replaces the currently selected text, then finds and highlights the next instance of the search string. Esc closes the Search window.

Options menu operations

You use this dialog to change the defaults and the file encoding operations.

Menu item: Hotkey: Description:
Options menu Alt-O Displays the Options drop-down menu.
Defaults Ctrl-D or Alt-O-D Brings up a dialog for configuring the default configuration for ped sessions.
Encoding Ctrl-E or Alt-O-E Selects the encoding to use as a filter for the file being loaded or saved.

With the Defaults dialog, you can set the default for background color, text color, font, tab size, text wrap, auto indent, and the file specification to use when bringing up load/save dialogs.

In addition, there's a control that dictates whether or not attribute information is preserved when loading or saving files. (The attributes are saved in a C-style comment at the end of the file if this option is enabled.) The attribute information is saved to .ph/pedrc.

The background and text colors are applied (updated) immediately when a color is selected so that you can see the change without leaving the dialog box.

The specified encoding is assumed on the file. When the file is loaded, it's converted to UTF-8. When the file is saved, it's converted from UTF-8. (The editor works with UTF-8 encoded Unicode text internally.)


Note: If the current encoding selection of the editor doesn't match a file being loaded, the file will likely fail to load in its entirety. You'll have to select a new translation and try to load the file again. To translate a file from one encoding to another:
  1. Select the current file encoding.
  2. Load the file (translate using the selected translation to UTF-8).
  3. Select the desired encoding.
  4. Save the file (translate from UTF-8 using the new translation during the save).

Type menu operations

Menu item: Hotkey: Description:
Type menu Alt-T Displays the Type drop-down menu.
Font Ctrl-Alt-F or Alt-T-F Opens the font selection dialog.
Color Ctrl-Alt-C or Alt-T-C Opens the color selector.

In the Font dialog, you can choose the font (typeface, style, and size) for the selected range. The selected font is used to modify the selected text range. If there's no selected text range, the selected font is used for the next text entered. (The font buttons indicate the typeface and style of the text that's inserted whenever text is entered at the current cursor location.)

In the Color dialog, you can choose the text color for the selected range. This dialog lets you select a foreground color for the selected text range. If there's no selected text range, the selected color is used for the next text entered. (The color button always indicates the color of text that's to be inserted when text is entered at the current cursor location.)

Examples:

Run ped using the Photon server on node my_node:

ped -s/net/my_node/dev/photon

Run ped at initial position (10,10) with initial dimension of 200×300:

ped -x10 -y10 -h200 -w300

Edit a plain text file encoded in Japanese Shift-JIS.

ped -a -l ja_JP.sjis

Files:

${HOME}/.ph/pedrc
User's configuration file.

See also:

ed, elvis, qed, vi

Using Editors in the Neutrino User's Guide