[Previous] [Contents] [Next]

elvis

Visual display editor clone (UNIX)

Syntax:

elvis [options]... [+command] file...

Options:

-c command
Begin editing by executing this ex command.
-e
Start up in colon (ex) command mode.
-i
Start up in input mode.
-R
Set read-only mode to prevent accidental overwriting of files.
-t tag
Start editing at the given tag. (See the ctags utility.)
-v
Start up in visual command mode.
+command
Begin editing by executing this ex command.
file
A pathname of a file to be edited.

Description:

The elvis utility is an interactive fullscreen editor that is compatible with the Unix/POSIX vi editor. The vi utility in QNX is a link to elvis.

In elvis, changes are buffered and are written to the file only upon request. Since a temporary file is used for storage, elvis can edit files larger than the amount of memory available on the machine it is run on.

There are two major command modes:

You can switch between modes. You'll probably use the visual command mode most of the time. This is the mode elvis normally starts up in.

In visual mode, the entire screen is filled with lines of text from your file (except the last screen line, which is reserved for status). You can view text and move around the file. Each keystroke is interpreted as part of a visual command. If you start typing text, it won't be inserted; instead, it'll be treated as part of a command. To insert text, you must first give an "insert text" command (see "Inserting text").

The ex mode is quite different. In this mode, elvis displays a ":" character on the bottom line of the screen as a prompt. You are then expected to type in a command and press Enter. The set of commands recognized in ex mode differs from those in visual mode, and are known as ex commands. A summary of these commands is found at the end of this man page. (A line-oriented editor, ex is a predecessor of vi, and the two share common functionality.)

The capabilities of elvis are described throughout the following sections:

  1. Visual Mode
  2. Movement Commands
  3. Inserting text
  4. Deleting, Yanking, Putting
  5. Filters
  6. Shifting text
  7. Miscellaneous commands
  8. Searching
  9. Global & Substitute Commands
  10. Undo and Retrieving
  11. Screen Commands
  12. File Manipulation
  13. Escaping to a Shell
  14. Abbreviations and Macros
  15. Options
  16. ex commands

1. Visual mode

Most visual mode commands are one keystroke long. The following sections list the operation performed by each keystroke, and any necessary options or operands.

Most commands may be preceded by a decimal number. Usually, this number specifies how many times the command is to be repeated. Without this number, the command will in most cases execute just once.

Input mode

You cannot enter text into your file directly from visual command mode. Instead, you must first give a command that puts you into input mode. The commands to do this are:


Note:

Visual command mode looks a lot like text input mode. If you forget which mode you're in, simply hit Esc. If elvis beeps, you're in visual command mode. If elvis doesn't beep, you were in input mode -- by hitting Esc you'll have switched to visual command mode. One way or another, after you hit Esc, elvis will be ready for a command.

Note that if the showmode option is set (this option described in the "Options" section below), the mode will be displayed in the lower right-hand corner as either Command or Input. Also note that each mode uses a different cursor shape, if supported by the output device.


Operators

Among its various commands, elvis has seven basic but powerful operators that let you change, delete, cut, paste, shift, or filter text regions. Although they're described below in the appropriate sections, you should note that, for the most part, they all share a common form:

Where op can be:

c
Change
d
Delete
y
Yank
>
Shift right
<
Shift left
!
Filter

One operator does not take an object:

p
Put

The object operand specifies the range of text that the op operator will act upon. The object can be any movement command or pattern search. (See Movement Commands). In this way, the power of the operators can be seen. The elvis utility can act on words, sentences, regions up to a specified pattern-whatever range the object operand specifies.

When you give a movement command as an operand, you can specify an optional count [n] to multiply the effect of the operand (e.g. d2w to delete next two words). When a count isn't provided, it typically defaults to 1. See the section on Movement Commands.

Special cases

Operators are frequently used with lines. So, for simplicity, a few special forms of these commands operate only with line objects. The following list shows the syntax of these special forms. Note the count is optional, and precedes the operator (this differs from the above form):

[n]cc
Change n lines
[n]dd
Delete n lines
[n]Y
[n]yy
Yank n lines
[n]<<
Shift n lines to the left
[n]>>
Shift n lines to the right

Named buffers

