The QNX Neutrino RTOS includes and supports these editors:
On QNX Neutrino, vi is a symbolic link to elvis. To start vi, type:
vi filename
The vi editor has two modes:
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 then 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 | CtrlB |
Page forward | CtrlF |
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 |
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 QNX Neutrino, vi is actually a link to elvis; see the Utilities Reference.