ACCC Home Page ACADEMIC COMPUTING and COMMUNICATIONS CENTER
Accounts / Passwords Email Labs / Classrooms Telecom Network Security Software Computing and Network Services Education / Teaching Getting Help
 
The ADN Connection, May/June 1996 The A3C Connection
May/June 1996 Contents The Faculty Computer Camp Wrapup The ADN Post Choosing the UNIX Right Tool Wanted: FILELIST for UNIX THE -- The Hessling Editor (XEDIT Clone for UNIX) About the ADN Connection

THE -- The Hessling Editor

 
Tech Tip
CMS to UNIX Everyone
 
   
 
     
Are You an XEDIT Fan?
 

Are you a veteran CMS user and an XEDIT fan? What should you do if you find yourself editing files on UNIX? In the long run, particularly if you're going to be using several different UNIX machines, you'll probably want to learn vi. (And you can do it.) But you don't have to tackle vi just yet if you're going to be using an ADN UNIX machine; you might want to consider using THE instead.

THE (The Hessling Editor, written by Mark Hessling) is a text editor for UNIX that looks and acts very much like XEDIT. The ADN supports THE on all of our UNIX workstations -- on tigger, icarus, and on borg. (That's the Computer Center's new Convex Exemplar -- borg.uic.edu.)

Interested? Try THE out; there's enough information in this article to get started, and there's a lot more on the ACCC The Web pages (or search for the using the Search box on the bottom left side of the ACCC home page).

To see just how much THE resembles XEDIT consider the following figure, lifted from Choosing the Right Tool: It looks like it's in XEDIT, doesn't it? Look again -- it's really THE, running in a telnet session on tigger.
 

Return to Contents  

 
     
Entering and Leaving THE
  Using THE on UNIX starts out just like using XEDIT on CMS; enter:
the filename
If the file filename exists in your current directory, THE will open it. If not, THE will create it. (And if you forget where you are and enter: x filename instead, that will work too; x is an alias for the.) The filename can include a path; for example:
the ~/mydir/test.ext
edits or creates a file called test.ext in your mydir subdirectory.

If you leave filename out altogether, THE will display a list of the files in your current directory. To edit a listed file, use Tab or an arrow key to point to the line with the file's name and press Ctrl-x. (A bit like CMS's FILELIST, isn't it? But Pine's pilot is like FILELIST too, and gives you more options. See Wanted -- FILELIST for UNIX.)

When you're finished, save your changes with save or file or discard them using quit or qquit, like in XEDIT.

Return to Contents

 
     
The .therc Profile
  Like XEDIT, THE has a profile file that you can use to tailor THE to your liking. But unlike XEDIT, each ADN UNIX system has a default THE system profile that already has been customized for use on that machine. Copy this file to your home directory:
