GNU moe Manual
This manual is for GNU moe (version 1.14, 20 January 2024).
Copyright © 2005-2024 Antonio Diaz Diaz.
This manual is free documentation: you have unlimited permission to copy,
distribute, and modify it.
1 Introduction
GNU moe
is a console text editor for ISO-8859 and ASCII character encodings.
It has a modeless, user-friendly interface, online help, multiple windows,
global search/replace (on all buffers at once), block operations, automatic
indentation, word wrapping, file name completion, directory browser,
duplicate removal from prompt histories, delimiter matching, text conversion
from/to UTF-8, romanization, etc. The file size, line length, number of
buffers, and undo/redo capability are only limited by the amount of memory
available and the size of the address space of your machine.
Moe respects your work. By default it won't automatically add, change, or
remove a single byte in your files. Moe is a WYTIWYG (what you type is what
you get) editor.
Moe can easily edit thousands of files at the same time.
To have moe used as your default editor you need to set the environment
variables 'EDITOR=moe' and/or 'VISUAL=moe' in your shell
initialization file ($HOME/.profile if you are using bash).
Moe needs a screen size of at least 25 lines by 80 columns. Take this into
account if running it from a terminal emulator.
If your text console doesn't show all the ISO-8859-15 characters, try the
command 'setfont' from the package 'kbd'. You may also need to add
the line 'append="vt.default_utf8=0"' to /etc/lilo.conf or to the
configuration file of the bootloader in your machine. Check also with the
command 'kbd_mode' that the keyboard is in the default (ASCII) mode.
Use the following commands to set the text console in the right mode for moe:
kbd_mode -a
setfont -v lat9w-16.psfu
If your terminal emulator shows characters with codes >= 128 incorrectly,
check that the encoding is set to ISO-8859-15. (Other ISO-8859 encodings may
also work).
The Linux/POSIX terminal interface is insufficient because the character set
used by the terminal can be neither queried nor changed portably by the
application. There seems to be no connection between the current locale and
the character set used by the terminal. A terminal is an interface between
human and computer. If the application sends a code to the terminal without
knowing what glyph the terminal will show to the user, this is a security
hole.
2 Basic concepts
- Blank character
- Space (0x20) or tab (0x09).
- Whitespace character
- Space (0x20), (horizontal) tab (0x09), newline (0x0A), vertical tab (0x0B),
form feed (0x0C), carriage return (0x0D), or no-break space (0xA0).
- Escape sequence
- Sequence of characters beginning with a special character, usually backslash
'\' or escape (0x1B). Beware of escape sequences equivalent to a single
backslash, like '\d092', '\134', '\x5C', or '\u005C'.
- Escape sequences for special characters
- Alert '\a', backspace '\b', escape '\e', form feed '\f',
newline '\n', carriage return '\r', (horizontal) tab '\t',
vertical tab '\v', backslash '\\', decimal code '\dddd'
('d' followed by three decimal digits), octal code '\ooo' (one to
three octal digits), hexadecimal code '\xhh' (two hexadecimal digits),
universal-character-name '\uhhhh' or '\Uhhhhhhhh' (four or eight
hexadecimal digits, equivalent to the corresponding ISO 10646 character
coded in UTF-8 in 1 to 6 bytes, limited to 0x7FFFFFFF).
- Beginning of text
- Position of the first non-blank character in a line, or end-of-line if there
are no non-blank characters in the line.
- Blank line
- One that is empty or only contains whitespace characters.
- Buffer
- The buffer is the basic editing unit; one buffer corresponds to one text
being edited. You can have several buffers, but at any time you are editing
only one, the "current buffer", though several buffers (or several parts of
the same buffer) can be visible when you are using multiple windows.
- Buffer handle
- The buffer handle is the data structure underlying a (possibly hidden)
window. It contains the window and cursor positions in the buffer. There is
no limit on the number of buffer handles that can refer to the same buffer.
- Current line
- The line with the cursor.
- File
- Files are named units of text which are stored by the operating system for
you to retrieve later by name. To keep any text permanently you must put it
in a file.
When moe loads a file, it creates a buffer, copies the content of the file
into the buffer, and then displays the buffer for you to edit. If you alter
the text, you can save the new text in the file. This makes the changes
permanent by copying the altered buffer content back into the file. Until
you save, the changes exist only inside moe, and the file loaded remains
unaltered.
To create a file, just load the file as if it already existed. This creates
an empty buffer in which you can insert the text you want to put in the
file. The file is actually created when you save this buffer.
- Window
- Moe divides the screen into one or more windows, each of which can display
the content of one buffer. Two or more windows can display different parts
of the same buffer. The only limit to the number of windows is screen size.
3 Invoking moe
The format for running moe is:
moe [global_options] [ [+[line[,column]]] file [file_options] ]...
Where global_options are a mix of editor options and default
file_options. Note that the short option names use the same letters as
the options menu inside moe. Most long option names have a negative form
--backup --no-backup.
Each file name may be preceded by '+[line[,column]]' to
start the cursor at the line, and optionally column, specified. line
and column are applied to subsequent files until new values are
specified for them. column defaults to 1. A '+' alone puts the
cursor at end-of-buffer.
A hyphen '-' used as a file argument means standard input. It can
be mixed with other files and is read just once, the first time it
appears in the command line. If standard input is a terminal, '-' is
ignored. Remember to prepend ./ to any file name beginning with a
hyphen, or use '--'.
If any file is a directory, moe loads recursively all files in
file, applying to each of them the line, column, and
file_options specified for file. This feature makes it easier to
edit a whole tree containing thousands of files. The search order is depth
first. All files in each directory are loaded before descending into
subdirectories. Backups '*~', object files '*.o', compressed files
('*.gz', '*.lz', etc), graphic files ('*.pdf', '*.png',
etc), and symbolic links are ignored.
Moe is able to read some types of non-regular files at startup. Opening
non-regular files during the editing session is not allowed because it could
cause moe to be killed, losing the changes of any other files being edited.
Files corresponding to terminal devices are ignored at startup.
Moe supports the following editor
options:
-h
--help
- Print an informative help message describing the options and exit.
-V
--version
- Print the version number of moe on the standard output and exit.
This version number should be included in all bug reports.
-b
--backup
- Create backup files (default).
-B
--no-backup
- Don't create backup files.
-e
--exit-ask
- Ask always for confirmation when closing or saving-and-closing a buffer.
-H
--smart-home
- Normally, when you press the <Home> key, the cursor moves to the
beginning of the line, and if you press it again, it remains there. With
this option, if the cursor is at the beginning of the line and you press
<Home>, the cursor moves to the first non-blank character.
-i
--ignore-case
- Search in moe is case sensitive by default. With this option you can
make it case insensitive by default.
-k
n--keep-lines=
n- Number of lines to keep for PgUp/PgDn. -1 means half window.
-m
n--max-windows=
n- Maximum number of windows to show at once on the screen. 0 means as many as
fit.
-n
n--indent-step=
n- Number of spaces to add or remove when indenting or unindenting a block.
-s
--search-wrap
- Make search wrap. If end of buffer is reached and no match is found,
continue the search from the beginning of the buffer.
-u
--auto-unmark
- Turn off highlighting after any block operation (copy, reformat, ...).
-x
--rectangle
- Turn on rectangular block mode. Provide basic rectangular block operations,
like copy or move. This mode won't work properly if there are <Tab>
characters in or at the left of the block.
Moe also supports the following file options:
-a
--auto-indent
- When auto indent is enabled and you press enter, or the text wraps at
the end of a line, the cursor moves under the first non-blank character
of the previous line instead of to the beginning of the line.
-l
column--lmargin=
column- Set left margin to column. Default value is 1. The first column is
column 1.
-r
column--rmargin=
column- Set right margin to column. Default value is 76. A value of 0 sets the
right margin to the maximum possible column.
-o
--read-only
- Make the buffer read-only.
-O
--overwrite
- Disable insert mode. Make typed characters replace existing ones except
at end of line.
-w
--word-wrap
- Enable word wrapping. Automatically pass the current word to the next line
when you type past the right margin.
-W
--no-word-wrap
- Disable word wrapping.
-2
--two-spaces
- Make 'reformat paragraph' put two spaces after period. See reformat paragraph.
Numbers given as arguments to command-line options or editor commands
(line, column, offset, etc) may be expressed as decimal, hexadecimal, or
octal values (using the same syntax as integer constants in C++).
Exit status: 0 for a normal exit, 1 for environmental problems
(invalid command-line options, I/O errors, etc), 2 to indicate an invalid
or unreadable input file, 3 for an internal consistency error (e.g., bug)
which caused moe to panic.
4 The configuration file 'moe.conf'
moe.conf is the runtime configuration file for moe. In it you may
define default editor options, default file options, and file name dependent
options. moe.conf is optional; you don't need to install it in order
to run moe.
The options specified in the command line override those specified in
moe.conf.
Inside moe.conf, file name dependent options override those specified
as default file options.
You may copy the system moe.conf file ${sysconfdir}/moe.conf
to $XDG_CONFIG_HOME/moe.conf and customize these options as you like.
(XDG_CONFIG_HOME defaults to $HOME/.config). The file syntax is
fairly obvious and there are further instructions in it.
5 The status line
The status line is a line displayed in inverse video at the top of each
window, and contains the following information:
- The keyboard status. Shows the part already typed of a multi-key command, or
'<' to indicate that there are text columns at the left of the window.
- The status characters. 'I' for insert mode, 'O' for overwrite
mode, 'W' for word wrap, 'A' for auto indent, 'R' for
read-only, and 'X' for rectangular block mode.
- The name of the file being edited, or '(Unnamed)' if the buffer has not
yet been named. If the buffer has been modified since it was last saved or
opened, an asterisk '*' is displayed before the name and
'(Modified)' is displayed after the name.
- The cursor position in the buffer (Line Column).
- A 24-hour clock.
- The help key, or the code of the character under the cursor, or the line
position of the cursor in the buffer.
6 Keyboard commands
Moe tries to rationalize the keyboard commands. The <Alt> key is used for
harmless commands like cursor movements and scrolling. The <Control> key is
used for more "dangerous" commands like copying text blocks, deleting lines,
or exiting. The <Tab> key is used for file name completion and also to
show/hide the directory browser when moe asks for a file name to save or
load. In any case, the unlimited undo capability of moe makes it difficult
to accidentally cause irreparable damage to your files.
Moe uses the function keys so that the most frequent commands can be issued
with only one finger. The function key <F1> shows the online help, and
<F10> allows you to change the options. The online help and some
experience with text editors is all you need to start using moe. Reading the
manual is only required for more advanced uses of moe.
The <Control> key is displayed in the online help as '^', while the
<Alt> key is displayed as '^['. In this manual Control-a is
written as C-a, and Alt-a as A-a.
Some environments "swallow" the <Alt> key so that it never reaches the
application. If this happens, press the <Esc> key, then release it and
press the desired key. Alternative key sequences are also provided for
environments that intercept the function keys.
6.1 Function keys
- <F1>
- C-h
- Show the online help. Press <Page_up> to see the previous help
screen or <Page_down> to see the next help screen. Press <F1>,
C-c, or C-h to return to the editor.
- <F2>
- Save the current buffer to a file, automatically creating any missing parent
directories. It asks you to confirm the file name. You may save the buffer
with a different name (save as), in which case the buffer may be read-only,
the modified status of the buffer does not change, and the file permissions
are copied from the existing file to the new file. Moe makes a backup of a
file only the first time the file is saved from a given buffer. If moe does
not have permission to make a backup, it overwrites the original file
without making a backup.
- <F3>
- Load (read) a file in a new buffer. Pressing <Tab> shows the content of
the current directory or a list of files matching the current name, and
completes the name if there is only one possible name to show. The list of
matching files is displayed even if there is only one, showing that a
matching file exists. If the file name starts with ~/, the ~
is expanded to specify your home directory (tilde expansion).
- <F4>
- Toggle between showing only the current window or showing up to the
selected maximum number of windows.
- <F5>
- Select the previous window.
- <F6>
- Select the next window.
- <F7>
- Undo the last change made to the current buffer. You may keep undoing
changes until there are no more changes to undo. The buffer will be then
exactly as when it was loaded.
- <F8>
- Redo the last change undone on the current buffer. The undo history is
linear. That is, if you undo some changes and then make another change,
this last change replaces the changes undone, so you can't redo them.
- <F9>
- Copy the selected block at the cursor position. This is a convenient
alias for the command C-k c.
- <F10>
- Show the options menu. This menu allows you to change some editor-wide
and current-buffer options, like auto indent, margins, word wrap, ask
before exit, etc.
- <F11>
- Show the buffers menu, a list of all the buffers being edited. This menu
allows you to select a buffer and make it the current buffer. Some buffers
may appear more than once in the list if they have more than one buffer
handle. The names of modified buffers are preceded by an asterisk '*'.
The names of DOS buffers are preceded by a minus sign '-'. The names of
modified DOS buffers are preceded by a plus sign '+'.
- <F12>
- Select the last buffer handle where you pressed <F12> and make its
buffer the current buffer. This allows you to switch between two buffers, or
between two places of the same buffer, by repeatedly pressing <F12>.
- C-a 0..9ab
- (Control-a followed by a digit from 0 to 9, or a or b).
Provide an alternative access to function keys on those operating systems
and terminal emulators that intercept the function keys. C-a 1 to
C-a 9 work as <F1> to <F9>. C-a 0, C-a a, and
C-a b work as <F10>, <F11>, and <F12> respectively.
6.2 Moving around
The simplest way to move the cursor to the place where you want to edit is
with the arrow keys. Moe also provides commands to move to certain points in
the buffer.
- A-u
- Move cursor to the beginning of the buffer.
- A-v
- Move cursor to the end of the buffer.
- A-l
- Prompt for a line number, and then move cursor to that line. Line 1 is
the first line. If the line number is preceded by a plus or minus sign,
it is considered relative to the current line.
- A-c
- Prompt for a column number, and then move cursor to that column. Column
1 is the first column. If the column number is preceded by a plus or
minus sign, it is considered relative to the current column.
- A-o
- Prompt for an offset value, and then move cursor to the byte with that
offset from the beginning of the buffer. The first byte in the buffer
has offset 0. If the offset value is preceded by a plus or minus sign,
it is considered relative to the current offset.
- A-b
- Move cursor to the beginning of the selected block, if the beginning of the
block has been set and is in the current buffer.
- A-k
- Move cursor to the end of the selected block, if the end of the block has
been set and is in the current buffer.
- A-f
- Go to matching delimiter. Move cursor to the matching '(', '[',
'{', '<', ')', ']', '}', '>', '"',
''', '`', '/*', or '*/'. Default movement is forwards
for undirected delimiters. If the cursor is not on a valid delimiter, moe
tries to guess what delimiter to match.
- A-g
- Like A-f, but default movement is backwards for undirected delimiters.
- A-d
- Center cursor. Scroll window so that the line with the cursor is vertically
centred.
- A-w
- Scroll window backwards (scroll up) leaving 'keep-lines' of context, or
half screen if 'keep-lines' is -1.
- A-z
- Scroll window forwards (scroll down) leaving 'keep-lines' of context, or
half screen if 'keep-lines' is -1.
- A-a
- Scroll window left 8 columns.
- A-s
- Scroll window right 8 columns.
- C-k 0..9
- (Control-k followed by a digit from 0 to 9).
Set one of the 10 user bookmarks at the cursor position.
- A-0..9
- (Keep the <Alt> key pressed while typing a digit from 0 to 9).
Move the cursor to one of the 10 user bookmarks.
- C-k e
- Extend bookmarks. Set the user bookmarks 1 to 9 that were not previously set
or that are repeated (point to the same character as a previous bookmark).
On buffers with 1000 lines or less, the bookmarks are set at lines 100 to
900. On larger buffers the bookmarks are set at 10% to 90% of the buffer
size in lines.
6.3 Inserting text
To insert printing characters into the text you are editing, just type
them. This inserts the characters you type into the buffer at the cursor.
The <Backspace> key deletes the character preceding the cursor, while
the <Delete> key deletes the character at the cursor. You can delete a
whole line with the command C-y.
The <Return> key inserts a newline character in the buffer. If the
cursor is in the middle of a line, <Return> splits the line.
Moe can split lines automatically when you type past the right margin
if you turn on word wrap in the options menu (see Function keys), or
from the command line when invoking moe.
If you prefer to have text characters replace (overwrite) existing ones
rather than being inserted among them, you can activate overwrite mode by
pressing the <Insert> key. Pressing <Insert> again returns to normal
insert mode.
To insert a control or special character in the buffer, use the command
C-p. It prompts for a character code in a number of formats and
inserts it at the cursor.
6.4 Searching and replacing text
The command C-f enters search mode. It prompts for the text to be
searched (the search string). The function key <F9> copies the selected
block in the string being entered. <F9> may also be used when entering
the replacement text.
The command C-g repeats the previous search or replace.
The command C-w searches for the word at the cursor.
After entering the text to be searched, moe prompts for search options. You
may just hit <Return> to search forwards with default options or type one
or more of the following options:
- i
- Ignore the case of the text being searched, including characters inside sets
and equivalence classes.
- n
- Don't ignore the case of the text being searched. Use it when default is set
to ignore case.
- r
- Replace the text found. Moe then prompts for replacement text.
- d
- Delete the text found. (Replace with nothing).
- b
- Search backwards instead of forwards.
- g
- Search globally. Extends the search to all the buffers being edited.
- k
- Block search. Restricts the search to the selected block.
If you chose 'r' (replace) among the options above, every time the
search string is found moe prompts whether to replace it with the
replacement text. The possible answers are: y (yes) to replace and
continue searching, n (no) to not replace this text, but continue
searching, or r (rest) to replace all the remaining occurrences of the
search string without asking for confirmation.
'd' (delete) works just as 'replace with nothing'.
6.5 Syntax of regular expressions
Regular expressions have a syntax in which a few characters are special
constructs and the rest are "ordinary". An ordinary character is a simple
regular expression which matches that same character and nothing else. In
moe's regular expressions, all characters are ordinary characters except the
backslash '\', which is used to indicate a special character or
construct. Here is a list of those special constructs, also known as
"special search sequences". (Unknown escape sequences or escape sequences
equivalent to a backslash or to a right square bracket are rejected as
syntax errors).
- \\
- Matches a single '\'. See Basic concepts, for more special characters.
- \?
- Matches any single character. For example, 'a\?b' matches an 'a'
followed by any character and then a 'b'.
- \*
- Matches zero or more characters. For example, 'a\*b' matches an
'a' followed by any number of characters and then a 'b'.
- \c
- This works like '\*', but matches a C/C++ balanced expression. For
example, '\<for\s(\c)' matches any 'for' loop, even if it includes
nested parentheses.
- \+
- Matches zero or more instances of the character immediately following the
'+'. For example, '\+b' matches any number of 'b's (including
no 'b's). '\+' may precede '\[..]', '\w', '\W', or
'\=<ch>', matching any number of characters from those in the set
(including the empty string). '\+' may precede itself any number of
times, matching N-1 or more instances of the character immediately following
the last '+'. For example, '\+\+\+b' matches two or more
'b's. '\+' may be followed by a escape sequence for a special
character except '\u' and '\U'.
- \[..]
- Character set. This matches any single character between the brackets.
Ranges of characters may be specified by writing the starting and ending
characters with a '-' between them. Thus, '\[A-Z]' matches any
ASCII uppercase letter. '-' may be specified by placing it first or
last. ']' may be specified by placing it first. If the first character
after the left bracket is '^', it indicates a "complemented set", which
matches any character except the ones between the brackets. Character sets
may contain escape sequences for special characters except '\u' and
'\U'. Equivalence classes may not be used to specify ranges.
- \=
- Equivalence class. This matches any single character belonging to the same
equivalence class as the character immediately following the '='. For
example, '\=e' matches any of 'eèéêë'. The character following the
'=' must be a single-byte character; it may not be a escape sequence.
Equivalence classes may be used inside a character set. Thus,
'\[\=a\=e\=i\=o\=u]' matches any ISO-8859-15 lowercase vowel.
- \s
- Matches zero or more whitespace characters. For example, 'a\sb' matches
an 'a' followed by any number of whitespace characters (or none) and
then a 'b'.
- \S
- Matches the longest possible non-empty sequence of whitespace characters.
For example, 'a\Sb' matches an 'a' followed by any positive number
of whitespace characters and then a 'b'.
- \T
- Matches trailing whitespace. (A sequence of spaces, tabs, and no-break
spaces at the end of a line of text). It is equivalent to
'\+\+\[ \t\xA0]\$', but faster. It comes in handy to remove
unwanted trailing whitespace. (Search and delete '\T').
- \w
- Matches any word-constituent character (letters, digits, and the
underscore) of the ISO-8859-15 or ISO-8859-1 character encodings. Other
ISO-8859 encodings are not supported by this sequence.
- \W
- Matches any character that is not a word-constituent.
- \^
- \$
- These match the beginning and end of a line. For example, '\^foo\$'
matches 'foo' on a line by itself.
- \<
- \>
- These match the beginning and end of a word. For example, '\<foo\+\w\>'
matches any whole word beginning with 'foo'.
And here are the special replace sequences.
- \&
- This is replaced with the text which matched the search string. For example,
'(\&)' places parentheses around the matched text.
- \c
- This is replaced with the text which matched the search string capitalized;
the first letter of each whitespace-separated word is uppercased and the
rest are lowercased.
- \l
- This is replaced with the text which matched the search string converted to
lowercase. For example, '(\l)' converts to lowercase the matched text
and places parentheses around it.
- \u
- Same as \l, but converts the matched text to uppercase.
'\u0' may be specified as '\u\x30' to avoid an ambiguity with the
universal-character-name escape sequence '\uhhhh' (see Basic concepts).
- \0 - \9
- (Backslash followed by a digit from 0 to 9). These are replaced with the
text which matched the Nth special search sequence, except beginning/end of
line/word, in the search string. Note that octal escape sequences for
special characters can't be used in the replacement string because they
conflict with the special replace sequences '\0 - \3'.
6.6 Block commands
Moe allows you to mark a region of text, the block, and then perform some
operations like deleting the block, moving it to another place (in the same
or another buffer), changing its encoding, etc. There can be only one block
at any given time. If you begin marking a block, moe unmarks any previously
existing block.
Here is a list of the block operations:
- C-<Space>
- Mark the beginning of the block, or the end of the block if the beginning is
already marked. If pressed in an existing block, unmarks it.
- C-k b
- Mark the beginning of the block.
- C-k k
- Mark the end of the block.
- C-k c
- Copy the block at the cursor. The text inside the original block remains
unchanged.
- C-k m
- Move the block at the cursor. The text inside the original block is deleted.
- C-k y
- Delete the text in the block.
- C-k r
- Read a block of text from a file and insert it at the cursor. This operation
ignores rectangular block mode.
- C-k w
- Write the block to a file. The text inside the original block remains
unchanged.
- C-k i
- Indent block. Add spaces at the beginning of every line in the block.
- C-k u
- Unindent block. Remove spaces from the beginning of every line in the block.
- C-o 1
- Encode to Base64. Replace text in the block with its Base64-encoded
equivalent data.
- C-o 2
- Decode Base64. Replace Base64-encoded data in the block with its
corresponding plain text. In case of error, the cursor is moved to the
first byte of the invalid 4-byte group.
- C-o 3
- Encode/decode Rot-13. Replace text in the block with its corresponding
Rot-13-encoded text. Rot-13 encoding is reversible; running the command
a second time restores the original text.
- C-o 4
- Encode/decode Rot-47. Replace text in the block with its corresponding
Rot-47-encoded text. Rot-47 encoding is reversible; running the command
a second time restores the original text.
- C-o 5
- Encode to ASCII. Replace the ISO-8859-15 plain text in the block with an
approximate transliteration to ASCII-encoded text. Other ISO-8859 encodings
are not supported by this command. Any ASCII text already present in the
block is left unmodified. This command does not simply reset the most
significant bit of each byte. For example, the control codes
'0x80'-'0x9F' are converted to the corresponding binary escape
sequences '0x1B 0x40'-'0x1B 0x5F', the 'latin small letter
sharp s (german)' is transliterated to 'ss', and the 'euro sign'
is replaced with the string 'euro'.
- C-o 6
- Decode Quoted-Printable. Replace Quoted-Printable-encoded text in the
block with its corresponding plain text. In case of error, the cursor is
moved to the invalid character.
- C-o 7
- Encode to UTF-8. Replace the ISO-8859-15 plain text in the block with
its corresponding UTF-8-encoded text. Other ISO-8859 encodings are not
supported by this command. If the text in the block is already valid
UTF-8, encoding is not performed to avoid double UTF-8 encoding. If
'encode to UTF-8' is issued a second time and any byte value
larger than 127 is found, the encoding is performed unconditionally.
- C-o 8
- Decode UTF-8. Replace UTF-8-encoded text in the block with its
corresponding ISO-8859-15 or ISO-8859-1 plain text. Other ISO-8859
encodings are not supported by this command. In case of error, decoding
is not performed and the cursor is moved to the first byte of the
invalid or out of range UTF-8 character. If 'decode UTF-8' is
issued a second time, the decoding is performed unconditionally, copying
any out of range UTF-8 characters unmodified and producing a document
with mixed encoding (see remove UTF-8 out of range).
This command also transliterates some non-Latin scripts into Latin
script (see Romanization).
- C-o b
- Reformat all the paragraphs in the block. Whitespace in blank lines between
paragraphs is removed. See reformat paragraph.
- C-o d
- Remove all duplicate lines in the block searching forwards and leaving only
the first of each set.
- C-o e
- Remove all duplicate lines in the block searching backwards and leaving only
the last of each set.
- C-o o
- Remove UTF-8 out of range. Remove from the UTF-8-encoded text in the
block any valid UTF-8 character out of the range of characters managed
by moe. In case of error, the cursor is moved to the first byte of the
invalid UTF-8 character found. This command can be used before
'decode UTF-8' to avoid mixed encoding in the decoded text.
- C-o k
- Capitalize all the words in the block. (Uppercase the first letter of each
whitespace-separated word and lowercase the rest).
- C-o l
- Convert all the letters in the block to lowercase.
- C-o u
- Convert all the letters in the block to uppercase.
6.7 Terminating your editing session
- C-c
- Close the current window without saving any changes. If the current window
is the only one for its buffer, and the buffer being edited has been
modified, or 'exit-ask' is enabled (see Invoking moe), moe asks you
before closing the window.
- C-x
- Save the buffer being edited (if it has been modified), and then close the
current window. If the current window is the only one for its buffer, and
'exit-ask' is enabled (see Invoking moe), moe asks you before
saving the buffer or closing the window.
- C-q c
- Exit completely without saving. Moe asks you before closing anything.
- C-q x
- Save and exit. Save all the modified buffers, and then exit completely. Moe
asks you before saving or closing anything.
6.8 Commands showing help and other information
- <F1>
- C-a 1
- C-h
- Show the online help. See Function keys.
- A-i
- (Show character info). Show the line, position in line, position in buffer
(offset and percent of buffer size), and code of the character at the
cursor. (The 'position in line' may differ from the column shown in the
status line because of <Tab> characters in the line).
- A-t
- (Show UTF-8 code). Show the UTF-8 code of the (possibly multibyte) character
at the cursor. If the code is valid, the cursor is moved to the first byte
of the character.
- C-s 2
- C-s 4
- C-s 8
- (Show little-endian multibyte value). Show the little-endian value of a
sequence of 2, 4, or 8 bytes in decimal and hexadecimal. This is useful
for example to show things like the CRC or the file size coded in gzip
and lzip files.
- C-s <F2>
- C-s <F4>
- C-s <F8>
- (Show big-endian multibyte value). Show the big-endian value of a
sequence of 2, 4, or 8 bytes in decimal and hexadecimal.
- C-s b
- (Toggle clock blinking). Enable/disable blinking of the clock dots.
- C-s c
- (Show character code). Show on the status line the code of the character
at the cursor. Repeat the command to revert to normal. This command
overrides the command C-s p below.
- C-s g
- (Show global status). Show the number of modified, unnamed, and total
buffers being edited.
- C-s p
- (Show line position in buffer). Show on the status line the percent
position of the current line in the buffer. Repeat the command to revert
to normal. This command overrides the command C-s c above.
- C-s v
- Show moe's version.
6.9 Commands for some special functions
- C-b
- Reformat paragraph. Break it up into lines that fit between the margins.
Whitespace between words is collapsed to a single space or no-break space.
If the cursor is situated to the right of the left margin, this command uses
the cursor column as the left margin. See reformat paragraphs.
- C-p
- Insert a control or special character in the buffer. It also accepts an
arbitrarily large number in decimal ([1-9]...), hexadecimal (0x...), or
octal (0...), and inserts it as a little-endian sequence of bytes. If the
number is followed by '+', a big-endian sequence is inserted instead.
The escape sequences '\uhhhh' and '\Uhhhhhhhh'
(universal-character-name) insert in the buffer the corresponding ISO 10646
character coded in UTF-8 (1 to 6 bytes, limited to 0x7FFFFFFF).
- C-y
- Delete the current line.
- C-o c
- Centre the current line between the margins.
- C-o n
- Change the name of the current buffer preserving undo history, user
bookmarks, etc.
- C-o r
- Redraw the screen.
- C-o s
- Split the current window into two. The resulting windows share the same
buffer. To undo the split just close one of the two windows with C-c.
- C-q <F2>
- C-q 2
- Save to files all the named buffers that have been modified. A named
buffer is one with an associated file name. This function is very useful
if you do a global replace on many buffers at once and want to save all
the modified buffers without pressing <F2> a lot of times.
- C-q u
- Update copyright notices in all buffers, inserting the current year in
the list of years and joining the groups of 3 or more consecutive years
in ranges. For this to work, the copyright notice format should be
'Copyright <optional_text> <list_of_years> <copyright_holder_name>',
and the year numbers must have four digits.
Year numbers separated by a comma ',' are counted individually.
Year numbers separated by a hyphen '-' are counted as a range.
7 Romanization
Romanization is the process of transliterating a language from its
(non-Latin) script into the Latin script. It can be useful when the
capability of rendering the non-Latin script is not available.
The command 'decode UTF-8' (see decode UTF-8) performs a context
independent transliteration of Cyrillic, Greek, Armenian, and Georgian
scripts, in UTF-8 format, into Latin script in ISO-8859-15 format. If the
transliteration is needed in UTF-8 format, it can be then encoded with the
command 'encode to UTF-8' (see encode to UTF-8).
8 Other features
- Emergency save
- When moe is interrupted by an abnormal event (a SIGTERM signal for example),
it tries to save all modified non-empty buffers in a file named
DEADMOE in the current directory. Each buffer is saved only once even
if it has multiple handles. (To prevent two terminating moes from writing to
the same DEADMOE, don't run more than one moe from the same directory).
- Basic 'less' emulation
- In read-only buffers the space bar scrolls forwards leaving 1 line of
context, 'b' scrolls backwards leaving 1 line of context, '/' acts
as 'Find', 'n' as 'Find next', 'N' as
'Find next' in reverse direction, and the scroll keys work without
the need of pressing the <Alt> key.
- Binary files
- As moe is 8-bit clean it is able to edit binary files, though in a somewhat
inconvenient way. If the file does not contain any newline character, all of
it is loaded as a single line.
- DOS files
- If moe detects at load time that all the complete lines of a file are
terminated by a CR/LF (carriage return/line feed) pair, moe assumes it is a
DOS file and removes all the CRs. The CRs are restored later when saving the
buffer to a file. If at least one CR is missing, no action is taken and CRs
are shown as control characters on the screen. If the last line is
unterminated, it is left as-is.
9 Reporting bugs
There are probably bugs in moe. There are certainly errors and omissions
in this manual. If you report them, they will get fixed. If you don't,
no one will ever know about them and they will remain unfixed for all
eternity, if not longer.
If you find a bug in GNU moe, please send electronic mail to
[email protected]. Include the version number, which you can
find by running 'moe --version'.
Concept index