NLED DOCUMENTATION (ver 2.5) copyright 2003 by Evan Alexander Weaver distributable under the GNU GPL Section 1. Description NLED (Neat Little EDitor) is a free (GNU GPL) text/binary file editor. NLED is easy to use and yet powerful enough to serve as a programmer's editor. While it has such standard text editor capabilities as block moves and search and replace, the features which make NLED unique are: * The ability to edit binary files as if they were text files. This makes NLED handy for such diverse tasks as hand-editing files with binary data (e.g. database files) and patching executable files. * What you see on the screen is what is there in the file. Every byte takes up one and only one screen position. * There is no maximum line length, so that text files with very long lines can be edited without having the lines truncated or wrapped. * You may search and replace using non-printable characters. Originally written for the PC, NLED is tailored to the make full use of the keyboard, even in Unix/Linux ports. In the Unix/Linux versions, redundant key codes are used for the keys which are typically mismapped due to improper terminfo setup (for example, does the same thing as in Unix/Linux versions, in case PgDn is not properly mapped). While NLED is a free product, it is copyrighted (1987-2003) by Evan Weaver and HAS NO WARRANTY. The NLED program (nled.exe) and this documentation, along with the NLED source code, may be distributed free of charge, under the provisions of the GNU General Public License. For further information, read the file nled.txt in the source code package, or contact the author at: Evan Weaver (Weaver Computer Development Services) 131 Langford Avenue Toronto, Ontario, Canada M4J 3E5 Internet: evan.weaver@senecac.on.ca Section 2. Starting NLED NLED can be started by entering NLED [options] [file name] on the command line, where the square brackets indicate optional information. (Do not type the square brackets). The file name, if supplied, should follow the conventions for a file name on the system you are using, and is the name of the file you wish to edit. If that file does not exist, it will be created when you save it from NLED. If you do not specify a file name, you will have to name the file within NLED before you can save it. Once NLED is started, you are presented with the file for editing. A status line is displayed at the bottom of the screen. Windows/OS2 option: the Windows and OS/2 versions of NLED allow the option /Cbf where each of b and f are to be replaced with a number between 0 and 7. The first number identifies the background color and the second number identifies the foreground color. Color number 0 is black, while color number 7 is white. The availability of other colors depends upon the video adapter you have in your computer. Some experimentation may be necessary. As an example, the switch /C31 will use text in color number 1 shown on a background of color number 3. If the /C is given with no numbers following it, NLED will use the current DOS colors. Unix/Linux option: the Unix/Linux versions of NLED allow the option -s which prevents the status bar at the bottom of the screen from displaying information that changes with every keypress, thereby improving response over a slow connection. Section 3. Editing Mode Keys NLED has two modes: editing mode (where your typing is applied to the file that you are editing) and command mode (where you enter commands to perform certain actions). From editing mode, you get to command mode by pressing the key. From command mode, you get back to editing mode either by pressing or by performing a command. The key to using NLED, then, is to remember to press the key. When in editing mode, the keys you press are usually placed in the document. The following keys, however, have special purposes: [also in Unix/Linux] toggles between insert mode and overstrike mode. The default is insert mode, though the setting is saved in the configuration (see the V escape sequence). deletes the current character. (the left arrow above the key) deletes the previous character. in Windows and OS/2 in Unix/Linux allows you to enter a hexadecimal code for the byte to be entered at the current cursor position. The cursor jumps down to the hexadecimal code display on the status line to allow you to enter a hex code. [also in Unix/Linux] moves to the beginning of the current line. in Windows and OS/2 in Unix/Linux moves to the top (first line) of the screen. moves to the end of the line. in Windows and OS/2 in Unix/Linux moves to the bottom (last line) of the screen. moves up one screen. in Windows and OS/2 in Unix/Linux moves to the beginning (top) of the file. move down one screen. in Windows and OS/2 in Unix/Linux moves to the end (rear) of the file. moves one character left. in Windows and OS/2 in Unix/Linux moves one word left (next word). moves one character right. in Windows and OS/2 in Unix/Linux moves one word right (previous word). moves one line up. moves one line down. Function keys (- in Unix/Linux and -, - , - and - in Windows and OS/2) are all programmable by the user to represent any series of up to 9 keystrokes each. See the P escape sequence described below. Also see the template of the default function key definitions presented later. goes into command mode, where you enter one character commands to perform actions, described next. Section 4. Commands (Escape Sequences) The allowable commands, entered at the "Command?" prompt are: ? displays a help screen summarizing all special keys and escape sequences. A asks you to set the "Attention" level to 0, 1 or 2. This determines the threshold at which NLED sounds a beep (0 means don't beep, 1 means beep on severe errors only and 2 means beep on all errors). Note that this setting does not stop DOS from beeping (for example, if you fill up the type-ahead buffer). By default, the attention level is 2, although the current setting can be saVed in a configuration file. B marks the Beginning of a "block". When a block is marked, it is displayed in bold. You must also mark the end of a block with the E command. C Copies the marked block to the current cursor position. D Deletes the marked block from the file. E marks the End of a block. F is used to Find a text string. You are prompted for the string and then the program searches for an exact match to that string starting at the current cursor position. G allows you to Go to a specific line. You are asked for the number of the line. H is used to cHange the file access mode. You are prompted to enter B (for binary mode), T (for normal text mode) or Z (for text mode with a control-Z character marking the end of the file). The default access mode is T, although the current setting can be saVed as part of the configuration file. See a later section for the differences between the three modes. I allows you to Import (read in from disk) another file into the current file. You are asked for the name of the file to import, and then that file is inserted into the current file at the current cursor position. K turns on or off the c(K)ompression of leading spaces on a line into Tab characters when the file is saved. The compression, even if on, will not be done if the file is saved in binary mode (B when you cHange the file access mode). The Windows and OS/2 default is off, while the Unix/Linux default is on (because on some Unix/Linux systems, subordinate Makefile lines MUST start with tabs), although the setting can be saVed as part of the configuration file. L Loads a file into the editor. If the current file has unsaved changes, you are given a chance to save it before the new file is loaded. You are asked for the name of the file to be loaded. M Moves the marked block to the current cursor position. Note that C copies (i.e. duplicates) the block, whereas M removes the block from one location and places it at the new location. N lets you give a new Name to the file being edited. O allows you to run an Operating system (DOS) command. You are asked to enter the command to be executed. If you just press , then an operating system shell is run, allowing you to use the command prompt; on most systems you must use the "exit" command to return to the editor from the shell. P is used to program a function key. You are asked (a) to press the function key you wish to program, (b) to say how many (0 - 9) keystrokes should be stored in that key and (c) to press the keys which should be stored in that key. Note that if one function key calls another, control never returns to the original key (i.e. function keys can only chain to one another). Also note that function keys can only nest 20 levels deep, to prevent you from programming "infinite" loops. Q Quits the editing session without saving the file. If the file has any changes which haven't been saved, you are given the chance to save it before quitting. R is used to search for a text string and Replace it with another. You are prompted to enter both the string to be found and the string with which to replace it. When a match is found you are asked if you want to replace it and look for the next match (R), skip it and look for the next match (S), replace it and all remaining matches (A) or stop the search (). S saves the file on disk while remaining in the editor. If the file has no name, you are prompted to enter one. Note that if a file by the same name already exists on the disk, the existing copy is renamed to have a file name extension of .BAK before the current file is saved. T allows you to set the number of spaces per Tab. In keeping with the philosophy of "one byte, one display position", tabs are expanded to the appropriate number of spaces. You are asked for the number of spaces for each tab stop (1 - 9, A for 10, B for 11, C for 12, D for 13, E for 14 or F for 15). The default value is 8, but the current setting is saVed in the configuration file. U Unmarks the marked block. (This does not affect the contents of the block in any way). V saVes the current configuration to a file called NLEDCFG.BIN in the current directory. When NLED is started, it looks in the current directory, and then in the directory containing the NLED program, for a file called NLEDCFG.BIN containing configuration information. If it does not find such a file, it uses default settings. The following information is stored in the configuration file: editing mode (insert or overstrike), attention level (0 - 2), file access mode (binary, text or ztext), tab size (0 - F) and compression (on or off), case sensitivity of searches (yes or no), screen color, and keystroke programming for the function keys. X saves the current file and eXits the editor. If the file has no name, you are prompted to enter a name. Note that X exits (saves and quits), while Q simply quits without saving. Y allows you to control the case sensitivitY of the Find and Replace commands. You are asked a Yes-or-No question: if searches should be case sensitive. The default is No, although the current setting can be saVed as part of the configuration file. Z changes the case of the current character (between upper and lower case). Only alphabetic characters are affected. Pressing either or returns to editing mode. Section 5. Default Function Key Settings The following table is for the PC keyboard for the Windows and OS/2 versions. For Unix/Linux versions, what is shown as (Shift) are to , as (Ctrl) are to and as (Alt) as to . ___________________________________ ____________________________________ | (Ctrl) Delete Previous Word | (Ctrl) Delete Next Word | | (Shift) < Available for use > | (Shift) < Available for use > | | (Alt) Program MACRO (F2) key | (Alt) Change Case of Letter | |_F1_________HELP___________________|_F2_________MACRO___________________| | (Ctrl) Back Space 5 characters | (Ctrl) Delete 5 characters | | (Shift) Move 5 characters left | (Shift) Move 5 characters right | | (Alt) Scroll screen up 5 lines | (Alt) Scroll screen down 5 lines| |_F3_________GO_TO_specified_line___|_F4_________NEW_LINE_with_INDENT____| | (Ctrl) Delete Marked Block | (Ctrl) Delete current line | | (Shift) Copy Marked Block | (Shift) Duplicate current line | | (Alt) Move Marked Block | (Alt) Unmark Marked Block | |_F5_________MARK_BEGINNING_OF_BLOCK|_F6_________MARK_END_OF_BLOCK_______| | (Ctrl) Delete to begin. of line | (Ctrl) Delete to end of line | | (Shift) Find and Replace | (Shift) DOS shell | | (Alt) Find new text | (Alt) Execute a DOS command | |_F7_________FIND_NEXT_(same_text)__|_F8_________SWAP_NEXT_2_BYTES_______| | (Ctrl) Go into TEXT file mode | (Ctrl) Go into BINARY file mode | | (Shift) Rename current file | (Shift) Save current file | | (Alt) Import (insert) a file | (Alt) Save file and exit NLED | |_F9_________LOAD_ANOTHER_FILE______|_F10________QUIT_(without_saving)___| Section 6. File Access: Text vs. Binary Most editing is done on text files, so NLED, by default, accesses files as if they were text files. But for those times when you wish to edit files that are not text, NLED has a special binary file access mode. The only difference between the two modes is how NLED reads a file from disk and how it writes a file to disk. In text mode, when NLED reads a file, it expands all tabs to the appropriate number of spaces, it collapses all carriage return/line feed pairs to line feeds (Windows and OS/2 only - Unix/Linux uses line feed as the end-of-line character) and it stops reading when the End-Of-File character is reached (control Z - hexadecimal 1A - for Windows and OS/2, control D - hexadecimal 4 - for Unix/Linux) or there is no more data in the file, whichever comes first. In binary mode, when NLED reads a file, each byte in the file is read into the editor without any of the above processing, so that one byte in the file takes up one display position. (Note that the line feed character is the only exception to the display rule: the line feed character is displayed by placing the next character at the beginning of the next line. If there are two lines shown on the screen, the first line MUST end with a line feed). In text mode on Windows or OS/2, when NLED writes a file, it expands each line feed character to a carriage return/line feed combination. If tab c(K)ompression is on, as many leading spaces as possible on each line will be replaced with the appropriate number of Tab characters. Optionally, if you use the "Z" text mode, NLED places an End-Of-File character (Control-Z, hexadecimal 1A) at the end of the file. (Note that some old MSDOS applications require this end-of-file character to work properly, even though MSDOS itself does not. If you have such an application, use the Z text mode instead of the regular text mode). In binary mode, when NLED writes a file, each byte is written as it was displayed within NLED. If you want to edit a binary file, make sure that you set the file access mode to binary (either by using the H command or by making the default file access mode binary through the saved configuration - see V) BEFORE you load the file into NLED.