This program was written beginning in the early 1990's because I didn't want to learn emacs and vi was too hard to move around in. I have been using it every day since then, but I do not expect anybody else to ever use it.
The backup resource, if specified, causes xed to make a copy of the current on-disk version of the file, naming the copy filename.bak.
The keymap resource should specify a pathname for a file containing the key definitions, if other than the default key bindings are to be used. Additional instructions for changing the key bindings are given below.
The status_fg and status_bg resources, if specified, govern the foreground and background colors, respectively, of the status line and menus. These default to the background and foreground colors, respectively, of the main window, so that by default, the status line and menu colors will be the reverse of the main window's foreground and background colors.L 10 C 12 IA4 +foo.datThis status line indicates that the cursor is on column 12 of line 10 of the file foo.dat, that the file has been modified i.e. that the copy in memory has changes that have not yet been saved to disk. Insert is active, as is autoindent. Tabs expand to 4 spaces. If you do not have write permission for the file, the plus sign will not appear; instead, the designation (Read Only) will precede the file name. If the file has been loaded as binary data, the designation (binary) will appear as well.
If you click the mouse anywhere in the window, the cursor moves to the character position nearest the point where the mouse button was pressed.
Users should note that xed considers tab width to be a variable. The default tab width is 4 spaces. Many documents created in the UNIX world assume that tabs are eight spaces, so you can alter the tab width by pressing Ctrl-Tab. Note also that tab characters are initially visible in xed, and you cannot place the cursor onto any of the spaces that result from tab expansion. By pressing Ctrl-v, you can toggle the tab visibility through three states, an invisible state, a minimally visible state (the default), and a maximally visible state in which one can distinguish the tab fill characters (which fill the space between a tab and the following text) from true spaces.
Xed has a rudimentary help facility associated with its menus. To find out what keystrokes can be used to produce the effect of a particular menu selection, highlight a menu item and press the question mark. Xed will print on the xterm from which it was launched brief descriptions of all keystrokes that produce this action. Note that these descriptions will refer to an "Alt" modifier key that may not be present on your system. This really refers to the Mod1 modifier key.
You can enter a directory specification at the "Edit file:" prompt. If xed determines that the name you entered is a directory, it presents you with a list of files in that directory. Use the arrow keys to select a file from the list; if you choose another directory (identified with a trailing slash character), the corresponding list will appear.
When asked to read a file as binary data, xed creates a hexadecimal display; each line has sixteen bytes displayed as hexadecimal numbers, followed by a tab, a pound sign (#), and the ASCII equivalents of those sixteen bytes. Non-printable characters are displayed in the ASCII section as periods.
You can edit this hexadecimal display as you like; no special binary editing mode exists. When asked to save the file, however, xed will look through each line, converting pairs of hexadecimal digits back to binary bytes and writing them to the output file. When it encounters a character that is neither a hexadecimal digit nor a whitespace (blank or tab), it skips to the beginning of the next line and continues the conversion.
Since there aren't keys specifically made for many important functions, many keys have arbitrary assignments. These are intended to mimic other packages (e.g. Qedit and WordStar on MS-DOS systems) but do so in only a limited fashion.
To change what a particular key does, you'll need to modify a simple table in the source code and recompile the program.A more dynamic configuration occurs under X Windows; if the X display name does not begin with a colon (i.e. if xed is running on another machine), xed looks for a file in the user's home directory named xed.hostname where hostname is the name of the host on which the window is to be displayed. This file, if it exists, is assumed to be the binary output of the configuration program xed_config (see below). Its contents replace the default keymap table.
For those keys that are significant when modified using Shift, Ctrl or Alt, the modified action is either the same or is complementary to the action of the unmodified key. For example, the left arrow key moves the cursor left one space, while Ctrl-Left moves the cursor left one word. Similarly, the Home key moves the cursor to the beginning of the line, and Ctrl-Home moves it to the beginning of the file.Items under the Print menu control the layout of the printed page.
If the block starts and ends on the same line, and the end follows the start, the intervening text is copied to the paste buffer, and can be inserted elsewhere by pressing Ctrl-p.
if (((c = getc(stdin)) != EOF) && ord[c] != 'a') {
abc d dc b a
Here matching letters appear on the line below matching parentheses.
KEY_FIND_MATCH operates either forward or backward, depending on
whether the character at the cursor position is a left-symbol (one
of (, [, {, or <) or the corresponding right-symbol (
respectively, ), ], }, or >).
Note that the text pasting operation respects the insert state. If Insert is off (no 'I' appears in the status line), the paste operation overwrites characters already in the line. This effect occurs both when KEY_PASTE is invoked directly (with Ctrl-p) and during replace operations.
to upper case Alt-1 to lower case Alt-2 switch case Alt-3 to hexadecimal Ctrl-F2 from hexadecimal Ctrl-F4
| Action code | Function description |
|---|---|
| KEY_SET_TAB_WIDTH | Allows user to specify new tab width |
| KEY_FIND_MATCH | Moves cursor to matching symbol |
| KEY_WRITE_BLOCK | Write marked block to a new file |
| KEY_DEL_BLOCK | Delete the marked block |
| KEY_SEARCH_BACKWARD | Specify a string and find its previous occurrence |
| KEY_SEARCH_FORWARD | Specify a string and find its next occurrence |
| KEY_FIND_NEXT | Continue the last search |
| KEY_FIND_NEXT_NONPRINTABLE | Move to the next non-printing character |
| KEY_SET_PASTE_TEXT | Enter text into the paste buffer |
| KEY_PASTE | Insert the contents of the paste buffer at the cursor position |
| KEY_REPLACE_ALL | Replace all subsequent occurrences of the search string with the paste text |
| KEY_REPLACE_ONCE | Replace the next occurrence of the search string with the text in the paste buffer |
| KEY_DEL_SPACE_TO_RIGHT | Delete whitespace (blanks and tabs) to the right of the cursor |
| KEY_TOGGLE_TAB_VISIBILITY | Change the appearance of tab characters and tab fill characters |
| KEY_DEL_LINE | Delete the current line |
| KEY_UNDEL LINE | Undelete a line (insert the most recently deleted line at the cursor position) |
| KEY_WORD_LEFT | Move to the beginning of the previous word |
| KEY_WORD_RIGHT | Move to the beginning of the next word |
| KEY_MOVE_TO_TOP_OF_SCREEN | Move to the top line displayed (not the status line) |
| KEY_MOVE_TO_BOTTOM_OF_SCREEN | Move to the bottom line displayed |
| KEY_MOVE_TO_BEG_OF_FILE | Move to the first line in the file |
| KEY_MOVE_TO_END_OF_FILE | Move to the last line in the file |
| KEY_SCROLL_UP | Scroll the file up, keeping the cursor on the same line |
| KEY_SCROLL_DOWN | Scroll the file down, keeping the cursor on the same line |
| KEY_TOGGLE_AUTOINDENT | If autoindent is active, turn it off, and vice versa. |
| KEY_DEL_TO_BEG_OF_LINE | Delete all characters to the left of the cursor on the current line |
| KEY_DEL_TO_END_OF_LINE | Delete all characters to the right on the current line, including the cursor position |
| KEY_IGNORE | Ignore this keystroke |
| KEY_SAVE_AND_EXIT | Write the current file to disk and remove it from memory |
| KEY_QUIT | Remove the current file from memory; prompt if it has changed |
| KEY_QUIT_ALL | Forgetting all changes, return to the system. |
| KEY_SAVE_FILE | Write the current file to disk |
| KEY_GO_TO_LINE | Move to a specified line (specify by number) |
| KEY_COPY_BLOCK | Insert a copy of the marked block before the current line |
| KEY_MOVE_BLOCK | Insert the marked block before the current line |
| KEY_MARK_BLOCK_START | Set the beginning of the marked block |
| KEY_MARK_BLOCK_END | Set the end of the marked block |
| KEY_HIDE_BLOCK | Unmark the current marked block |
| KEY_DUP_LINE | Duplicate the current line |
| KEY_DUP_CHAR | Duplicate the character at the cursor position |
| KEY_MOVE_LEFT | Move one character to the left |
| KEY_MOVE_RIGHT | Move one character to the right |
| KEY_MOVE_UP | Move to the preceding line |
| KEY_MOVE_DOWN | Move to the following line |
| KEY_MOVE_TO_BEG_OF_LINE | Move to the first character of the current line |
| KEY_MOVE_TO_END_OF_LINE | Move to the space following the last character in the current line |
| KEY_PAGE_UP | Move up about one screenfull of lines |
| KEY_PAGE_DOWN | Move down about one screenfull of lines |
| KEY_TOGGLE_INSERT | Switch from inserting to overwriting or the reverse |
| KEY_NEW_LINE | Create a new line, moving to it |
| KEY_DEL_LEFT | Delete the character to the left of the cursor |
| KEY_DEL_RIGHT | Delete the character at the cursor position |
| KEY_READ_FILE | Insert the contents of a specified file before the current line |
| KEY_UPPER_CASE | Change the character at the cursor position to its upper-case equivalent |
| KEY_LOWER_CASE | Change the character at the cursor position to its lower-case equivalent |
| KEY_TOGGLE_CASE | If the character at the cursor is lower case, make it upper, and vice versa |
| KEY_TO_HEX | Replace the character at the cursor with its two-character hexadecimal code |
| KEY_FROM_HEX | Replace two hex characters starting at the cursor with the byte value |
| KEY_TO_BINARY | Replace the character at the cursor with eight binary digits |
| KEY_HEX_TO_BINARY | Replace one hex character at the cursor with four binary digits |
| KEY_BREAK_LINE | Make the current line as short as the previous one, continuing on the next line |
| KEY_CHANGE_NAME | Change the name of the current file |
| KEY_REFORMAT_PARAGRAPH | Wrap the current line according to the right margin |
| KEY_SET_RIGHT_MARGIN | Set the value of the right margin; by default it is 76 characters |
| KEY_SUBSTITUTE | Insert the string from the keymap table into the text |
| KEY_ANOTHER_FILE | Begin editing another file |
| KEY_PREV_FILE | Go to the previous file in the linked list |
| KEY_NEXT_FILE | Go to the next file in the linked list |
| KEY_TOGGLE_BINARY | On output, interpret the current text as hexadecimal code |
| KEY_SHOW_MENUS | Activate the menus |
| KEY_PRINT_SIZE | Set the size of printed type |
| KEY_PRINT_TOP | Set the top margin for printing |
| KEY_PRINT_BOTTOM | Set the bottom margin for printing |
| KEY_PRINT_LEFT | Set the left margin for printing |
| KEY_PRINT_RIGHT | Set the right margin for printing |
| KEY_PRINT_NUMBER | Indicate whether printed lines should be numbered |
| KEY_PRINT_ORIENTATION | Indicate how the letters should be oriented on the printed page |
| KEY_PRINT_FOOTER | Indicate whether the file name and date should be printed |
| KEY_PRINT_COMMAND | Set the system command used to print the PostScript file |
| KEY_PS_PRINT | Create a PostScript version of the current file |
| KEY_PS_PRINT_BLOCK | Create a PostScript version of the current block |
| KEY_ADD_KEYS | Read a text file describing keymap entries; merge them with the existing key definitions. |
Fn or Shift-Fn Ctrl-Fn Alt-Fn F1 SAVE_AND_EXIT CHANGE_NAME reserved F2 QUIT TO_HEX reserved F3 SAVE_FILE FIND_MATCH reserved F4 GO_TO_LINE FROM_HEX reserved F5 COPY_BLOCK WRITE_FILE reserved F6 MOVE_BLOCK DEL_BLOCK reserved F7 MARK_BLOCK_START READ_FILE reserved F8 MARK_BLOCK_END PS_PRINT reserved F9 DUP_LINE BREAK_LINE reserved F10 DUP_CHAR TOGGLE_BINARY reserved
key Ctrl-key KP_7 MOVE_TO_BEG_OF_LINE MOVE_TO_BEG_OF_FILE KP_8 MOVE_UP MOVE_TO_TOP_OF_SCREEN KP_9 PAGE_UP SCROLL_UP KP_4 MOVE_LEFT WORD_LEFT KP_5 IGNORE IGNORE KP_6 MOVE_RIGHT WORD_RIGHT KP_1 MOVE_TO_END_OF_LINE MOVE_TO_END_OF_FILE KP_2 MOVE_DOWN MOVE_TO_BOTTOM_OF_SCREEN KP_3 PAGE_DOWN SCROLL_DOWN KP_0 TOGGLE_INSERT TOGGLE_AUTOINDENT KP_Decimal DEL_RIGHT DEL_TO_EOL KP_Enter NEW_LINE not assigned
key or Shift-key Ctrl-key Insert TOGGLE_INSERT TOGGLE_AUTOINDENT Delete DEL_RIGHT DEL_TO_END_OF_LINE Home MOVE_TO_BEG_OF_LINE MOVE_TO_BEG_OF_FILE End MOVE_TO_END_OF_LINE MOVE_TO_END_OF_FILE Page Up PAGE_UP SCROLL_UP Page Down PAGE_DOWN SCROLL_DOWM Left MOVE_LEFT WORD_LEFT Right MOVE_RIGHT WORD_RIGHT Up MOVE_UP MOVE_TO_TOP_OF_SCREEN Down MOVE_DOWN MOVE_TO_BOTTOM_OF_SCREEN Backspace DEL_LEFT DEL_TO_BEG_OF_LINE Tab (tab) SET_TAB_WIDTH
Alt-b SET_RIGHT_MARGIN Alt-e ANOTHER_FILE Alt-f SEARCH_BACKWARDS Alt-p SET_PASTE_TEXT Alt-q QUIT Alt-r REPLACE_ALL Alt-x SAVE_AND_EXIT Alt-1 UPPER_CASE Alt-2 LOWER_CASE Alt-3 TOGGLE_CASE Alt-> NEXT_FILE Alt-< PREV_FILE
Ctrl-w SCROLL_DOWN Ctrl-e MOVE_UP Ctrl-r REPLACE_ONCE Ctrl-t DEL_SPACE_TO_RIGHT Ctrl-y DEL_LINE Ctrl-u UNDEL LINE Ctrl-i (tab) Ctrl-p PASTE Ctrl-s MOVE_LEFT Ctrl-d MOVE_RIGHT Ctrl-f SEARCH_FORWARD Ctrl-g DEL_RIGHT Ctrl-l FIND_NEXT Ctrl-z SCROLL_DOWM Ctrl-x MOVE_DOWN Ctrl-v TOGGLE_TAB_VISIBILITY Ctrl-b REFORMAT_PARAGRAPH
CHANGE_NAME CTRL-F1 ANOTHER_FILE Alt-E PS_PRINT CTRL-F8, Print PREV_FILE Alt-< NEXT_FILE Alt-> READ_FILE CTRL-F7 SAVE_FILE F3, SHFT-F3 SAVE_AND_EXIT ALT-x, F1, SHFT-F1 QUIT ALT-q, F2, SHFT-F2
MARK_BLOCK_START F7, SHFT-F7 MARK_BLOCK_END F8, SHFT-F8 COPY_BLOCK F5, SHFT-F5 MOVE_BLOCK F6, SHFT-F6 DEL_BLOCK CTRL-F6 WRITE_BLOCK CTRL-F5
MOVE_UP CTRL-SHFT-E, CTRL-e, KP_8, SHFT-Up, Up MOVE_DOWN CTRL-SHFT-X, CTRL-x, Down, KP_2, SHFT-Down MOVE_LEFT CTRL-SHFT-S, CTRL-s, KP_4, Left, SHFT-Left MOVE_RIGHT CTRL-SHFT-D, CTRL-d, KP_6, Right, SHFT-Right MOVE_TO_BEG_OF_LINE Home, KP_7, SHFT-Home MOVE_TO_END_OF_LINE End, KP_1, SHFT-End MOVE_TO_TOP_OF_SCREEN CTRL-KP_8, CTRL-Up MOVE_TO_BOTTOM_OF_SCREEN CTRL-Down, CTRL-KP_2 MOVE_TO_BEG_OF_FILE CTRL-Home, CTRL-KP_7 MOVE_TO_END_OF_FILE CTRL-End, CTRL-KP_1 PAGE_UP KP_9, Prior, SHFT-Prior PAGE_DOWN KP_3, Next, SHFT-Next WORD_LEFT CTRL-KP_4, CTRL-Left WORD_RIGHT CTRL-KP_6, CTRL-Right SCROLL_UP CTRL-KP_9, CTRL-Prior, CTRL-SHFT-W, CTRL-w SCROLL_DOWN CTRL-KP_3, CTRL-Next, CTRL-SHFT-Z, CTRL-z GO_TO_LINE F4, SHFT-F4
SEARCH_FORWARD CTRL-f SEARCH_BACKWARD ALT-f FIND_NEXT CTRL-SHFT-L, CTRL-l REPLACE_ONCE CTRL-r REPLACE_ALL ALT-r SET_PASTE_TEXT ALT-p PASTE CTRL-p FIND_MATCH CTRL-F3
NEW_LINE KP_Enter, Return, SHFT-KP_Enter, SHFT-Return DUP_CHAR F10, SHFT-F10 DUP_LINE F9, SHFT-F9 DEL_LEFT BackSpace, SHFT-BackSpace DEL_RIGHT CTRL-SHFT-G, CTRL-g, Delete, KP_Decimal, SHFT-Delete DEL_LINE CTRL-SHFT-Y, CTRL-y UNDEL_LINE CTRL-SHFT-U, CTRL-u DEL_SPACE_TO_RIGHT CTRL-SHFT-T, CTRL-t DEL_TO_BEG_OF_LINE CTRL-BackSpace DEL_TO_END_OF_LINE CTRL-Delete, CTRL-KP_Decimal LOWER_CASE ALT-2 UPPER_CASE ALT-1 TOGGLE_CASE ALT-3 BREAK_LINE CTRL-F9 REFORMAT_PARAGRAPH CTRL-b, CTRL-SHFT-B
SET_TAB_WIDTH CTRL-Tab TOGGLE_TAB_VISIBILITY CTRL-SHFT-V, CTRL-v TOGGLE_INSERT Insert, KP_0, SHFT-Insert TOGGLE_AUTOINDENT CTRL-Insert, CTRL-KP_0 SET_RIGHT_MARGIN ALT-b IGNORE CTRL-KP_5, KP_5
Another file KEY_ANOTHER_FILE Save and exit KEY_SAVE_AND_EXIT Save file KEY_SAVE_FILE Change name KEY_CHANGE_NAME Prev file KEY_PREV_FILE Next file KEY_NEXT_FILE PS Print KEY_PS_PRINT Add keys KEY_ADD_KEYS Quit KEY_QUIT
Toggle insert KEY_TOGGLE_INSERT Toggle autoindent KEY_TOGGLE_AUTOINDENT Toggle tab visibility KEY_TOGGLE_TAB_VISIBILITY Set tab width KEY_SET_TAB_WIDTH Set right margin KEY_SET_RIGHT_MARGIN Scroll up KEY_SCROLL_UP Scroll down KEY_SCROLL_DOWN
Word left KEY_WORD_LEFT Word right KEY_WORD_RIGHT Move to top of screen KEY_MOVE_TO_TOP_OF_SCREEN Move to bottom of screen KEY_MOVE_TO_BOTTOM_OF_SCREEN Move to beg of line KEY_MOVE_TO_BEG_OF_LINE Move to end of line KEY_MOVE_TO_END_OF_LINE Move to beg of file KEY_MOVE_TO_BEG_OF_FILE Move to end of file KEY_MOVE_TO_END_OF_FILE Page up KEY_PAGE_UP Page down KEY_PAGE_DOWN Find match KEY_FIND_MATCH Go to line KEY_GO_TO_LINE
Search forward KEY_SEARCH_FORWARD Search backward KEY_SEARCH_BACKWARD Find next KEY_FIND_NEXT Find nonprintable KEY_FIND_NEXT_NONPRINTABLE Set paste text KEY_SET_PASTE_TEXT Paste KEY_PASTE Replace once KEY_REPLACE_ONCE Replace all KEY_REPLACE_ALL
Mark block start KEY_MARK_BLOCK_START Mark block end KEY_MARK_BLOCK_END Copy block KEY_COPY_BLOCK Move block KEY_MOVE_BLOCK Write block KEY_WRITE_BLOCK Del block KEY_DEL_BLOCK Print block KEY_PS_PRINT_BLOCK Hide block KEY_HIDE_BLOCK
Del space to right KEY_DEL_SPACE_TO_RIGHT Del line KEY_DEL_LINE UnDelete line KEY_UNDEL_LINE Del to beg of line KEY_DEL_TO_BEG_OF_LINE Del to end of line KEY_DEL_TO_END_OF_LINE Dup char KEY_DUP_CHAR Dup line KEY_DUP_LINE New line KEY_NEW_LINE Break line KEY_BREAK_LINE Reformat paragraph KEY_REFORMAT_PARAGRAPH Read file KEY_READ_FILE Toggle Binary File KEY_TOGGLE_BINARY
Upper case KEY_UPPER_CASE Lower case KEY_LOWER_CASE Toggle case KEY_TOGGLE_CASE To hex KEY_TO_HEX From hex KEY_FROM_HEX To binary KEY_TO_BINARY Hex to binary KEY_HEX_TO_BINARY
Type size KEY_PRINT_SIZE Top margin KEY_PRINT_TOP Bottom margin KEY_PRINT_BOTTOM Left margin KEY_PRINT_LEFT Line numbers KEY_PRINT_NUMBER Page orientation KEY_PRINT_ORIENTATION Page footers KEY_PRINT_FOOTER Set print command KEY_PRINT_COMMAND PS Print KEY_PS_PRINT
The keystroke is described by the logical OR of the modifier keys (CTRL, SHFT, ALT) with the KeySym, the name X11 uses for the key. A section of the keymap table is reproduced below.
{CTRL | 0 | 0 | XK_BackSpace, KEY_DEL_TO_BEG_OF_LINE, NULL},
{CTRL | 0 | 0 | XK_KP_Decimal, KEY_DEL_TO_END_OF_LINE, NULL},
{CTRL | 0 | 0 | XK_Delete, KEY_DEL_TO_END_OF_LINE, NULL},
{CTRL | 0 | 0 | XK_Escape, KEY_SHOW_VARIABLES, NULL},
{ 0 | 0 | ALT | XK_1, KEY_UPPER_CASE, NULL},
{ 0 | 0 | ALT | XK_2, KEY_LOWER_CASE, NULL},
{ 0 | 0 | ALT | XK_3, KEY_TOGGLE_CASE, NULL},
{ 0 | 0 | ALT | XK_b, KEY_SET_RIGHT_MARGIN, NULL},
{ 0 | 0 | ALT | XK_n, KEY_ANOTHER_FILE, NULL},
The symbols CTRL, SHFT, and ALT indicate the
activity of these modifier keys. A zero in one of those columns means
that the corresponding modifier is not activated. Caps Lock is treated
like Shift. The symbols beginning with XK_ are KeySyms, which
are defined in the header file /usr/include/X11/keysymdef.hNote that in X11, an upper case KeySym, like XK_D, must always be used with SHFT. Note also that the window manager may usurp some keys for its own use, not permitting the application to see these keys. On the DG AViiON, for example, Motif is usually configured to use Alt-F1 through Alt-F10, Alt-Tab, Alt-space, and Alt-Esc, so it will do no good to define key bindings for them. The window manager's key usage is controlled by its rc file (e.g. .mwmrc).
http://geology.usgs.gov/peter/xed/
Peter N. Schweitzer MS 954 National Center U.S. Geological Survey Reston, VA 22092 Tel: (703) 648-6533 FAX: (703) 648-6252 email: pschweitzer@usgs.gov