Go to the first, previous, next, last section, table of contents.


Reference

In this chapter we shall methodically overview each part of ne. It is required reading for becoming an expert user because some commands and features are not available through menus.

Arguments

The main arguments you can give to ne are the names of files you want to edit. They will be loaded into separate documents.

The --noconfig option skips the reading of the key bindings and menu configuration files (see section Configuration). This is essential if you are experimenting with a new configuration and you make mistakes in it.

The --macro filename option specifies the name of a macro that will be started just after all documents have been loaded. A typical macro would move the cursor to a certain line.

The --keys filename option and the --menus filename option specify a name different from the default one (`.keys' and `.menus', respectively) for the key bindings and the menu configuration files. Note that ne searches for these files first in the current directory, and then in your `~/.ne' directory.

The Status Bar

The last line of the screen, the status bar, is reserved by ne for displaying some information about its internal state. Note that on most terminals it is physically impossible to write a character on the last column of the last line, so we are not stealing precious editing space.

The status bar looks more or less like this:

L:   31  C:   25  iabcwfpvurBMRP* 20 /foo/bar

The numbers after `L:' and `C:' are the line and column of the cursor position. The first line and the first column are both number 1.

Following that are a sequence of letters or dashes. These indicate the status of a series of flags which we shall look at later.

The two hexidecimal digits following the flags are the code for the character at the cursor, and are displayed optionally (see section HexCode). If your cursor is at or beyond the right end of the current line, the code shown is `00'.

The file name appearing after the character code is the file name of the current document. The left end of very long file names may be truncated to keep the right end visible. Of course, ne is keeping track internally of the complete file name. It is used by the Save command and as the default input for the SaveAs command. See section Save, and section SaveAs.

The displayed line and column numbers and the character code change when the cursor moves. This fact can really slow down cursor movement if you are using ne through a slow connection. If you find this a problem, it is a good idea to turn off the status bar using either the `Status Bar' menu item of the `Prefs' menu or the StatusBar command. See section StatusBar. Note that if you really need the speed, you could also to turn on the fast GUI mode using either the `Fast GUI' menu item of the `Prefs' menu or the FastGUI command (see section FastGUI). In fast GUI mode the status bar is not draw in reverse, so some additional optimization can be done when refreshing it.

The letters after the line and column number represent the status of the flags associated with the current document. Flags that are off display a `-' instead of a letter. Each flag also has an associated command. The Flags command describes them all when you don't have this manual handy. Here's the list in detail:

`i'
appears if the insert flag is true. See section Insert.
`a'
appears if the auto indent flag is true. See section AutoIndent.
`b'
appears if the back search flag is true. See section SearchBack.
`c'
appears if the case sensitive search flag is true. See section CaseSearch.
`w'
appears if the word wrap flag is true. See section WordWrap.
`f'
appears if the free form flag is true. See section FreeForm.
`p'
appears if the automatic preferences flag is true. See section AutoPrefs.
`v'
appears if the verbose macros flag is true. See section VerboseMacros.
`u'
appears if the undo flag is true. See section DoUndo.
`r'
appears if the read only flag is true. See section ReadOnly.
`B'
appears if the binary flag is true. See section Binary.
`M'
appears if you are currently marking a block. See section Mark.
`V'
can appear in place of `M' if you are currently marking a vertical block. See section MarkVert.
`R'
appears if you are currently recording a macro. See section Record.
`P'
appears if the PreserveCR flag is true. See section PreserveCR.
`*'
appears if the document has been modified since the last save, or if the Modified command was issued to set this flag. See section Modified.

Note that sometimes ne needs to communicate some message to you. The message is usually written over the status bar, where it stays until you do something. Any action such as moving the cursor or inserting a character will restore the normal status bar.

The Input Line

The bottom line of the screen is usually occupied by the status bar (see section The Status Bar). However, whenever ne prompts you for a command or file name or asks you to confirm some action, the bottom line becomes the input line. You can see this because a prompt is displayed at the start of the line, suggesting what kind of input is required. (Prompts always ends with a colon, so it is easy to distinguish them from error messages, which overwrite the status line from time to time.)

ne uses the input line in two essentially different ways: immediate input and long input. You can easily distinguish between these two modes because in immediate input mode the cursor is not on the input line, while for long input mode it is.

Immediate input is used whenever ne needs you to specify a simple choice that can be expressed by one character (for example, `y' or `n'). When you type the character, ne will immediately accept and use your input. Most immediate inputs display a character just after the prompt. This character is the default response, which is used if you just press the Return key. Note that immediate input is not case sensitive. Moreover, if a yes/no choice is requested, anything other than `y' will be considered a negative response.

Long input is used when a whole string is required. You can enter and edit your response to long inputs like a line of text in a document. All the key bindings related to line editing work on the command line exactly as they do in a document. This is true even of custom key bindings. Just edit as you are used to. Moreover, the contents of the input line can be replaced by the first line of the current clip using the keystroke that is bound to the Paste command, usually Control-V. If your long input is longer than the screen width, the input line scrolls to accomodate your text so you can input very long lines even on small monitors. (There is a limit of 1024 characters.)

The default response to a long input is the response you gave to the previous long input. Your first action when presented with a long input will either erase the default response or allow you to edit it. If the first thing you type is a printing character, the default response will be erased. Anything else (cursor movement for example) will allow you to edit it further.

Long input also lets you access your previous long input responses with the up and down cursor commands. Once you find a previous input you like, you can edit it further. Long input history is not document specific, so you can recall any of your inputs regardless of which document was active when you entered it. Furthermore, ne saves the most recent long inputs in `~/.ne/.history' when you end your ne session and loads them again when you begin another ne session.

When asked to input a number, you can choose between decimal, octal and hexadecimal notation in the standard way: a number starting with `0' is considered in octal, a number starting with `0x' is considered in hexadecimal, and in all other cases decimal base is assumed.

Whenever a file name is requested, you can type a partial file name and complete it with the Tab key. ne will scan the current directory (or the directory that you partially specified) and search for the files matching your partial suggestion. The longest prefix common to all such files will be copied on the input line (ne will beep if no completion exists). It's easier done than said--just try. If you press Tab again, you will be brought into the file requester: only the files and directories matching your partial specification will appear, and as usual you will be able to navigate and select a file or escape. See section The Requester. Note that ne considers the last word on the input line the partial file name to complete, no matter where the cursor is currently (you can use quotes if the name contains spaces).

Complete long input with the Return key. You can cancel a long input using f1, Escape, or any key that is bound to the Escape command. The effect will vary depending on what your were requested to input, but the execution of the command requiring the input will stop.

The Command Line

The command line is a typical (topical) way of controlling an editor on character driven systems. It has some advantages over menus in terms of access speed, but it is not desirable from a user interface point of view. ne has a command line that should be used whenever strange features have to be accessed, or whenever you want to use a command that you are familiar with and that is not bound to any key.

You have two ways to access the command line: by activating the menu and typing a colon (`:') or by typing Control-K (or any key that is bound to the Exec command; see section Exec). The first method will work regardless of any key binding configuration if you activate the menus with the Escape key since that key cannot be reconfigured.

Once you activate the command line, the status bar will turn into an input line (see section The Input Line) with a `Command:' prompt waiting for you to do a long input. In other words, you can now type any command (possibly with arguments), and when you press Return, the command will be executed.

If the command you specify does not appear in ne's internal tables, it is considered to be the name of a macro. See section Basic Macros, for details.

The Requester

In various situations, ne needs to ask you to choose one string from several (where "several" can mean a lot, even hundreds). For this kind of event, the requester is issued. The requester displays the strings in as many columns as possible and lets you move with the cursor from one string to another. The strings can fill many screens, which are handled as consecutive pages. All the navigation keys work exactly as in normal editing. This is true even of custom key bindings. Thus, for instance, you can page up and down through the list with Control-P and Control-N (in the standard keyboard configuration).

As with the input line (see section The Input Line), you can confirm your input with Return or escape the requester with f1 or the Escape key (or whatever has been bound to the Escape command). Moreover, if you are selecting a file name there is a third possibility: by escaping with the Tab key, the file or directory name that the cursor is currently on will be copied on the input line. This allows to choose an existing name and modify it.

A special feature is bound to alphabetic characters: they move you to the next entry starting with the letter you typed. The search is case insensitive, and it continues on to the first string after having passed the last one.

An example of a requester is the list of commands appearing when you use the Help command. Another example is the file requester that ne issues whenever a file operation is going to take place. In this case, pressing Return while on a directory name will enter the directory. Note also that, should the requester take too long to appear, you can interrupt the directory scanning with Control-\. However, the listing will likely be incomplete.

Note that there are two items that always appear in the file requester: `./' and `../'. The first one represents the current directory and can be used to force a reread of the directory. The second one represents the parent directory and can be used to move up by one directory level.

Menus

ne's menus are extremely straightforward. The suggested way of learning their use is by trial and error, with a peek here and there at this manual when some doubts arise.

You activate menus with the f1 key, or in case your keyboard does not have such a key, Escape, or any key that is bound to the Escape command. Move around the menus pressing with the cursor keys and the page up/down keys (which move to the first or last menu item in a menu). You can also move around menus and menu items by pressing the alphabetic keys; a lower case letter will move to the first item in the current menu whose name starts with the given letter; an upper case letter will move to the first menu whose name starts with the given letter.

Each menu item of ne's standard menu corresponds to a single command. In explaining what each menu item allows you to do, we shall simply refer you to the section that explains the command relative to the menu item.

If you plan to change ne's menu (see section Changing Menus), you should take a look at the file `default.menus' that comes with ne's distribution. It contains a complete menu configuration that clones the standard one.

File

The File menu contains standard items that allow loading and saving files. Quitting ne (which doesn't save changes) or exiting ne (which does save changes) is also possible.

`Open...'
See section Open.
`Open New...'
See section OpenNew.
`Save'
See section Save.
`Save As...'
See section SaveAs.
`Quit Now'
See section Quit.
`Exit (Save)'
See section Exit.
`About'
See section About.

Documents

The Documents menu contains commands that create new documents, destroy them, and browse through them.

`New'
See section NewDoc.
`Clear'
See section Clear.
`Close'
See section CloseDoc.
`Next'
See section NextDoc.
`Prev'
See section PrevDoc.
`Select...'
See section SelectDoc.

Edit

The Edit menu contains commands related to cutting and pasting text.

`Mark Block'
See section Mark.
`Cut'
See section Cut.
`Copy'
See section Copy.
`Paste'
See section Paste.
`Erase'
See section Erase.
`Through'
See section Through.
`Delete Line'
See section DeleteLine.
`Mark Vert'
See section MarkVert.
`Paste Vert'
See section PasteVert.
`Open Clip...'
See section OpenClip.
`Save Clip...'
See section SaveClip.

Search

The Search menu contains commands related to searching for specific contents or locations within a document.

`Find...'
See section Find.
`Find RegExp...'
See section FindRegExp.
`Replace...'
See section Replace.
`Replace Once...'
See section ReplaceOnce.
`Replace All...'
See section ReplaceAll.
`Repeat Last'
See section RepeatLast.
`Goto Line...'
See section GotoLine.
`Goto Col...'
See section GotoColumn.
`Goto Mark...'
See section GotoMark.
`Match Bracket'
See section MatchBracket.

Macros

The Macros menu contains commands related to creating and using macros.

`Record'
See section Record.
`Stop'
See section Record.
`Replace...'
See section Replace.
`Play Once'
`Play Many...'
See section Play.
`Play Macro...'
See section Macro.
`Open Macro...'
See section OpenMacro.
`Save Macro...'
See section SaveMacro.

Extras

This menu contains a few special items that don't fit in obvious ways into other menus.

`Exec...'
See section Exec.
`Suspend'
See section Suspend.
`Help...'
See section Help.
`Refresh'
See section Refresh.
`Undo'
See section Undo.
`Redo'
See section Redo.
`Undel Line'
See section UndelLine.
`Center'
See section Center.
`Paragraph'
See section Paragraph.
`AdjustView'
See section AdjustView.
`ToUpper'
See section ToUpper.
`ToLower'
See section ToLower.
`Capitalize'
See section Capitalize.

Navigation

The Navigation menu contains commands related moving around in a document.

`Move Left'
See section MoveLeft.
`Move Right'
See section MoveRight.
`Line Up'
See section LineUp.
`Line Down'
See section LineDown.
`Prev Page'
See section PrevPage.
`Next Page'
See section NextPage.
`Page Up'
See section PageUp.
`Page Down'
See section PageDown.
`Top/Bottom'
See section ToggleSEOF.
`Beg Of Line'
See section MoveSOL.
`End Of Line'
See section MoveEOL.
`Top Of Screen'
See section MoveTOS.
`Bottom Of Screen'
See section MoveBOS.
`Prev Word'
See section PrevWord.
`Next Word'
See section NextWord.

Prefs

The Prefs menu contains commands related to setting, storing, and using your prefered document flags.

`Tab Size...'
See section TabSize.
`Insert/Over'
See section Insert.
`Free Form'
See section FreeForm.
`Status Bar'
See section StatusBar.
`Hex Code'
See section HexCode.
`Fast GUI'
See section FastGUI.
`Word Wrap'
See section WordWrap.
`Right Margin'
See section RightMargin.
`Auto Indent'
See section AutoIndent.
`Preserve CR'
See section PreserveCR.
`Load Prefs...'
See section LoadPrefs.
`Save Prefs...'
See section SavePrefs.
`Load AutoPrefs'
See section LoadAutoPrefs.
`Save AutoPrefs'
See section SaveAutoPrefs.
`Save Def Prefs'
See section SaveDefPrefs.

Regular Expressions

Regular expressions are a powerful way of specifying complex search and replace operations.

Syntax

The following section is taken (with minor modifications) from the GNU regular expression library documentation and is Copyright © Free Software Foundation.

A regular expression describes a set of strings. The simplest case is one that describes a particular string; for example, the string `foo' when regarded as a regular expression matches `foo' and nothing else. Nontrivial regular expressions use certain special constructs so that they can match more than one string. For example, the regular expression `foo|bar' matches either the string `foo' or the string `bar'; the regular expression `c[ad]*r' matches any of the strings `cr', `car', `cdr', `caar', `cadddar' and all other such strings with any number of `a''s and `d''s.

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 character and nothing else. The special characters are `$', `^', `.', `*', `+', `?', `[', `]' , `(', `)' and `\'. Any other character appearing in a regular expression is ordinary, unless a `\' precedes it.

For example, `f' is not a special character, so it is ordinary, and therefore `f' is a regular expression that matches the string `f' and no other string. (It does not match the string `ff'.) Likewise, `o' is a regular expression that matches only `o'.

Any two regular expressions a and b can be concatenated. The result is a regular expression that matches a string if a matches some amount of the beginning of that string and b matches the rest of the string.

As a simple example, we can concatenate the regular expressions `f' and `o' to get the regular expression `fo', which matches only the string `fo'. Still trivial.

Note: special characters are treated as ordinary ones if they are in contexts where their special meanings make no sense. For example, `*foo' treats `*' as ordinary since there is no preceding expression on which the `*' can act. It is poor practice to depend on this behavior; better to quote the special character anyway, regardless of where is appears.

The following are the characters and character sequences that have special meaning within regular expressions. Any character not mentioned here is not special; it stands for exactly itself for the purposes of searching and matching.

`.'
is a special character that matches anything except a newline. Using concatenation, we can make regular expressions like `a.b', which matches any three-character string which begins with `a' and ends with `b'.
`*'
is not a construct by itself; it is a suffix, which means the preceding regular expression is to be repeated as many times as possible. In `fo*', the `*' applies to the `o', so `fo*' matches `f' followed by any number of `o''s. The case of zero `o''s is allowed: `fo*' does match `f'. `*' always applies to the smallest possible preceding expression. Thus, `fo*' has a repeating `o', not a repeating `fo'.
`+'
`+' is like `*' except that at least one match for the preceding pattern is required for `+'. Thus, `c[ad]+r' does not match `cr' but does match anything else that `c[ad]*r' would match.
`?'
`?' is like `*' except that it allows either zero or one match for the preceding pattern. Thus, `c[ad]?r' matches `cr' or `car' or `cdr', and nothing else.
`[ ... ]'
`[' begins a character set, which is terminated by a `]'. In the simplest case, the characters between the two form the set. Thus, `[ad]' matches either `a' or `d', and `[ad]*' matches any string of `a''s and `d''s (including the empty string), from which it follows that `c[ad]*r' matches `car', et cetera. Character ranges can also be included in a character set, by writing two characters with a `-' between them. Thus, `[a-z]' matches any lower-case letter. Ranges may be intermixed freely with individual characters, as in `[a-z$%.]', which matches any lower case letter or `$', `%' or period. Note that the usual special characters are not special any more inside a character set. A completely different set of special characters exists inside character sets: `]', `-' and `^'. To include a `]' in a character set, you must make it the first character. For example, `[]a]' matches `]' or `a'. To include a `-', you must use it in a context where it cannot possibly indicate a range: that is, as the first character, or immediately after a range.
`[^ ... ]'
`[^' begins a complement character set, which matches any character except the ones specified. Thus, `[^a-z0-9A-Z]' matches all characters except letters and digits. `^' is not special in a character set unless it is the first character. The character following the `^' is treated as if it were first (it may be a `-' or a `]').
`^'
is a special character that matches the empty string -- but only if at the beginning of a line in the text being matched. Otherwise it fails to match anything. Thus, `^foo' matches a `foo' that occurs at the beginning of a line.
`$'
is similar to `^' but matches only at the end of a line. Thus, `xx*$' matches a string of one or more `x''s at the end of a line.
`\'
has two functions: it quotes the above special characters (including `\'), and it introduces additional special constructs. Because `\' quotes special characters, `\$' is a regular expression that matches only `$', and `\[' is a regular expression that matches only `[', and so on. For the most part, `\' followed by any character matches only that character. However, there are several exceptions: characters which, when preceded by `\', are special constructs. Such characters are always ordinary when encountered on their own.
`|'
specifies an alternative. Two regular expressions a and b with `|' in between form an expression that matches anything that either a or b will match. Thus, `foo|bar' matches either `foo' or `bar' but no other string. `|' applies to the largest possible surrounding expressions. Only a surrounding `( ... )' grouping can limit the grouping power of `|'.
`( ... )'
is a grouping construct that serves three purposes:
  1. To enclose a set of `|' alternatives for other operations. Thus, `(foo|bar)x' matches either `foox' or `barx'.
  2. To enclose a complicated expression for the postfix `*' to operate on. Thus, `ba(na)*' matches `bananana' et cetera, with any (zero or more) number of `na''s.
  3. To mark a matched substring for future reference.
This last application is not a consequence of the idea of a parenthetical grouping; it is a separate feature that happens to be assigned as a second meaning to the same `( ... )' construct because there is no conflict in practice between the two meanings. Here is an explanation of this feature:
`\digit'
After the end of a `( ... )' construct, the matcher remembers the beginning and end of the text matched by that construct. Then, later on in the regular expression, you can use `\' followed by digit to mean "match the same text matched the digit'th time by the `( ... )' construct." The `( ... )' constructs are numbered in order of commencement in the regexp. The strings matching the first nine `( ... )' constructs appearing in a regular expression are assigned numbers 1 through 9 in order of their beginnings. `\1' through `\9' may be used to refer to the text matched by the corresponding `( ... )' construct. For example, `(.+)\1' matches any non empty string that is composed of two identical halves. The `(.+)' matches the first half, which may be anything non empty, but the `\1' that follows must match the same exact text.
`\b'
matches the empty string, but only if it is at the beginning or end of a word. Thus, `\bfoo\b' matches any occurrence of `foo' as a separate word. `\bball(s|)\b' matches `ball' or `balls' as a separate word.
`\B'
matches the empty string, provided it is not at the beginning or end of a word.
`\<'
matches the empty string, but only if it is at the beginning of a word.
`\>'
matches the empty string, but only if it is at the end of a word.
`\w'
matches any word-constituent character.
`\W'
matches any character that is not a word-constituent.

Replacing regular expressions

Also the replacement string has some special feature when doing a regular expression search and replace. Exactly as during the search, `\' followed by digit stands for "the text matched the digit'th time by the `( ... )' construct in the search expression". Moreover, `\0' represent the whole string matched by the regular expression. Thus, for instance, the replace string `\0\0' has the effect of doubling any string matched.

Another example: if you search for `(a+)(b+)', replacing with `\2x\1', you will match any string composed by a series of `a''s followed by a series of `b''s, and you will replace it with the string obtained by moving the `a' in front of the `b''s, adding moreover `x' inbetween. For instance, `aaaab' will be matched and replaced by `bxaaaa'.

Note that the backslash character can escape itself. Thus, to put a backslash in the replacement string, you have to use `\\'.

Automatic Preferences

Automatic preferences let you set up a custom configuration that is automatically used whenever you open a file with a given extension. For instance, you may prefer a TAB size of three when editing C sources, but eight could be more palatable when writing electronic mail.

The use of autoprefs is definitely straightforward. You simply use the `Save AutoPrefs' menu item (or the SaveAutoPrefs command; see section SaveAutoPrefs) when the current document has the given extension and the current configuration suits your tastes. The internal state of a series of options will be recorded as a macro containing commands that reproduce the current configuration. The macro is then saved in the `~/.ne' directory (which is created if necessary) with the name given by the extension, postfixed with `#ap'. Thus, the C sources automatic preferences file will be named `c#ap', the one for TeX files `tex#ap', and so on.

Macros are generated with short or long command names depending on the status of the verbose macros flag. See section VerboseMacros.

Automatic preferences files are loaded and executed whenever a file with a known extension is opened. Note that you can manually edit such files, and even insert commands, but any command that does something other than setting a flag will be rejected, and an error message will be issued.

Emergency Save

When ne is interrupted by an abnormal event (for instance, the crash of your terminal), it will try to save all unsaved documents in its current directory. Named documents will have their names prefixed with a `#'. Unnamed documents will be given names made up of hexadecimal numbers obtained by some addresses in memory that will make them unique.


Go to the first, previous, next, last section, table of contents.