Introduction to NE

This document is a quick introduction to NE, a full screen text editor for Unix. Complete information about its features is found in the manual "NE: A Nice Editor" by Sebastiano Vigna. You may obtain a full copy of the manual by typing
a2ps -P3hole /usr/local/doc/ne/ne.ps
on the command line.

In this document, references to special keys such as the Ctrl (Control) key and the Esc (Escape) key are made by placing the key name in square brackets, e.g., [Ctrl] or [Esc]. When [Ctrl] is to be used with another key, such as Z, the the sequence will be referenced by the symbol [Ctrl]Z. This means that the Ctrl key is held down while pressing the Z key and then releasing both keys.

CREATING AND MODIFYING FILES WITH NE

To create a new file, type "ne" at the default prompt. This will open a window which contains information about the editor; the window will clear as soon as you begin typing. At this point, the file has no name. You will need to name the file before you exit.

You can create a new file and name it simultaneously by typing "ne" at the default prompt followed by the name of the file you wish to create. For example, if you wish to create a file called "project.dat", simply type "ne project.dat" on the command line. A warning will appear on the initial screen that the file does not currently exist, but will disappear as soon as you begin typing.

To edit an existing file, type "ne filename.ext" at the default prompt where "filename.ext" represents the name of the file you wish to edit.

Note: You must have permission to write in the directory where you are attempting to create the file, i.e., you cannot create the file in a public-access directory such as /usr/local, but you can create a file in your own directory.

SAVING YOUR FILE AND EXITING

While you are editing, it is a good idea to save your edited file occasionally to prevent accidental loss. You can do this by pressing [Ctrl]S. If your editing session is accidentally terminated, ne will attempt to save a copy of an existing named file under the same name with a "#" as a prefix. If the file has not been named, a file with a numeric (hexadecimal) name will be saved. You can edit this file as you would any other file. You may wish to rename the file before continuing with your editing session, but be careful not to overwrite the old file before you make sure that the temporary file contains all the information you need.

To save your edited file and exit, first press [Ctrl]S. If the file has not been named, ne will prompt you for the name of a file. Type the name on the command line and press the [Return] key. Your changes will be saved in the named file. Then, press [Ctrl]Q to leave the editor.

To exit the editor without saving changes, press [Ctrl]Q. If you have made changes in the file, ne will ask if you wish to exit without saving the changes. If you wish to proceed, type "y". Otherwise, press the return key and you will be returned to the editor.

THE STATUS LINE

When you start ne, a Status Line will be displayed at the bottom of the screen. This will look like
       L:    48 C:     1 i   w pvu t   * foo.txt                            
L:
denotes the line in the document where the cursor is located (here, 48)
C:
denotes the column of the document where the cursor is located (here 1)
These numbers will change as you move around in the document.

The next sequence of letters shows special features which are turned on:

i:
insert mode (when insert is off, the mode is overstrike)
w:
word wrap
p:
automatic preferences (loads automatic preferences when file is opened)
v:
verbose macros (expands macros to full names)
u:
undo (saves actions in a memory buffer, allowing you to undo tasks)
t:
turbo (speeds processing by not refreshing screen until updates are complete)
Some of these characters may not be set automatically when you begin your editing session. Other characters may appear from time to time as you edit your file. For example, the letter M will appear when you mark a block of text for cutting or pasting. A complete list of options is available in the manual.

An asterisk (*) shows that the file has been changed since it was last saved.

The last entry gives the name of the file currently being edited (blank if ne was opened without specifying a file name), here "foo.txt".

From time to time, the Status Line will be overwritten with messages. It will be restored when you begin editing again.

MENUS, CONTROL KEYSTROKES, AND COMMAND LINE

Editing in ne is straightforward; when you wish to add text to a document, position the cursor at the appropriate spot using the arrow keys and begin typing. If you are inserting text, be sure that ne is in insert mode (see the Status Line, above). If you need to change the mode, or access special features in ne, you may access menus which show available features. This is done by pressing [F1] or [Esc]. Response using the [F1] key is faster. After pressing [F1], the menu bar will appear, listing the names of the eight menus. You may obtain a listing of the features available with each menu by using the left (<-) and right (->) arrow keys to move the cursor across the bar line. The menus available are listed below.

