As in vi, there are several editing modes:
CommandMode
Some commands in CommandMode can take a numeric argument. To enter a numeric argument just type the
(decimal) number. The number will be echoed at the bottom line of the screen as you type. To enter
an octal number, type a `0' as the first digit. To enter a hexadecimal number, type `0x' (this is
not a problem, because the x-command with a zero counter wouldn't make sense anyway). Some of the
commands can take a visually selected area as an argument (see subsection VisualMode).
b Move backwards to the beginning of a word.
e Move to the end of a word.
G If a numeric argument n is given, move the cursor to position n. If no argument is specified,
set the position to the end of the buffer. The first byte in the buffer is at position `0',
so the command to move to the beginning of the buffer is `0G'.
Control-G
Display the buffer name, size, status and the current position at the bottom line.
hjkl
Move the cursor. The arrow keys work as well. The numeric argument (if specified) determines
the number rows or columns the cursor will move. Different from vi: the cursor can be
positioned behind the last byte in the buffer.
i Enter InsertMode (see below) at the current position of the point. If a numeric argument n
is given, the typed text will be inserted n times. Note: Moving the cursor (using the arrow
keys) will discard the numeric argument.
n Move to the next match using the current RE. This is equivalent to typing `/', <Return>.
N Move to the previous match using the current RE. This is equivalent to typing `?', <Return>.
Control-O
Paste over. Copy the kill buffer to the current position overwriting the contents of the
current buffer. If a numeric argument n is given, the kill buffer is pasted n times.
p Paste. Insert the kill buffer at the current position. If a numeric argument n is given, the
kill buffer is pasted n times.
r Replace a single byte using the ReplaceMode. If an area is selected, all bytes in the
selected area are replaced. If a numeric argument is given, the specified number of bytes is
replaced.
R Enter ReplaceMode (see below). If a numeric argument n is given, the replace command is
repeated n times. Note: Moving the cursor (using the arrow keys) will discard the numeric
argument.
Control-R
Redo the last undo.
u Undo the last change to the current buffer.
Whenever possible hexer creates a file name.hexer in the current directory (the swapfile) for each
buffer visited (where name is the name of the buffer). All changes made to the buffer name are
stored in that file, so it is possible to undo (and redo) all changes made to the buffer. If the
swapfile can't be created, the undo list is stored in the memory.
v Enter VisualMode (see below). Visual selection of areas.
w Move forward to the beginning of a word.
x Delete the byte under the cursor. If a numeric argument n is given, n bytes are deleted. In
VisualMode, the selected area is deleted. Note: The bytes deleted using the x-command are
not copied to the kill buffer.
Control-X
The same as the x-command, but the bytes deleted are copied to the kill buffer.
y Yank. Yank the byte under the cursor into the kill buffer. If a numeric argument n is given,
n bytes are yanked into the kill buffer. In VisualMode, the selected area is copied to the
kill buffer.
zb Place the cursor in the bottom line of the screen.
zt Place the cursor in the top line of the screen.
zz Place the cursor in the middle line of the screen.
Note that the commands zb, zt and zz don't change the position in the file - only the screen
is scrolled (if necessary).
: Enter ExhMode (see below). The ExhMode is similar to the ex-mode in vi, but not compatible.
If an area is selected, the bounds of the selection are copied to the command line.
/ Search forward through the buffer using a RE(regularexpression). If no RE is specified, the
RE given in the previous /- or ?-command is reused.
Note: The REs in hexer are a little bit different from regular expressions in vi (see section
REGULAREXPRESSIONS).
? Search reverse using a regular expression.
. Repeat the last change to the buffer atthecurrentposition. This means that if the previous
command deleted n bytes and replaced them by m other bytes (n or m may be zero), the .-command
will do exactly the same at the current position in the file.
< Shift the hex column left n bytes, where n is the (optional) numeric argument. Note that the
<-command only changes the way the buffer is displayed in the hex column, the buffer itself is
kept unchanged.
> Shift the hex column right n bytes.
Control-^
Switch to the alternate buffer (see below).
% Enter a calculator command (see section CALCULATOR).
VisualMode
Select an area on the buffer. You can enter the VisualMode by using the v-command or by specifying
an area in ExhMode. The selection starts at the cursor position when entering the VisualMode and
ends at the current cursor position. You can leave the VisualMode without performing a command on
the selected area by pressing v or Escape. To perform a command on the selected area simply enter
the command as if you where in CommandMode. Commands that can't use the selection will ignore it.
As in CommandMode, it is possible to specify a numeric argument. Commands that can take the
selection as an argument will ignore the numeric argument.
InsertMode
In InsertMode the bytes you type are inserted at the current position of the cursor. At any time,
you can toggle the active column (hex column or text column) by pressing the TAB key. If the hex
column is active the bytes are entered as two digit hex numbers, if the text column is active, the
bytes are entered as ASCII text. The Delete or BackSpace key deletes the previously inserted byte.
If the hex column is active, the previously inserted nibble (hex digit) is deleted. It is not
possible to delete more bytes than have been inserted in the current insert command. While in InsertMode, you can move the cursor using the arrow keys. Note that moving the cursor discards the numeric
argument given to the insert command. To leave the InsertMode, type Escape. If a numeric argument
n was given to the insert command and is hasn't been discarded by a cursor movement, the typed bytes
are inserted n times.
ReplaceMode
In ReplaceMode you replace the bytes under the cursor as you type. Hitting BackSpace restores the
original contents of the buffer. The effect of a numeric argument is similar to the InsertMode: the
typed bytes are replaced n times. As in InsertMode, moving the cursor using the arrow keys discards
the numeric argument.
ExhMode
The ExhMode in hexer is kept similar to the ex-mode in vi. Typically, an exh command looks like:
:areacommandarguments
Perform the command command on the area area.
:commandarguments
Perform the command command at the current position.
:area Select the area area.
:position
Move the cursor to position position.
An area may be defined as:
position1,position2
The area starts at position1 and ends at position2 (inclusive).
position
The area selects one byte at position% The area selects the entire buffer.
A position may be defined as:
offset A decimal, octal (prefixed with `0') or hex (prefixed with `0x') number.
. The beginning of the buffer.
$ The end of the buffer.
/regexp/
A regular expression (see section REGULAREXPRESSIONS). The buffer is searched forward
starting at the current position. If a match was found, the current position is set to the
position of the match.
?regexp?
The buffer is searched reverse.
Commands may be abbreviated with a unique prefix of the command, some commands may be abbreviated
with a single character, even if that character isn't a unique prefix of the command name. Currently
the following commands are supported:
s,substituteSynopsis:areas /regexp/replace/flags
Search for the regular expression regexp and replace it with replace (see section REGULAREXPRESSIONS). replace may contain `\' references to subexpressions of regexp.flags:
g: global, this flag is ignored (it doesn't make sense in a binary editor).
c: confirm, ask the user to confirm each substitution.
(Note that the `/' character used as separator could be any character, it's just common
practice to use `/'.) Trailing separators may be omitted. If area is omitted, the whole
buffer is searched.
w,writeSynopsis:areawfilename
Write area to the file filename. If area is omitted. the whole buffer is written to the file,
if filename is omitted, the filename associated with the buffer is used.
r,readSynopsis:positionrfilename
Insert the contents of the file filename at position. If position is omitted, the current
position is used.
e,editSynopsis:enameor:e#
Change to buffer name. If there is no such buffer, hexer tries to open a file named name and
load it into a new buffer. If name is a hash sign (#), the alternate buffer is selected. On
success the current buffer becomes the alternate buffer.
b,bufferSynopsis:bnameor:b
Change to buffer name. On success the current buffer becomes the alternate buffer. If name
is omitted, a list of all buffers is displayed.
n,next
Select the next buffer in the buffer list.
N,previous
Select the previous buffer in th buffer list.
S,skip
Select the next unvisited buffer in the buffer list.
rewind Select the first buffer in the buffer list.
wall Write all unsaved buffers.
c,closeSynopsis:cnameor:c!nameor:cor:c!
Close the buffer name. If name is omitted, the current buffer is closed. If the buffer has
been modified, but not saved, it can't be closed using a :c-command; use :c! to override.
h,help
View an online help text.
q,quitSynopsis:qnameor:q!nameor:qor:q!
Close all buffers and exit the editor. If an opened buffer has bee modified, but not saved,
the :q-command can't be performed; use :q! to override.
mapimapvmapSynopsis:mapfromtoor:imapfromtoor:vmapfromto
The key sequence from is mapped to to. To enter special keys (e.g. function keys), mask them
using Control-V. :map affects the CommandMode only, :imap affects the InsertMode only and
:vmap affects the VisualMode only. It is not possible to re-map key sequences on the command
line editor.
unmapiunmapvunmapSynopsis:unmapfromor:iunmapfromor:vunmapfrom
Delete a key mapping created with :map, :imap or :vmap.
setSynopsis:setvariable [...]
or:setvariable=value [...]
or:setnovariable [...]
or:set
There are not too many variables that could be modified, this might change though. The
following variables can be used: iso (bool): display the whole ISO-8859/1 character set;
ascii (bool): display ASCII characters only; TERM (string): the name of the terminal;
maxmatch (number), specialnl (bool): see section REGULAREXPRESSIONS. :set called without an
argument lists all variables and values.
d,deleteSynopsis:aread
Delete all bytes in area. The deleted bytes are copied to the kill buffer.
y,yankSynopsis:areay
Copy the bytes in area to the kill buffer.
version
Display the version number of hexer.
zz Place the cursor in the middle line of the screen. Note that the screen is scrolled (if
necessary); the cursor position is kept unchanged.
zt Place the cursor in the top line of the screen.
zb Place the cursor in the bottom line of the screen.
wq The same as :x.
x,exit
Save all buffers and exit the editor.
If a command is called and can't use the given positions, areas or arguments, the additional
positions, areas, arguments are ignored.
Conditionalcommands: It is possible to specify a list of terminal names for which the given command
should be executed. The syntax is:
:terminals:command
where terminals is a colon-separated list of terminal names. The command is executed if and only if
the value of TERM is in the list. I.e. you could have a command like
:xterm:setiso
in your .hexerrc-file (use the ISO character set only if working on an xterm).
CursorMotion
In CommandMode, InsertMode, ReplaceMode and VisualMode, you can use the following cursor motion
commands:
ArrowKeys
Move the cursor.
Control-F
Move forward one page.
Control-B
Move back one page.
Control-D
Move forward half a page.
Control-U
Move back half a page.