📄 Edu - The new Euphoria Editor
This page describes the Euphoria editor "ed". When you download Lib2 from the
Download page it comes with an advanced editor, "edu", which is based on "ed".
"edu" editor includes more menu commands, full screen editing, full screen
lists, and on Linux system you can run it in UTF-8 mode by adding "-u" in the
edu -u filename
edu includes also the following special keys:
control-K - display help for the current keyword (where the cursor is)
control-W - start/stop recording a macro
control-O - run a recorded macro
control-F - freeze/unfreeze the cursor (for writing a string in RTL mode)
You should install Lib2 version 1.22 or later to use "edu" editor
version 2.30. More details about the "edu" editor are in the source file
If you are running Euphoria 3.1.1 on Windows-10, then you should install Lib2
version 1.24 or later, and run "edu" editor with eduw.bat (not with edu.bat).
Note that on Windows-10 you should run "ed" using exwc.exe or exw.exe
(not with ex.exe).
📄 Ed - The Euphoria Editor
The Euphoria download package includes a handy, text-mode editor, ed, that's
written completely in Euphoria. Many people find ed convenient for editing
Euphoria programs and other files, but there is no requirement that you use
If you don't like ed, you have many alternatives. David Cuny's EE editor is a
DOS-based editor for Euphoria that's also written in Euphoria. It has a
friendly mouse-based user interface with drop down menus etc. It's available
from the RDS Web site. There are several other Euphoria-oriented editors that
run on DOS, Windows, Linux and FreeBSD. Check the Editors section of our
Archive. In fact, any text editor can be used to edit a Euphoria program,
including DOS Edit or Windows NotePad.
usage 1: ed filename
usage 2: ed
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.
Euphoria-related 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 the
interpreter 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 (.exw) might better be
associated with "ex.exe" ("exw.exe").
ed is a multi-file/multi-window DOS 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.
Some PC keys do not work in a Linux or FreeBSD text console, or in Telnet, and
some keys do not work in an xterm under X windows. Alternate keys have been
provided. In some cases on Linux/FreeBSD you might have to edit ed.ex to map
the desired key to the desired function.
Delete - Delete the current character above the cursor.
Backspace - Move the cursor to the left and delete a character.
control-Delete - Delete the current line. (control-Delete is not available
on all systems.)
control-d - Delete the current line. (same as control-Delete)
Insert - Re-insert the preceding series of Deletes or
control-Deletes before the current character or current
control-arrow-left - Move to the start of the previous word. On
Linux/FreeBSD use control-L.
control-arrow-right - Move to the start of the next word. On Linux/FreeBSD
Home - Move to the beginning of the current line.
End - Move to the end of the current line.
control-Home - Move to the beginning of the file. This works with ex.exe
only. On Windows/Linux/FreeBSD use control-T (i.e. Top)
control-End - Move to the end of the file. This works with ex.exe only.
On Windows/Linux/FreeBSD use control-B, (i.e. Bottom)
Page Up - Move up one screen. In a Linux/FreeBSD xterm use control-U
Page Down - Move down one screen. In a Linux/FreeBSD xterm use
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.
Press and release the Esc 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 Esc q above.
w - Save the file but do not quit the window.
e - Save the file, and then execute it with ex, exw or exu. 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 an operating system 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. You must type in
the path to the new file. Alternatively, you can drag a file name from a
Windows file manager window into the MS-DOS window for ed. This will
type the full path for you.
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 control-Home 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 Esc 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.
In a Linux/FreeBSD text console you're stuck with the number of lines
available (usually 25). In a Linux/FreeBSD xterm window, ed will use the
number of lines initially available when ed is started up. Changing the
size of the window will have no effect after ed is started.
m - Show the modifications that you've made so far. The current edit buffer
is saved as editbuff.tmp, and is compared with the file on disk using
the DOS fc command, or the Linux/FreeBSD diff command. Esc m is very
useful when you want to quit the editor, but you can't remember what
changes you made, or whether it's ok to save them. It's also useful when
you make an editing mistake and you want to see what the original text
ddd - Move to line number ddd. e.g. Esc 1023 Enter would move to line 1023 in
CR - Esc Carriage-Return, i.e. Esc Enter, 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.
Recalling Previous Strings
The Esc n, Esc d, Esc r and Esc f commands prompt you to enter a string. You
can recall and edit these strings just as you would at the DOS or
Linux/FreeBSD command line. Type up-arrow or down-arrow to cycle through
strings that you previously entered for a given command, then use left-arrow,
right-arrow and the delete key to edit the strings. Press Enter to submit the
Cutting and Pasting
When you control-Delete (or control-D) a series of consecutive lines, or
Delete 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 control-Delete. Then move the cursor to where you want to paste the lines
and press Insert. If you want to copy the lines, without destroying the
original text, first control-Delete them, then immediately press Insert to
re-insert them. Then move somewhere else and press Insert to insert them
again, as many times as you like. You can also Delete a series of individual
*characters*, move the cursor, and then paste the deleted characters somewhere
else. Immediately press Insert 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
Use of Tabs
The standard tab width 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 that extend beyond the right edge of the screen are marked with an
inverse video character in the 80th column. This warns you that there is more
text "out there" that you can't see. You can move the cursor beyond the 80th
column. The screen will scroll left or right so the cursor position is always
Maximum File Size
Like any Euphoria program, ed can access all the memory on your machine. It
can edit huge files, and unless disk swapping occurs, most operations will be
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 certain non-printable
characters (less than ASCII 14) 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, a control-z character (26) embedded in a file will appear to ed to be
the end of the file.
Although ed is a DOS editor, you can edit existing files that have pathnames
with long names in them, and the full file name will be preserved. 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. (but see Platform below)
The end-of-line terminator on Linux/FreeBSD is simply \n. On DOS and Windows,
text files have lines ending with \r\n. If you copy a DOS or Windows file to
Linux/FreeBSD and try to modify it, ed will give you a choice of either
keeping the \r\n terminators, or saving the file with \n terminators.
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 can adjust. The
colors and the cursor size may need adjusting for some operating environments.
euphoria\bin\ed.bat can be set up to run ed.ex using exwc.exe or ex.exe. You
are better off running ed with ex.exe on Windows 95/98/ME. You'll get much
quicker screen updates than with exwc.exe. On Windows XP you'll be a bit
better off using exwc.exe. You'll get slightly quicker screen updates, and
you'll be able to create files with long names, not just open existing ones.
However some special keys won't work with exwc.exe, e.g. you'll have to use
control-t and control-b instead of control-Home and control-End. On Linux and
FreeBSD there are no problems with long filenames, and the keyboard response
is always fast.