Project:
Controls loading, saving, and exiting files
Documents:
Commands to create, destroy, or browse through new documents
Edit:
Commands for selecting, cutting, copying, and pasting text
Search:
Commands for finding and replacing text, or going to selected locations in the text
Macros:
Commands to record, play, and save macros
Extras:
Commands to obtain help, execute commands, refresh the screen, undo actions, center or change case in text.
Navigation:
Controls moving left, right, up, or down by character, word, or line
Prefs:
Sets preferences such as tab size, insert mode, word wrap, right margin, or loads preferences files
To select an item in a menu, first use the left or right arrow keys to get to the proper menu or type the uppercase letter which begins the name of the selection (P, D, E, S, M, E, N). If there are multiple menus beginning with the same letter, ne will go to the first menu to the right of its current position whose name begins with the same letter. Then, use the up or down arrows to go to the proper selection or type the lowercase first letter of the item you want. Then press the return key.

You may use "accelerator keys" to carry out many tasks without accessing the menu. These sequences are displayed next to the items in the menu. For instance, ^Y means to press the [Ctrl] and Y key simultaneously. Similarly, ]Y means to press [Alt] and Y simultaneously. The action taken will depend on whether the [Ctrl] or [Alt] key is used. [Ctrl]Y will delete the current line regardless of the cursor location within the line, while [Alt]Y will delete from the cursor location to the end of the line. Still other commands are accessed by using function keys (e.g., F10 brings up the Help Menu). A list of the accelerator key sequences and their actions appears in the Appendix.

To turn the menu off without performing any action, press [F1] or [Esc] again.

You may also use a command line rather than the menu. Each item in the menu corresponds to a command which you can type in full or use a default abbreviation. To bring up the command line, press [Ctrl]K. Then type the name of the command you wish to execute. For instance, [Ctrl]K followed by typing the word "save" will save your edited file under the name given on the status line. Not all menu items have accelerator sequences, but they can be accessed by using the command line. The Appendix also includes a list of the command abbreviations which can be used with [Ctrl]K for most of the commonly used actions. There are also commands which are not listed in the menu. These are given in the full manual.

ACCESSING HELP IN NE

To obtain a listing of commands and find out what they do, select the Help option in the Extras menu, press f10, or press [Ctrl]K and type "help". This will bring up a listing of commands. Then position the cursor on the command you wish information about and press [Return].

BASIC EDITING COMMANDS

The left, up, down, and right arrows are used to move the cursor in the file. [Ctrl]A will move you to the beginning of the line you are on, and [Ctrl]Z will move you to the end of the line.

To enter text in the file, first postion the cursor at the appropriate spot and then begin typing. If you wish to overstrike existing text, select the Insert option from the Prefs menu. This option "toggles" the insert mode, i.e., if you are in insert mode, it changes your editing to overstrike mode, and vice versa.

To delete existing text, move to the right of the text you wish to remove and press the Delete key (on some keyboards, you may have to use the Backspace key).

You may cut or copy blocks of text by following these steps.

  1. Move to the beginning of the text you wish to block.
  2. Press [Ctrl]B to begin blocking the text and move to the end of the block (it will not be highlighted on your screen).
  3. Press [Ctrl]C to copy the text of [Ctrl]X to cut the text.
  4. If you wish to enter the text at a different location, move to the location and press [Ctrl]V.
You can also copy or cut columns of text using ne.
  1. Move to the beginning of the text you wish to block.
  2. Press [Ctrl]@ to begin blocking the text and move to the end of the block (it will not be highlighted on your screen). This sequence does not work on some types of keyboards, so you can press [Ctrl]K and type "MV" (Mark Vertical). (Or select the action off the Edit Menu.)
  3. Press [Ctrl]C to copy the text of [Ctrl]X to cut the text.
  4. If you wish to enter the text at a different location, move to the location and press [Ctrl]W.

SEARCHING FOR AND REPLACING TEXT

To find a string of text in a file, press [Ctrl]F. Enter the string you wish to search for on the command line. The editor will search forward in the text (default) for the string. If you wish to search backward from the current position, press [Ctrl]K and enter SearchBack (or SB). If you wish the search to be case-sensitive (i.e., match the case string exactly), press [Ctrl]K and type CaseSearch (CS). Turn these options off by repeating the command.

To replace a string of text, first find the string. Then press [Ctrl]R and enter the string which you wish to substitute. The following line will appear:

 
       Replace  (Yes/No/Last/All/Quit/Backward): n