cp /usr/local/src/the-2.1/.therc ~/.therc
Then make your changes; THE will use it by default. (It's /usr/local/src/the-2.2/THE/.therc on icarus and borg.)

Return to Contents  

 
     
The Bad News
  Don't worry, it's not too bad. THE is very sensitive to the details of how you connect and what your terminal type is. If you get into THE and find that your function keys don't work (but also try Esc-n for Fn before you panic), you might have to do a bit more work to get THE to work for you. The problem -- and its solution -- are described on the ADN THE home page under "Keyboard Remapping."

Checking out your keyboard

To find out how THE will interpret a specific keystroke, enter: showkey on THE's command line, then type the keystroke(s). Pressing the Spacebar returns you to THE.

Return to Contents 

 
     
Important Differences
 

Entering lines of text

THE doesn't have either an Input Mode or a Power Input Mode. You can use F2 to add succeeding lines of text as a substitute for Input Mode or use a combination of margins and wordwrap for Power Input Mode. For example, enter (in this order) :
set margins 1 50
set wordwrap on
Then as you type, XEDIT will begin a new line when you type over the right margin (column 50 in this example), moving the word that you are typing when you go over the margin to the beginning of the new line.

Insert mode:

As in XEDIT, the Insert key toggles you in and out of THE's variation of Insert mode. If you don't have an Insert key (or if it doesn't work), try Esc-' (F0). Or you can define one:
define c-v set insertmode toggle
(No, that's not a typo, you type "c-hyphen-v".) This makes Ctrl-v toggle Insert mode. If no Insert toggle key is defined, character insert may not be possible.

Character delete:

The UNIX Ctrl-h backspace functions as a character delete in THE, deleting the character to the left of the cursor. The Delete key, if you have one, might act as it does in XEDIT to delete the character under the cursor, or you can define a keystroke that does:
define c-d sos delchar
This makes Ctrl-d function as Delete does in XEDIT.

Selective change:

THE's selective change command is also a bit different:
schange /oldstring/newstring/ * *
(Note the * * -- THE's schange requires a target.) Then, starting from the cursor's current location, THE moves the cursor to the first instance of oldstring and asks you to: press C to change this instance to newstring, press N to go to the next instance, or press Q to quit.

Working with columns:

THE supports text blocks. Doesn't sound too exciting? Suppose you're working on a table and decide that you want to switch a pair of columns. That's a chore to do in just about any editor, but it's easy in THE. First, mark the block: move your cursor to the upper left corner of the column and press Ctrl-b, then move the cursor to the lower right corner and press Ctrl-b again. Then move your cursor to the spot you want the upper left corner of the copy to be, and, with Insert mode on, press Ctrl-c. (When Insert mode is off, the copied block overwrites the existing text.) Then delete the original copy of the column (Ctrl-g deletes blocks) and you're done.

Return to Contents  

 
     
The little differences you need to know about...
 
  • Commands that take a numeric operand require a space between the command name and the operand; for example: d 3
  • The screen automatically scrolls left and right when the cursor passes the screen edge.
  • The shortest abbreviation of quit is qu
  • /, \, and @ are the only valid string delimiters.
  • The arbchar matching multiple characters is not yet implemented. (Single-character arbitrary character matching is supported.)
  • Not all XEDIT cursor commands have been implemented; most can be emulated with the set zone command.
  • The equal sign = or question mark ? to repeat or redisplay the last command is supported, but only the one immediate previous command can be recalled.
  • The default line width of all files is 512 characters. Use the -w command line option it increase it; for example: the -w 2000 file.ext
  • Mixed case is the default for all files, and there is additional case significance in CHANGE and SORT.
  • Return to Contents  
     
         
    THE has something for vi fans too...
      Sure you can do just about anything you'd ever want to do in vi (usually in two different ways!). But THE provides some exciting tools that longtime UNIX people and vi devotees might want to look into.

    There's the XEDIT/THE all command to display and work on only those the lines in a file that contain a given string. For example, enter: all /string/ and THE will display only the lines that include "string"; any global changes you make will act only on those lines. (You might find it easier in general to make global changes in THE than in vi.) Enter: all (without a target) to display the entire file again.

    The XEDIT/THE prefix area and prefix commands make it easy to move, copy, or delete groups of lines -- and it'll be clear exactly which lines you're working with.

    The XEDIT/THE editing "ring" allows you to work on two or more files at once, without having to commit the current changes in any of them to disk as you must in vi. THE isn't good when you want to "cut and paste" multiple lines from one window to another (vi's better for that), but XEDIT/THE's put and get commands are great when you want to copy groups of lines from one file to another.

    And THE's support for text blocks can come in handy also.

    Want to know more? To get started, see Using the (The Hessling Editor) at UIC. For lots more information, see ADN THE home page.

    Comments are welcome; send them to
    Judith Grobe Sachs, judygs@uic.edu
     
     

    The ADN Connection, Oct/Nov/Dec 1998 Previous: Wanted: FILELIST for UNIX Next: About the ADN Connection


    2002-6-29  connect@uic.edu
    UIC Home Page Search UIC Pages Contact UIC