Caution: This version of this document is no longer maintained. For the latest documentation, see

Using Editors

This chapter includes:

Choosing an editor

An editor is a utility designed to view and modify files. Editors don't apply any persistent formatting to viewed text, although many use colors or styles to provide additional contextual information, such as type information in source code files. For example, if you're editing C code, some editors use different colors to indicate keywords, strings, numbers, and so on.

Which editor you use is largely a question of personal taste:

One important distinction between the editors is whether they're text-based or graphical. Text-based editors are more flexible because you can use them in text mode, in a console window in Photon, remotely via telnet or qtalk, and so on; graphical editors tend to be friendlier and easier to use, but can run only in a graphical window.

Note: If you start a graphical editor from the command line, you'll probably want to start it as a background process — by adding an ampersand (&) to the command line — so that you can continue to use the current window while the editor is still open. If you're using a text-based editor, start it as a foreground process by omitting the ampersand.

Neutrino includes these editors:

A powerful, but somewhat cryptic text-based editor that you'll find in most — if not all — UNIX-style operating systems.
The Photon editor, an easy-to-use graphical editor.
The QNX editor, a fullscreen, text-based editor that has been around since the time of QNX 2, and still has many devotees. We don't recommend that you use it, but you can find out more about it in the QED — Fullscreen Editor guide in your online documentation.

On Linux and Windows, the QNX Momentics Tool Suite features an Integrated Development Environment (IDE) that incorporates various specialized editors for creating C and C++ programs, buildfiles, and so on. For more information, see the IDE User's Guide.

Note: The Bazaar project on our Foundry 27 website ( may include other editors (as well as other third-party software that you might find useful). Note that we don't support these editors.

Supported editors

Neutrino includes and supports these editors:


You'll find a version of vi on every UNIX-style operating system. It's actually the Visual Interface to an editor called ex. To start vi, type:

vi filename

The vi editor has two modes:

Command mode
The keyboard is mapped to a set of command shortcuts used to navigate and edit text; vi commands consist of one or more letters, but ex commands start with a colon (:).
Insert mode
Lets you type normally.

To switch to command mode, press Esc; to switch to input mode, press one of:

The two modes can make vi very confusing for a new user; by default, vi doesn't tell you which mode you're in. If you type this when you're in command mode:

:set showmode

the editor indicates the current mode, in the lower right corner of the display. If you always want this option set, you can add this command — without the colon — to the profile for vi, $HOME/.exrc.

Here are some of the vi commands that you'll use a lot:

To: Press:
Leave vi without saving any changes :q!
Save the current file :w
Save the current file and exit :wq, :x, or ZZ
Move the cursor to the left h (see below)
Move the cursor to the right l (see below)
Move the cursor up one line k (see below)
Move the cursor down one line j (see below)
Move to the beginning of the next word w
Move to the end of the current or next word (depending on the cursor position) e
Move to the beginning of the current or previous word (depending on the cursor position) b
Page back Ctrl-B
Page forward Ctrl-F
Yank (copy) the current line yy
Yank from the cursor to the end of the current word yw
Delete from the cursor to the end of the current word dw
Delete the current line dd
Paste text before the cursor P
Paste text after the cursor p

Note: In some implementations of vi — including Neutrino's — you can also use the arrow keys to move the cursor, whether you're in command or input mode.

You can combine the commands to make them even more useful; for example, type a number before dd to delete several lines at once. In addition, vi has 26 named buffers that let you easily cut or copy and paste different blocks of text.

You can find numerous resources, tutorials, and command summaries online. In Neutrino, vi is actually a link to elvis; see the Utilities Reference.


The Photon editor, ped, is a simple graphical editor that's similar to editors that you'll find on other windowing systems. It runs in a Photon window, so you can't access ped through text consoles or console-only systems.

Editors; ped

The Photon editor, ped.

If you need to type international characters, accents, and diacritical marks, you'll find ped useful, because it supports UTF-8. To type international characters in ped, use the compose sequences described in Photon compose sequences in the Unicode Multilingual Support appendix of the Photon Programmer's Guide.

To start ped, choose Utilities-->Text Editor from the shelf, or type:

ped [filename] &

in a pterm terminal window. For more information about using ped, see the Utilities Reference.

Specifying the default editor

Some system processes ask you to use an editor to provide some information. For example, if you check something into a version-control system such as CVS, you're asked to explain the changes you made. Such processes use the VISUAL or EDITOR environment variable — or both — to determine which editor to use; the default is vi.

Historically, you used EDITOR to specify a line-oriented editor, and VISUAL to specify a fullscreen editor. Applications might use one or or both of these variables. Some applications that use both use VISUAL in preference to EDITOR when a fullscreen editor is required, or EDITOR in preference to VISUAL when a line-oriented editor is required.

Few modern applications invoke line-oriented editors, and few users set EDITOR to one, so you can't rely on applications to give preference one way or the other. For most uses, we recommend that you set VISUAL and EDITOR to the same value.

Once you've tried various editors, you can set these environment variables so that your favorite editor becomes the default. At the command-line prompt, type:

export VISUAL=path
export EDITOR=path

where path is the path to the executable for the editor. For example, if you want to use jed as the default editor, type:

$ which jed
$ export VISUAL=/usr/local/bin/jed
$ export EDITOR=/usr/local/bin/jed

To check the value of the EDITOR environment variable, type:

echo $EDITOR

You'll likely want to set these variables in your profile, $HOME/.profile, so that they're set whenever you log in. For more information, see $HOME/.profile in Configuring Your Environment.