File: edit9.1
.TH edit9 1
.SH NAME
edit9 \- tiny modal text editor
.SH SYNOPSIS
.B edit9 [FILE]
.SH DESCRIPTION
edit9 is a text editor. It can be used to edit any UTF-8 encoded text file,
whether it is prose or a program listing.
.P
Some minimalistic text editing commands are available to the user and
enumerated below. The main appeal of using edit9 over other, more featureful,
text editors like Emacs, Vi/m, Nano, etc. is that the spartan interface
provides a comfortably predictable tool for authoring text. It does not support
configuration files, undo/redo, or text search. The benefit of this is that the
implementation of edit9 remains small and managable for individual programmers
to study, modify, and extend. As a commitment to this principle, the lines of C
source code used to implement this editor are <= 512 lines.
.P
The command syntax is similar to Emacs keybindings except in a modal text
editing setting similar to Vi. This allows a more comfortable editing
experience (no key-chording) while not deviating very often from the mnemonic
keybindings used in Emacs. There are two editing modes: command mode and insert
mode. A red cursor means that you are in command mode, a yellow cursor means
you are in insert mode. A blue cursor means that you are currently describing a
region of text to the editor; some commands in command mode will work
differently when a region is active. The line at the top of the screen is both
a description of the state of the text editor and, occasionally, a prompt where
additional user input can be expressed. The prompt will automatically become
active when a command is invoked that requires additional information, such
as trying to save an unnamed draft or going to a specific line in the text
file. To escape the prompt and abort the pending command, press ESC.
.SH USAGE
.SS Command mode
.TP
.B i
Change to insert mode.
.TP
.B s
Save the changes made in the buffer to the file being edited. If the editor
contains an unnamed draft, then the prompt will activate and the desired
filename can be entered there.
.TP
.B Q
Close the text editor.
.TP
.B f
Move the cursor forward by one character.
.TP
.B b
Move the cursor backward by one character.
.TP
.B d
Delete the character in front of the cursor. If a region is selected, then that
region will be deleted.
.TP
.B p
Move the cursor up one line.
.TP
.B n
Move the cursor down one line.
.TP
.B g
Move the cursor to a specific line in the text file. This command will activate
the prompt. The specific line number (0-based indexing) can be typed into the
prompt.
.TP
.B e
Move the cursor to the end of the current line.
.TP
.B a
Move the cursor to the beginning of the line.
.TP
.B <
Move the cursor to the beginning of the buffer.
.TP
.B >
Move the cursor to the end of the buffer.
.TP
.B l
Center the display vertically so that the cursor is in the middle of the
screen.
.TP
.B m
Toggle the mark that defines one end of a region. Moving the cursor with a
mark set will define a region that can be processed by additional commands.
.TP
.B c
If a region is active, copy the contents of the region. Only one copy is
stored at a time, so only the last region copied will be accessible by the
paste command.
.TP
.B x
If a region is active, cut the contents of the region. This is effectively
just copying the region and then immediately deleting it afterwords.
.TP
.B y
Paste the most recently copied region at the location of the cursor.
.TP
.B w
Toggle special rendering of whitespace characters.
.TP
.B u
Insert a unicode character at the location of the cursor. The codepoint for the
desired unicode character is entered via the prompt.
.TP
.B Backspace
Delete the character behind the cursor. If a region is selected, then that
region will be deleted.
.TP
.B Newline, space, and tab
These characters can be inserted into the buffer even when in command mode.
.SS Insert mode
.TP
.B Escape
Change to command mode.
.TP
.B Backspace
Delete the character behind the cursor. If a region is selected, then that
region will be deleted.
.TP
.B Other printable characters (a-z, A-Z, 0-9, etc.)
These characters will be inserted into the text buffer at the location of the
cursor. The cursor will advance forward by one column.
.SH CUSTOMIZATION
edit9 can be customized by editing the source code directly and (re)compiling
it. Basic values are defined at the top of the file; these can be changes
without too much hassle. Customizing the colors used can be done by replacing
the relevant ANSI escape code sequences found at the top of the file.
.SH SEE ALSO
.BR emacs (1),
.BR vi (1),
.BR nano (1)