The options are:
Yes:
Replace the found string and move to the next match;
No:
Do not replace the found string and move to the next match;
Last:
Replace the found string and stop the search;
All:
Replace all found strings with the given string;
Quit:
Stop the search immediately without replacing;
Backward:
Reverse search direction (may appear as Forward depending on current direction of search).
Enter the first character of the appropriate option. The default option is n.

CUSTOMIZING NE

You can reassign key bindings (the mappings assigned to the control and function keys) or redesign menus in ne to match your preferences. Certain keys may not be reassigned (Return or Escape), but many others may be reset. Changing the key bindings will not affect the control sequences listed in the menus. Custom keypad mappings and menus are set when ne reads files in the subdirectory $HOME/.ne ("$HOME" means your root directory). For details on changing these mappings, see the ne manual.

APPENDIX. Control and Function Key Sequences and Command Names

The following list summarizes the control and function key sequences which are default mappings in ne. These appear in the menus next to the command description. The command name is presented next to the description with its abbreviation. To use these, press [Ctrl]K or select Exec from the Extras menu and then type the command name or abbreviation. Note: Because of differences in terminal types, some control and function key sequences may work differently in your environment.

[Ctrl] Seq    Description                         Command Name    Abbrev.
                                                                
    ^A        Move to beginning of line           MoveSOL         SOL
    ^B        Begin marking block (toggle)        Mark            M
    ^C        Copy block                          Copy            C
    ^D        Open new document                   OpenNew         ON
    ^E        End of Line                         MoveEOL         EOL
    ^F        Find                                Find            F
    ^G        Repeat last                         RepeatLast      RL
    ^H        Backspace (delete to left of cursor)BackSpace       BS
    ^I        Tab                                  -              -
    ^J        Go to line                          GotoLine        GL
    ^K        Exec (give command line)            Exec            EX
    ^L        Refresh screen                      Refresh         REF
    ^M        (return key)                         -              -
    ^N        Next page                           NextPage        NP
    ^O        Open existing document              Open            O
    ^P        Previous page                       PrevPage        PP
    ^Q        Quit file, closing document         Quit            Q
    ^R        Replace                             Replace         R
    ^S        Save current document               Save            S
    ^T        Start/stop recording macro          Record          R
    ^U        Undelete line                       UndelLine       UL
    ^V        Paste selection                     Paste           P
    ^W        Paste vertical selection            PasteVert       PV
    ^X        Cut block                           Cut             CU
    ^Y        Delete line                         DeleteLine      DL
    ^Z        Suspend                             Suspend         SU
    ^@        Mark column (toggle)                MarkVert        MV
                                                                
                                                                
[Alt] Seq     Description                         Command Name     Abbrev.
                                                                      
    [A        Move to Beginning of Document       Start of File     SOF
    [B        Move to Previous Word               Previous Word     PW
    [C        Shift Text visible vert/hor         Adjust View       AV
    [D        Switch to Next Document in List     Next Document     ND
    [E        Move to End of Document             End of File       EOF
    [F        Move to Next Word                   Next Word         NW
    [G        Move to current mark                Go to BookMark    GB
    [I        Sets Auto Indent Flag               Auto Indent       AI
    [J        Move Cursor to Column #             Go to Column      GC
    [K        Set mark at current position        Set Bookmark      M
    [L        Lower case                          To Lower          TL
    [M        Play macro once                     Play Once         PL
    [N        New Document                        Open New          N
    [O        Open file as clip                   Open Clip         OC
    [P        Format paragraph                    Paragraph         PA
    [Q        Close document and exit (no save)   Quit              Q
    [R        Redo last action                    Redo              RE
    [S        Save clip on filename               Save Clip         SC
    [T        Ask Shell to execute command        Through           T
    [U        Undo last action                    Undo              U
    [V        Upper Case                          To Upper          TU
    [W        Set word wrap flag                  Word Wrap         WR
    [X        Save document, close, and exit      Exit              X
    [Y        Delete from cursor to end of line   Delete EOL        DE
    [Z        Set CR/LF flag                      CRLF              CRLF
                                                                    

Default function key settings:                                      
                                                                    
    F1        Menus
    F2        Next document                       NextDoc       ND
    F3        Previous document                   PrevDoc       PD
    F4        List documents                       -            -
    F5        Undo                                Undo          U
    F6        Redo                                Redo          RE
    F7        Previous word                       PrevWord      PW
    F8        Next word                           NextWord      NW
    F9        Play once                           Play          PL
    F10       Help                                Help          H

Patricia Jones, Ph.D.
UITS Research Support
pjones@arizona.edu
10/29/2001