+-----------------------+ | The Euphoria Editor | +-----------------------+ usage: ed filename ed Summary ------- After any error, just type "ed", and you'll be placed in the editor, at the line and column where the error was detected. The error message will be at the top of your screen. .e, .ex and .pro files are displayed in color. Other text files are in mono. You'll know that you have misspelled something when the color does not change as you expect. Keywords are blue. Names of routines that are built in to ex.exe appear in magenta. Strings are green, comments are red, most other text is black. Balanced brackets (on the same line) have the same color. You can change these colors as well as several other parameters of ed. See "user-modifiable parameters" near the top of ed.ex. The arrow keys move the cursor left, right, up or down. Most other characters are immediately inserted into the file. In Windows, you can "associate" various types of files with ed.bat. You will then be put into ed when you double-click on these types of files - e.g. .e, .pro, .doc etc. Main Euphoria files ending in .ex might better be associated with "ex.exe". Ed is a multi-file/multi-window editor. Esc c will split your screen so you can view and edit up to 10 files simultaneously, with cutting and pasting between them. You can also use multiple edit windows to view and edit different parts of a single file. Special Keys ------------ Delete the current character above the cursor. Move the cursor to the left and delete a character. or Delete the current line. ( is not available on all systems.) Re-insert the preceding series of deletes or control-deletes before the current character or current line. Move to the start of the previous word. Move to the start of the next word. Move to the beginning of the current line. Move to the end of the current line. Move to the beginning of the file. Move to the end of the file. Move up one screen. Move down one screen. F1 ... F10 Select a new current window. The windows are numbered from top to bottom, with the top window on the screen being F1. F12 This is a special customizable command. It is set up to insert a Euphoria comment mark "--" at the start of the current line. You can easily change it to perform any series of key strokes that you like, simply by redefining constant CUSTOM_KEYSTROKES near the top of ed.ex Escape Commands --------------- Press and release the key, then press one of the following keys: h Get help text for the editor, or Euphoria. The screen is split so you can view your program and the help text at the same time. c "Clone" the current window, i.e. make a new edit window that is initially viewing the same file at the same position as the current window. The sizes of all windows are adjusted to make room for the new window. You might want to use Esc l to get more lines on the screen. Each window that you create can be scrolled independently and each has its own menu bar. The changes that you make to a file will initially appear only in the current window. When you press an F-key to select a new window, any changes will appear there as well. You can use Esc n to read a new file into any window. q Quit (delete) the current window and leave the editor if there are no more windows. You'll be warned if this is the last window used for editing a modified file. Any remaining windows are given more space. s Save the file being edited in the current window, then quit the current window as q above. w Save the file but do not quit the window. e Save the file, and then execute it with ex. When the program finishes execution you'll hear a beep. Hit Enter to return to the editor. This operation may not work if you are very low on extended memory. You can't supply any command-line arguments to the program. d Run any DOS command. After the beep, hit Enter to return to the editor. You could also use this command to edit another file and then return, but Esc c is probably more convenient. n Start editing a new file in the current window. Deleted lines/chars and search strings are available for use in the new file. f Find the next occurrence of a string in the current window. When you type in a new string there is an option to "match case" or not. Press y if you require upper/lower case to match. Keep hitting Enter to find subsequent occurrences. Any other key stops the search. To search from the beginning, press before Esc f. The default string to search for, if you don't type anything, is shown in double quotes. r Globally replace one string by another. Operates like f command. Keep hitting Enter to continue replacing. Be careful -- there is no way to skip over a possible replacement. l Change the number of lines displayed on the screen. Only certain values are allowed, depending on your video card. Many cards will allow 25, 28, 43 and 50 lines. ddd Move to line number ddd. e.g. Esc 1023 Enter would move to line 1023 in the file. CR Esc will tell you the name of the current file, as well as the line and character position you are on, and whether the file has been modified since the last save. If you press Esc and then change your mind, it is harmless to just hit Enter so you can go back to editing. Cutting and Pasting ------------------- When you a series of consecutive lines, or a series of consecutive characters, you create a "kill-buffer" containing what you just deleted. This kill-buffer can be re-inserted by moving the cursor and then pressing insert. A new kill-buffer is started, and the old buffer is lost, each time you move away and start deleting somewhere else. For example, cut a series of lines with . Then move the cursor to where you want to paste the lines and press . If you want to copy the lines, without destroying the original text, first them, then immediately press to re-insert them. Then move somewhere else and press to insert them again, as many times as you like. You can also a series of individual *characters*, move the cursor, and then paste the deleted characters somewhere else. Immediately press after deleting if you want to copy without removing the original characters. Once you have a kill-buffer, you can type Esc n to read in a new file, or you can press an F-key to select a new edit window. You can then insert your kill buffer. Use of Tabs ----------- The standard tab width on MS-DOS is 8 spaces. The editor assumes tab=8 for most files. However, it is more convenient when editing a program for a tab to equal the amount of space that you like to indent. Therefore you will find that tabs are set to 4 when you edit Euphoria files (or .c, or .h or .bas files). The editor converts from tab=8 to tab=4 when reading your program file, and converts back to tab=8 when you save the file. Thus your file remains compatible with the tab=8 world, e.g. MS-DOS PRINT, EDIT, etc. If you would like to choose a different number of spaces to indent, change the line at the top of ed.ex that says "constant PROG_INDENT = 4". Lines longer than 80 characters ------------------------------- Lines longer than 80 are marked with an inverse video character in the 80th column. Ed will not display past column 80. By deleting the carriage return at the end of a line, you can combine it with the next line to create a line longer than 80. You can also break a long line by inserting a carriage return. Maximum File Size ----------------- Like any Euphoria program, ed can use extended memory. It will edit files that are much larger than what MS-DOS EDIT or Windows Notepad can handle. With a huge file, inserting or deleting a line near the beginning of the file might take 20 seconds or longer, due to intense swapping activity. Other operations should be reasonably quick. Non-text Files -------------- ed is designed for editing pure text files, although you can use it to view other files. As ed reads in a file, it replaces non-printable characters (less than ASCII 32) with ASCII 254 - small square. If you try to save a non-text file you will be warned about this. (MS-DOS EDIT will quietly corrupt a non-text file - do not save!). Since ed opens all files as "text" files, the control-Z character (26) will appear to be the end of the file. Windows 95 Long Filenames ------------------------- You can edit existing files that have pathnames with long names in them, however in this release ed will not create *new* files with long names. The name will be truncated to the standard DOS 8.3 length. Source Code ----------- The complete source code to this editor is in bin\ed.ex and bin\syncolor.e. You are welcome to make improvements. There is a section at the top of ed.ex containing "user-modifiable" configuration parameters that you may want to adjust. The colors and the cursor size may require adjusting for some operating environments.