elvis Command elvis
Clone of UNIX-standard screen editor
elvis [ flags ] [ +cmd ] [ file1 ... file27 ]
elvis is a clone of vi and ex, the standard UNIX screen editors.
Unlike MicroEMACS, the COHERENT system's other screen editor, el-
vis is a modal editor whose command structure resembles the ed
line editor. Modal means that a keystroke assumes a different
meaning, depending upon the mode that the editor is in. elvis
uses three modes: visual command mode, colon command mode, and
input mode. The following sections summarize the commands as-
sociated with each mode.
***** Visual Command Mode *****
Visual-command mode closely resembles text-input mode. One quick
way to tell the modes apart is to press the <esc> key. If elvis
beeps, then you are in visual-command mode. If it does not beep,
then you were in input mode, but pressing <esc> switched you to
visual-command mode.
Most visual-mode commands are one keystroke long. The commands
are in two groups: movement commands and edit commands. The
former group moves the cursor through the file being edited, and
the latter group alters text.
The following sections summarize the command set for elvis's
visual command mode.
***** Visual-Mode Movement Commands *****
The following summarizes the visual mode's movement commands.
count indicates that the command can be optionally prefaced by an
argument that tells elvis how often to execute the command. move
indicates that the command can be followed by a movement command,
after which the command is executed on the text that lies between
the point where the command was first typed and the point to
which the cursor was moved. Typing the command a second time ex-
ecutes the command for the entire line upon which the cursor is
positioned. key means that the command must be followed by an
argument. The following describes
<ctrl-B> Move up by one screenful.
[count] <ctrl-D>
Scroll down count lines (default, one-half screen-
ful).
[count] <ctrl-E>
Scroll up count lines.
<ctrl-F> Move down by one screenful.
COHERENT Lexicon Page 1
elvis Command elvis
<ctrl-G> Show file status and the current line line.
[count] <ctrl-H>
Move one character to the left.
[count] <ctrl-J>
Move down count lines.
<ctrl-L> Redraw the screen.
[count] <ctrl-M>
Move to the beginning of the next line.
[count] <ctrl-N>
Move down count lines (default, one).
[count] <ctrl-P>
Move up count lines (default, one).
<ctrl-R> Redraw the screen.
[count] <ctrl-U>
Scroll up count lines (default, one-half screenful).
[count] <ctrl-Y>
Scroll down count lines.
<ctrl-]> If the cursor is on a tag name, go to that tag.
<ctrl-^> Switch to the previous file.
[count] <space>
Move right count spaces (default, one).
! [move]
Run the selected text through an external filter
program.
`` key Select which cut buffer to use next.
$ Move to the end of the current line.
% Move to the matching (){}[] character.
' key Move to a marked line.
[count] (
Move backward count sentences (default, one).
[count] )
Move forward count sentences (default, one).
* Go to the next error in the error list.
COHERENT Lexicon Page 2
elvis Command elvis
[count] +
Move to the beginning of the next line.
[count] ,
Repeat the previous f or t command, but move in the
opposite direction.
[count] --
Move to the beginning of the preceding line.
[count] .
Repeat the previous edit command.
/ text Search forward for text, which can be a regular
expression.
0 If not part of a count, move to the first character
of this line.
: Switch to colon-command mode to execute one command.
[count] ;
Repeat the previous f or t command.
? text Search backwards for text, which can be a regular
expression.
@ key Execute the contents of a cut-buffer as vi commands.
[count] B
Move backwards count words (default, one).
[count] E
Move forwards count words (default, one).
[count] F key
Move left to the count'th occurrence of the given
character (default, first).
[count] G
Move to to the count'th line in the file (default,
last).
[count] H
Move to the top of the screen.
K Look up a keyword.
[count] L
Move to the bottom of the screen.
M Move to the middle of the screen.
N Repeat the last search, but in the opposite direc-
tion.
COHERENT Lexicon Page 3
elvis Command elvis
P Paste text before the cursor.
Q Shift to colon-command mode.
[count] T key
Move left almost to the given character.
U Undo all recent changes to the current line.
[count] U
Move forward count words (default, one).
[count] Y
Copy (or ``yank'') count lines into a cut buffer
(default, one).
Z Z Save the file and exit.
[ [ Move back one section.
] ] Move forward one section.
^ Move to the beginning of the current line, but after
indent.
` key Move to the key character.
[count] b
Move back count words.
[count] e
Move forward to the end of the count'th word.
[count] f key
Move rightward to the count'th occurrence of the
given character.
[count] h
Move left count characters (default, one).
[count] j
Move down count characters (default, one).
[count] k
Move up count characters (default, one).
[count] l
Move right count characters (default, one).
m key Mark a line or character.
n Repeat the previous search.
COHERENT Lexicon Page 4
elvis Command elvis
p Paste text after the cursor.
[count] t key
Move rightward almost to the count'th occurrence of
the given character (default, one).
u Undo the previous edit command.
[count] w
Move forward count words (default, one).
y move
Copy (or ``yank'') text into a cut buffer.
z key Scroll the screen, repositioning the current line as
follows: + indicates top of the screen, -- indicates
the bottom, . indicates the middle.
[count] {
Move back count paragraphs (default, one).
[count] |
Move to the count'th column on the screen (leftmost,
one).
[count] }
Move forward count paragraphs (default, one).
***** Visual-Mode Edit Commands ***** The following describes the
visual mode's editing commands.
[count] #
Increment a number by count (default, one).
[count] &
Repeat the previous :s// command.
< move
Shift the enclosed text left.
> move
Shift the enclosed text right.
[count] A input
Append input at end of the line.
C input
Change text from the cursor through the end of the line.
D Delete text from the cursor through the end of the line.
[count] I input
Insert text at the beginning of the line (after inden-
tations).
COHERENT Lexicon Page 5
elvis Command elvis
[count] J
Join lines the current with the following line.
[count] O input
Open a new line above the current line.
R input
Overtype.
[count] S input
Change lines, like cc.
[count] X
Delete count characters from the left of the cursor
(default, one).
[count] a input
Insert text after the cursor.
c move
Change text.
d move
Delete text.
[count] i input
Insert text at the cursor.
[count] o input
Open a new line below the current line.
[count] r key
Replace count characters with text you type (default, one).
[count] s input
Replace count characters with text you type (default, one).
[count] x
Delete the character at which the cursor is positioned.
[count] ~
Toggle a character between upper case and lower case.
***** Colon-Mode Commands ***** The following summarizes the set
of colon-mode commands. It is no accident that these commands
closely resemble those for the ed line editor: they come, in
fact, from ex, the editor upon which both vi (the UNIX visual
editor) and ed derive. For that reason, colon-command mode is
sometimes called ex mode.
line indicates whether the command can be executed on one or more
lines. line can be a regular expression. Some commands can be
used with an optional exclamation point; if done so, the editor
assumes you know what you are doing and suppresses the warnings
and prompts it would normally issue for these commands. Please
COHERENT Lexicon Page 6
elvis Command elvis
note, finally, that most commands can be invoked simply by typing
the first one or two letters of their names.
abbr [word full_form]
Define word as an abbreviation for full_form.
[line] append
Insert text after the current line.
args [file1 ... fileN]
With no arguments, print the files list on elvis's
command line. With one or more arguments, change
the name of the current file.
cc [files]
Invoke the C compiler to compile files, and
redirects all error messages into file errlist.
After the compiler exits, scan the contents of er-
rlist for error messages; if one is found, jump to
the line and file indicated on the error line, and
display the error message on the status line.
cd [directory]
Switch the current working directory. With no argu-
ment, switch to the $HOME directory.
[line][,line] change [``x]
Replace the range of lines with the contents of cut-
buffer x.
chdir [directory]
Same as the cd command.
[line][,line] copy targetline
Copy the range of lines to after the targetline.
[line][,line] delete [``x]
Move the range of lines into cut buffer x.
digraph[!] [XX [Y]]
Set XX as a digraph for Y. With no arguments, dis-
play all currently defined digraphs. With one argu-
ment, undefine the argument as a digraph.
edit[!] [file]
Edit a file not named on the elvis command line.
errlist[!] [errlist]
Find the next error message in file errlist, as
generated through elvis's cc or make commands.
file [file]
With an argument, change the output file to file.
Without an argument, print information about the
current output file.
COHERENT Lexicon Page 7
elvis Command elvis
[line][,line] global /regexp/ command
Search the range of lines for all lines that contain
the regular expression regexp, and execute command
upon each.
[line] insert
Insert text before the current line.
[line][,line] join
Concatenate the range of lines into one line.
[line][,line] list
Display the requested range of lines, making all em-
bedded control characters explicit.
make [target]
Same as the cc command, except that make is ex-
ecuted.
map[!] key mapped_to
Remap key to mapped_to. Normally, remapping applies
just to visual-command mode; `!' tells elvis to
remap the key under all modes. With no arguments,
show all current key mappings.
[line] mark x
Set a mark on line, and name it x.
mkexrc
Save current configuration into file ./.exrc, which
will be read next time you invoke elvis.
[line][,line] move targetline
Move the range of lines to after targetline.
next[!] [files]
Switch to the next file on the elvis command line.
Next[!]
Switch to the preceeding file on the elvis command
line.
[line][,line] number
Display the range of lines, with line numbers.
previous[!]
Switch to the preceeding file on the elvis command
line.
[line][,line] print
Display the specified range of lines.
[line] put [``x]
Copy text from cut buffer x after the current line.
COHERENT Lexicon Page 8
elvis Command elvis
quit[!]
Quit elvis, and return to the shell.
[line] read file
Read the contents of file and insert them after line
(default, the last line).
rewind[!]
Switch to the first file on the elvis command line.
set [options]
Set an elvis option. With no arguments, list cur-
rent settings for all options.
shell Invoke a shell.
source file
Read a set of colon-mode commands from file, and ex-
ecute them.
[line][,line] substitute /regexp/replacement/[p][g][c]
For the range of lines, replace the first instance
of regexp with replacement. p tells elvis to print
the last line upon which a substitution was per-
formed. g means perform a global substitution,
i.e., replace all instances of regexp on each line
with replacement. c tells elvis to ask for confir-
mation before performing each substitution.
tag[!] tagname
Find tagname in file tags, which records information
about all tags. If found, jump to the file and line
upon which the tag is set.
[line][,line] to targetline
Copy the range of lines to after the targetline.
unabbr word
Unabbreviate word.
undo
Undo the last editing command.
unmap[!] key
Unmap key.
version
Display the current version of elvis.
[line][,line] vglobal /regexp/ command
Search the range of lines for all lines that do not
contain the regular expression regexp, and execute
command upon each.
COHERENT Lexicon Page 9
elvis Command elvis
visual
Enter visual-command mode.
wq
Save the changed file, and exit.
[line][,line] write[!] [[>>]file]
Write the file being edited into file. With the >>
argument, append the edited text onto the end of
file.
xit[!]
Same as the wq command, described above, except that
it does not write files that have not changed.
[line][,line] yank [``x]
Copy the range of lines into cut buffer x.
[line][,line] ! command
Execute command under a subshell, then return.
[line][,line] <
Shift the range of lines left by one tabwidth.
[line][,line] =
With no range of lines specified, print the number
of the current line. With line arguments, print the
endpoints of the lines in question, and the number
of lines that lie between them. (Remember, line can
be a regular expression as well as a number.)
[line][,line] >
Shift the range of lines right by one tabwidth.
[line][,line] &
Repeat the last substitution command.
@ x
Read the contents of cut-buffer x as a set of colon-
mode commands, and execute them.
***** Input Mode Commands ***** Most keystrokes are interpreted
as being text and inserted directly into the text; however, some
keystrokes are still interpreted as commands. Thus, you can per-
form an entire session of simple editing directly within input
mode without switching to either of the command modes.
The following summarizes the commands that can be executed
directly within input mode:
<ctrl-A> Insert a copy of the last input text.
<ctrl-D> Delete one indent character.
COHERENT Lexicon Page 10
elvis Command elvis
<ctrl-H> Erase the character before the cursor.
<ctrl-L> Redraw the screen.
<ctrl-M> 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> Move to the beginning of the line.
<ctrl-V> Insert the following keystroke, even if special.
<ctrl-W> Backspace to the beginning of the current word.
<ctrl-Z><ctrl-Z>
Write the file and exit elvis.
<esc> Shift from input mode to visual-command mode.
<del> Delete the current character.
***** Command-line Options ***** elvis lets you name up to 27
files on the command line, thus allowing you to edit up to 27
files simultaneously. The ``next file'' and ``previous file''
commands described above allow you to shift from one file to
another during the same editing session; in this way, for ex-
ample, you can cut text from one file and paste it into another.
elvis recognizes the following command-line options:
-r Recover a previous edit. Because elvis uses the program
virec for file recovery, invoking it with this option simply
prints a message that tells you to run virec.
-R Invoke elvis in ``read-only'' mode. This is equivalent to
invoking elvis via the link view.
-t tag
Begin editing at tag.
-m [ file ]
Invoke elvis in error-handling mode. It searches through
file for something that looks like an error message from a
compiler, then positions the cursor at that point for
editing.
-e Begin in colon-command mode.
-v Begin in visual-command mode.
COHERENT Lexicon Page 11
elvis Command elvis
-i Begin in input mode.
+command
Execute command immediately upon beginning editing. For ex-
ample
elvis +237 foo
causes elvis to move directly to line 237 immediately upon
beginning to edit file foo.
***** Files *****
/tmp/elv* -- Temporary files
***** See Also *****
commands, ed, ex, me, vi, view
***** Notes *****
Full documentation for elvis is included with this release in
compressed file /usr/src/alien/Elvis.doc.Z.
elvis is a public-domain program written by Steve Kirkendall
(kirkenda@cs.pdx.edu or ...uunet!tektronix!psueea!eecs!kirkenda),
assisted by numerous volunteers. Source code for it is available
through the Mark Williams bulletin board, USENET and numerous
other outlets.
elvis is distributed as a service to COHERENT customers, as is.
It is not supported by Mark Williams Company. Caveat utilitor.
COHERENT Lexicon Page 12