When you yank, delete, change, shift, or filter text, elvis saves the affected region in a single unnamed cut buffer (which you can recall by the put command). However, elvis also has 26 named buffers, a to z, which you can use to save blocks of text during an edit session. These buffers are often used when editing multiple files to move text around.

The previously defined operator forms can now be prefixed by "a through "z (represented below by "<a-z>) to indicate which cut buffer is to be used to store the modified text region:

"<a-z>op<object>
normal cases
"<a-z>[n]op
special cases

When you use the uppercase letters to denote the named buffers, the objects are appended to the buffer. Thus adding the following forms:

"<A-Z>op<object>
normal cases
"<A-Z>[n]op
special cases

2. Movement commands

The following movement commands provide a convenient means to position the cursor throughout the file being edited. Most can be preceded by an optional count to repeat the action. More importantly, these movement commands can be used as operands to the change, yank, delete, put commands to specify the range of action to be performed (see "Inserting text" and "Deleting, yanking, putting" sections).

Text objects

The following text objects are used in conjunction with the movement commands:

characters
A single character.
Sentences
A sentence is a sequence of text ending in one of the following characters, followed by two spaces or a newline:
     . ! ?
Paragraphs
A paragraph starts after an empty line or if any of the pairs of characters defined with the :set pa= option are found.
Sections
A section starts where any of the pairs of characters defined with the :set se= option are found.

Cursor movement

To move the cursor, you can use the keypad arrow keys; you can also use the H, J, K, and L keys.

[n]j
[n]down-arrow
[n]Ctrl-J
[n]Ctrl-N
Move down n lines (next).
[n]k
[n]up-arrow
[n]Ctrl-P
Move up n lines (previous).
[n]l
[n]right-arrow
[n]spacebar
Move right n characters.
[n]h
[n]left-arrow
[n]Backspace
Move left n characters.
[n]-
Move to first non-blank character on nth line, in backward direction.
[n]+
Move to first non-blank character on nth line, in forward direction.
[n]$
Move to the end of the line.
^
Move to the beginning of the first word on the line.
0
Move to the left margin (first non-blank character) of current line.
[n]|
Move to the column specified by n.
[n]w
Move to the beginning of the next (or nth next) word.
[n]W
Move to the beginning of the next (or nth next) word that follows white space.
[n]b
Move to the previous (or nth previous) word.
[n]B
Move to the previous (or nth previous) word that's delimited by white space.
[n]e
Move to the end of the current or nth word.
[n]E
Move to end of the current or nth word that's delimited by white space.
[n]G
Move to the specified line (default is last line of file for a simple G command).
[n]f<char>
Move to the nth occurrence of char (in forward direction) on the current line. The cursor is placed at the matched character.
[n]F<char>
Move to the nth occurrence of char (in backward direction) on the current line. The cursor is placed at the matched character.
[n]t<char>
Move to the nth occurrence of char (in forward direction) on the current line. The cursor is placed just before the matched character.
[n]T<char>
Move to the nth occurrence of char (in backward direction) on the current line. The cursor is placed just before the matched character.
[n];
Repeat previous f, F, t, or T command, in the same direction.
[n],
Repeat previous f, F, t, or T command, in the opposite search direction.
%
Move to matching parenthesis, bracket, or brace; i.e.: ( ) [ ] { }
[n])
Move to the beginning of the next (or nth next) sentence.
[n](
Move to the beginning of the current (or nth previous) sentence.
[n]}
Move to the beginning of the next (or nth next) paragraph.
[n]{
Move to the beginning of the current (or nth previous) paragraph.
[n]]]
Move to the beginning of the next (or nth next) section.
[n][[
Move to the beginning of the current (or nth previous) section.
[n]H
Move to the top left position of screen. If n is specified, move the cursor to the beginning of the line n lines from the top of the screen.
[n]L
Move to the beginning of the last line on screen. If n is specified move the cursor to the beginning of the line n lines from the bottom of the screen.
M
Move to the beginning of the middle line on the screen.

Marking

m<a-z>
Mark the current position with the character <a-z>.
'<a-z>
Move to the beginning of the marked line.
`<a-z>
Move to the exact position marked with the character <a-z>.
''
Move back to the beginning of the line where it was before the last "non-relative" move.
``
Move back to the exact position it was before the last non-relative move.

Tags


Note:

Tags can't be included as <object> operands for commands such as change, yank, put, delete, shift, and filter. Tags are defined in a file created by the ctags utility.


:ta tag
Edit the file containing tag. Position at tag.
Ctrl-]
The word at the cursor position is taken as the tag, and the editor finds the word as with the :ta command.

3. Inserting text

The following commands enter input mode, where the text you enter is put into the file, until you press Esc.

a
Append text after the current cursor position.
A
Append text at the end of current line.
i
Insert text before the current cursor position.
I
Insert text at beginning of current line.
o
Open a new line below line cursor is on, insert text there.
O
Open a new line above line cursor is on, insert text there.
c<object>
Change the text between the current position and the position specified by the <object> (movement operand or pattern). An optional count can be specified to multiply the effect of the <object> operand (i.e. c2w to change next two words).

If the range is within the current line, a $ will be displayed at the end of the <object> to indicate end-of-range. Otherwise, the text in the range is deleted and you're placed in input mode. When within a line, the specified range of text isn't deleted until you type Enter.

[n]cc
Change n lines.
R
Replace the rest of the line with text. Rather than delete the text as with the change command, before going into insert mode, all text entered overwrites the current line until it has been completely replaced; at that point you're placed in input mode.
s
Substitute text for the current character (abbreviation for cl).
S
Substitute text for the current line (abbreviation for cc).

Input mode

In input mode, all keystrokes are inserted into the text at the cursor's position, except for the following:

Esc or
Ctrl-[
Exit from input mode, back to command mode.
INTR
Interrupt execution (usually Ctrl-C, see stty).
erase or
Ctrl-H
Erase the character before the cursor.
Ctrl-W
Erase the last input word.
Ctrl-A
Insert a copy of the last input text.
Ctrl-D
Delete one indent character.
Ctrl-L
Redraw the screen.
Ctrl-M or
Enter
Insert a newline.
Ctrl-P
Insert the contents of the cut buffer.
Ctrl-R
Redraw the screen (like Ctrl-L).
Ctrl-T
Insert an indent character.
Ctrl-U
Backspace to the beginning of the line.
Ctrl-V
Insert the following keystroke, even if special (e.g. Ctrl-V Ctrl-L would insert a form-feed).

4. Deleting, yanking, putting

As mentioned in the Introduction, elvis supports very powerful operator constructs. In this section we'll deal with the delete, yank, and put operators.

delete
Delete the specified region and place the text into the unnamed buffer or a named buffer, if one is specified.
yank
Make a copy of the specified region and place it into the unnamed buffer or a named buffer, if one is specified.
put
Put the contents of the unnamed buffer, or of the named buffer, if specified, into its new location.

When you have a sequence of text you want to copy or move to a different location, you would first use the yank or delete operators to copy or delete the data into a buffer; you would then specify the put command to place the data at its new location. You can switch to another file before putting the text back, thus you can copy from one file to another.

Copying

To copy the next four lines, you would yank them with a command such as:

    4yy    or    y4j

then you would move to a new location and put the text by typing:

    p

Deleting

To delete the next four lines, you would use a command such as:

    4dd    or    d4j

Moving

To move the next four lines, you would use a command such as:

    4dd    or    d4j

then you would move to a new location and put the text by typing:

    p      or    :pu

5. Filters

With the filter command, you can select regions of text and run them through any command and insert the output into the file. The text in the range specified from the current line to the delimited <object> is filtered through the command and replaces the region specified. The text that was in the region before being replaced by the output of the command is saved in the unnamed buffer -- or in a named buffer if one was specified. If uppercase letters are used, elvis will append text to the named buffer.

!<object>command
Delete the specified text object into a buffer (unnamed, or named if given). Pass the specified text region to the standard input of the command, and replace it with the command's output. When you enter this command, the ! prompt won't appear until an <object> has been given.

For example, to sort the next 10 lines:

   !10!sort

6. Shifting text

The shift operators, < and >, shift all the lines delimited by the current line and the <object> operand. Text is shifted by the value of the shiftwidth option (see below). The forms of the shift command are:

><object>
Shift <object> to the right.
<<object>
Shift <object> to the left.
[n]>>
Shift next n lines to the right.
[n]<<
Shift next n lines to the left.

Note:

"Named Buffer" prefixes don't work with the shift operator.


7. Miscellaneous commands

[n].
Repeat last text modifying command n times.
[n]r<char>
Replace current character with char.
D
Delete to the end of the line (abbreviation for d$)
[n]J
Join the next line with the current line.
:[x,y]j
Join all the lines in the specified range.
[n]x
Delete n chars, to the right, including cursor position.
[n]X
Delete n chars to the left of the cursor.
[n]~
Reverse the case of the n next characters.
:[x,y]p
Display text in the specified range.
:[x,y]l
Display text in the specified range with tab and end-of-line markers.
:[x,y]nu
Display text in the specified range, with line numbers.
:so file
Read and execute the commands listed in file.
:ve
Display version number and compilation date of elvis.

8. Searching

Patterns

A pattern used for searching and substituting is called a regular expression. While most characters will match themselves in a search request, some have special meaning. To use these special characters in a search expression, put a backslash (\) before them:

Character Meaning
^ beginning of line
$ end of line
. any single character except the newline
\< the beginning of a word
\> the end of a word
[string] any single character in string
[^string] any single character not in string
[x-y] any character between x and y (range)
[^x-y] any character not between x and y (range)
* zero or more consecutive occurrences of the previous character
\ Escape special characters

See the grep utility for more information on regular expressions.

Search commands

/[pattern]Enter
Search forward for pattern.
?[pattern]Enter
Search backward for pattern.
/[pattern]/{+|-}nEnter
Go to the nth line relative to the line on which pattern is found, in forward direction.
?[pattern]?{+|-}nEnter
Go to the nth line relative to the line on which pattern is found, in backward direction.
/Enter
Repeat the previous pattern search, in forward direction.
?Enter
Repeat the previous pattern search, in backward direction.
n
Repeat the previous pattern search.
N
Repeat the previous pattern search, in reverse direction.

Search examples

/fred[1-3]
Match fred1, fred2, fred3
/^QNX
Match QNX at the beginning of a line
/QNX$
Match QNX at the end of a line

9. Global & substitute commands

Substitute command

The substitute command substitutes text matching a pattern with replacement text:

If none of the modifiers c, g, or p are specified, this command will replace the first occurrence of the given pattern. You can modify this behavior by specifying any combination of the three modifiers:

c
prompt before replacing
g
replace all matched occurrences on a line
p
display all lines containing the replaced text

This command is very powerful when used in conjunction with the global command (see below).

Ranges

You can specify a range wherever [x,y] is indicated. The first element, x, indicates the first line of the range while the second element, y, indicates the last line. Range elements can be line numbers or any of the following special characters:

.
the current line
$
the last line in the file
%
same as 1,$ (i.e. the entire file)
n
relative offset from current line

A range element may also be a pattern specification:

or a marked location:

For example, to print the lines from the next line containing "steve" until the first subsequent blank line:

/steve,/^$/!lp

Global command

The global command searches through the lines of the specified range-or through the whole file if no range ([x,y]) is specified-for lines that contain the pattern. For each matching line, command will be performed on it. The global command is of the following form:

:[x,y]g/pattern/command
Execute command for every line that matches pattern.
:[x,y]g!/pattern/command
:[x,y]v/pattern/command
Execute command for every line that doesn't match pattern.

You can combine the substitute and global commands, using the following syntax:

This command runs the substitute command on every occurrence of a matched pattern within the given range. The null pattern specification (i.e. //) indicates to the substitute command that it is to use the currently matched global pattern as the text it is to replace.

The following variations may also be used:

Global examples

Substitute the word fred with the word barney from lines 1 to 10:

    1,10g/fred/s//barney

Match every mary that's at the beginning of a line and prompt the user to confirm the substitution:

    1,$g/^mary/s//dave/c

10. Undo and retrieving

Undo

On occasion, you need to undo the effects of a command.

u
Undo the effects of the last command that changed the edit buffer.
U
Undo the effects of all the text modifying commands performed on this line. Return the line to its original state.

Retrieving previous deletions

The editor saves the last nine deleted blocks of text in save buffers. You can retrieve a buffer with the following command:

"np
Retrieve nth previous deletion (1-9). Place after the cursor.
"nP
Retrieve nth previous deletion (1-9). Place before the cursor.

If you accidentally select the wrong buffer, you can use the undo command to clear it and then try specifying a different buffer.

You can also use named buffers (See "Deleting, yanking, putting"):

"<a-z>p
Retrieve the contents of the named buffer. Place after the cursor.
"<a-z>P
Retrieve the contents of the named buffer. Place before the cursor.

11. Screen commands

Scrolling

[n]Ctrl-D
Scroll down n lines (default is half page). n is remembered and becomes the default.
[n]Ctrl-U
Scroll up n lines (default is half page). n is remembered and becomes the default.
[n]PgDn or
[n]Ctrl-F
Jump forward n pages.
[n]PgUp
[n]Ctrl-B
Jump backward n pages.
[n]Ctrl-E
Scroll down n lines.
[n]Ctrl-Y
Scroll up n lines.

Screen adjustments

To position the current line at different positions on the screen by scrolling forward/backward:

z.
Place line at center of screen.
z-
Place line at bottom of screen.
Ctrl-L
Ctrl-R
Redraw the screen.

Status

Ctrl-G or
:f
Display status line on bottom of screen.

12. File manipulation

Writing to a file

All w commands can be preceded by an [x,y] range. For example, to write the first 6 lines you could specify: 1,6w

:w
Write changes to current file.
:w file
Write changes to file.
:w >>file
Append changes to file.
:w! file
Force write to file.
:wq
Write the file and exit.
ZZ or :x
Exit elvis. If any changes were made, the edit buffer is written to the file.

Editing other files

:e file
Edit file.
:e!
Re-edit current file, discard changes.
:e! file
Edit file, discard changes to current file.
:e +n file
Edit file, start at line n.
:e # or
Ctrl-^
Return to the previous position in the last edited file.
:n
Edit the next file in the argument list.
:n!
Edit the next file, discard changes.
:n args
Use this new argument list.
:args
Show list of files, [] indicate current file.
:rew
Rewind list of files, re-edit first file.
:rew!
Rewind the list of files, re-edit the first file, and discard any changes to the current file.

(See the :tags movement command)

Reading in a file

:r file
Read in file after the cursor.
:nr file
Read in file after line n.
:r !cmd
Read in the output of the named command.

Leaving elvis

ZZ or :x
Exit elvis. If any changes were made, the edit buffer is written to the file.
:wq
Write the file and exit.
:q
Exit from elvis.
:q!
Exit from elvis and discard changes.
Q
Escape to the ex line editor (to return, type elvis).

13. Escaping to a shell

To execute a single command from within elvis, you can use the following command:

:!cmd
Execute a single command, then return to vi.

Sometimes you may wish to execute more than one command, so you would probably want to create a shell.

:sh
Start a subshell. You can type Ctrl-D or exit to return to elvis.

14. Abbreviations and macros

Macros

Macros let you bind a single key to an arbitrary set of editing commands.

Defining a macro is simple: you define an lhs (left-hand side), which is the single character you want translated, followed by an rhs (right hand side), which is the sequence it will be mapped into.

:map lhs rhs
Create macro
:unmap lhs
Delete macro.
:map
Display macros

For example:

This would map q into :wq<Enter>. The Ctrl-V is needed to quote (escape) the first Enter, while the second Enter ends the map definition.

Abbreviations

Word abbreviations are similar to macros, but they expand a short word into a longer word or words. If you type the word as part of a longer word, it's left alone. Abbreviations are used in input mode primarily to save typing.

Substitution isn't performed until you type a non-alphanumeric character to mark the end of the word. If you type Ctrl-V before the non-alphanumeric character, elvis won't perform the substitution.

:ab abbr replacement_text
Create an abbreviation.
:ab
Display abbreviations.
:una abbr
Turn off this abbreviation.

For example:

    :ab woof mary had a little ram

This would insert the text "mary had a little ram" whenever the word "woof" is typed.

15. Options

You can set or examine options via the colon command set. The values of options will affect the operation of subsequent commands.

There are three option types:

To print all the option settings, type:

    :set all

For convenience, options have both a long descriptive name and a short name that's easier to type. You may use either interchangeably.

Long name Short Default Meaning
autoindent ai noai Auto-indent during input
autoprint ap ap In ex, print the current line
autowrite aw noaw Auto-write when switching files
directory dir dir="/tmp" Where temporary files are kept
edcompatible ed noed Remember :s// options
errorbells eb eb Ring bell on error
ignorecase ic noic Upper/lowercase distinction ignored in search
list li noli Display lines in "list" mode
magic ma ma Allow regular expression in search
paragraphs pa pa="PPppIPLPQP" Names of "paragraph" for text formatter
readonly ro noro Prevent overwriting of original file
report re re=5 Report when 5 or more changes
scroll sc sc=12 Scroll amount for Ctrl-U and Ctrl-D
sections se se="NHSHSSSEse" Names of "section" for text formatter
shell sh sh="/bin/sh" Full pathname of the shell
showmatch sm nosm Show matching ( ) [ ] { }
showmode smd nosmd Say when we're in input mode
shiftwidth sw sw=8 Shift amount for < and >
tabstop ts ts=8 Width of tab characters
term te te="$TERM" Name of terminal
warn wa wa Warn for ! if file is modified
wrapmargin wm wm=0 Wrap long lines in input mode
wrapscan ws ws At EOF, searches wrap to line 1

Note:

You can configure the option settings with the EXINIT environment variable:

    EXINIT="set ai aw"
    export EXINIT

AutoIndent
If you specify autoindent during input mode, each added line will begin with the same amount of leading white space as the line above it. Without autoindent, added lines begin at column zero.
AutoPrint
This option affects only ex mode. If this option is on, and either the cursor has moved to a different line or the previous command modified the file, elvis will print the current line.
AutoWrite
If you've made modifications to the current file then try switching to another file, (e.g. :tag, or :next...), elvis will normally print an error message and refuse to switch. If this option is on, elvis will write the modified version of the current file and successfully switch to the new file.
DIRectory
elvis stores text in temporary files. This option lets you control which directory those temporary files will appear in. The default is /tmp.

You can set this option only in a .exrc file; after that, elvis will have already started making temporary files in some other directory, so it would be too late.


Note:

If your /tmp directory is on ramdisk, recovery won't be possible if the system is rebooted.


ErrorBells
The elvis utility normally rings a bell when you do something wrong. This option lets you disable the bell.
IgnoreCase
Normally, when elvis searches for text, it distinguishes between uppercase and lowercase letters. When this option is on, uppercase and lowercase are seen as equivalent.
LIst
In nolist mode (the default), elvis displays text in a "normal" manner -- with tabs expanded to an appropriate number of spaces, etc. However, sometimes it's useful to have tab characters displayed differently. In list mode, each tab is displayed as ^I, and a $ is displayed at the end of each line.
MAgic
The search mechanism in elvis can accept regular expressions -- strings in which certain characters have special meaning. The magic option is normally on, which causes these characters to be treated specially. If you turn the magic option off (:set noma), then all characters except ^ and $ are treated literally. Both ^ and $ retain their special meanings regardless of the setting of magic.
PAragraphs
The { and } commands move the cursor forward or backward in increments of one paragraph. Paragraphs may be separated by blank lines or by a leading "dot" command of a text formatter. Different text formatters use different dot commands. This option lets you configure elvis to work with your text formatter.

It's assumed your formatter uses commands that start with a "." character at the front of a line, followed by a one- or two-character command name.

The value of the paragraphs option is a string in which each pair of characters is one possible form of your text formatter's paragraph command. For example, lines starting with .IP, .LP, or .PP would be considered new paragraphs.

ReadOnly
Normally, elvis lets you write back any file for which you have write permission. If you don't have write permission, all you can do is write the changed version of the file to a different file.

If you set the readonly option, elvis pretends you don't have write permission to any file you edit. This is useful when you mean to use elvis only to look at a file, not to change it. This way, you can't change the file accidentally.

This option is normally off, unless you use the view alias of elvis, which is like elvis except the readonly option is on.

REport
Changes, deletes, and yanks may affect many lines. For commands affecting a lot of lines, elvis outputs a message saying what was done and how many lines were affected. This option lets you define what "a lot of lines" means. The default is 5, so a message will be shown on the status line for any command affecting 5 or more lines.
SCroll
The Ctrl-U and Ctrl-D commands normally scroll backward or forward by half a screenful, but you can adjust this. The value of this option says how many lines those keys should scroll. You can also set this with [n]Ctrl-D and [n]Ctrl-U.
SEctions
The [[ and ]] commands move the cursor backward or forward in increments of one section. Sections may be delimited by a { character in column 1 (which is useful for C source code) or by means of a text formatter's "dot" commands.

This option lets you configure elvis to work with your text formatter's section command, in exactly the same way that the paragraphs option makes it work with the formatter's paragraphs command. For example, lines starting with .SH or .NH would be considered new sections.

SHell
When elvis forks a shell (perhaps for the :! or :sh commands), this is the program it uses as a shell. The normal default is /bin/sh. However, if you have set the SHELL environment variable, the default value is copied from the environment.
ShiftWidth
The < and > commands shift text left or right by a uniform number of columns. The shiftwidth option defines that uniform number. The default is 8 spaces.
ShowMatch
With showmatch set, every time you type ), }, or ] in input mode, elvis will momentarily move the cursor to the matching character:
  )     --->     (     --->     )
  }     --->     {     --->     }
  ]     --->     [     --->     ]
ShowMoDe
In visual mode, it's easy to forget whether you're in the visual command mode, or input/replace mode. Normally, the showmode option is off, and you aren't informed as to which mode you're in. If you turn the showmode option on, a message will appear in the lower right corner of your screen, telling you which mode you're in.
TabStop
Normally, tab characters are 8 characters wide, but you can change their width with this option.
TErm
This "read-only" option shows the name of the terminal entry that elvis is using for your terminal.
WArn
If you've modified a file, but not yet written it back to disk, elvis will normally print a warning before executing a :!cmd" command. However, in nowarn mode, this warning isn't given.

Normally, elvis also prints a message after a successful search that wrapped at EOF. The [no]warn option also disables this warning.

WrapMargin
Normally (with wrapmargin=0), elvis lets you type in extremely long lines.

However, with wrapmargin set to something other that 0 (wrapmargin=70 is nice), long lines are automatically "wrapped" on a word break for lines longer than wrapmargin's setting.

WrapScan
Normally, when you search for something, elvis will find it no matter where it is in the file. elvis starts at the cursor position, and searches forward. If elvis hits EOF without finding what you're looking for, then it wraps around to continue searching from line 1, up to the current line.

If you turn off the wrapscan option (:se nows), and elvis subsequently hits EOF during a search, it will stop and say so.

16. ex commands

The following list of ex commands is intended for your convenience only. It's beyond the scope of this document to describe the operations of these commands in detail. Most of these commands have been indicated as alternatives to the visual mode commands described in the above sections.

The general form of these commands is:

[Prefix] Command Short form
abbrev abbr text ab
[line] append a
args ar
[x[,y]] change c
[x[,y]] copy line co
[x[,y]] delete ["named_buffer] d
edit[!] file e
file f
[x[,y]] global /pattern/command g
[line] insert i
[x[,y]] join j
[x[,y]] list l
map lhs rhs map
[x[,y]] move line m
next[!] n
[x[,y]] number nu
[x[,y]] print p
[line] put ["named_buffer] pu
quit[!] q
[line] read file | !command r
rewind[!] rew
set [option] se
shell sh
source file so
[x[,y]] substitute /pattern/text/[c][g][p] s
tag ta
unabbrev abbr una
undo u
unmap lhs unm
version ve
visual vi
[x[,y]] write[!][[>>]file] w
xit[!] x
[x[,y]] yank ["named_buffer] ya

The following ex commands have no long version:

Command Form
escape !command
print next CR
lshift <
rshift >

Files:

/tmp/elv*
During editing, text is stored in a temporary file in /tmp.
tags
Tag database created by ctags and used by the :tags command and the -t option.
$HOME/.exrc
On startup, the contents of this file are executed as a series of ex commands.

Environment variables:

EXINIT
If set, the contents of this environment variable will be executed on startup as a series of ex commands.
HOME
Used to look for default configuration files and .*rc files.
LINES, COLUMNS
Overrides the screen size values associated with your terminal type.
SHELL
Used to determine the command line interpreter to use for running commands from within elvis.

Note:

The elvis utility requires that the TERM environment variable be set to indicate your terminal type. For example, if elvis is running on a console, TERM should be set as follows:

    export TERM=qansi

or

    export TERM=qnx

depending on the mode your console is running in (QNX vs ANSI).


Contributing author:

Steve Kirkendall

Caveats:

When displayed, long lines scroll horizontally. On some implementations, these wrap onto multiple rows on the screen.

See also:

ctags, elvrec, qed, sed, vedit

Linda Lamb, Learning the vi Editor, O'Reilly and Associates, 1990


[Previous] [Contents] [Next]