emacs vs vi

Naoto Kimura abcscnuk at csuna.UUCP
Mon Jul 18 16:43:01 AEST 1988


In article <1872 at stpstn.UUCP> aad at stpstn.UUCP (Anthony A. Datri) writes:
>>I tried the above and when I tried to save the file the screen froze.
>>I had to turn the terminal off and back on to restore control, and
>>then I couldn't tell where I was on the screen.  I tried repeatedly
>>to save the file, and each time ran into the same problem.  I finally
>>had to exit without saving.  (That worked.) What a dumb editor.  I'm
>>going back to vi.
>>
>>Taking off my novice user hat now.  (Chee, that thing fits too tight!)
>>
>>David, I think you'd have to add some to your instructions.
>
>More likely you'd have to get a real terminal connection, ie., one
>that didn't do automatic flow control.  It's likely that simply
>typing a ^q would have returned control.  Are you using DECnet or what?
>.-- 
>Anthony A. Datri,SysAdmin,StepstoneCorporation,stpstn!aad

1) One thing I've discovered when commands don't work is check your
   termcap/terminfo entry (assuming you're using UNIX) or the
   equivalent.  Control keys have special meanings to the terminals
   (like ^V on a Televideo 910,920c,925 and Freedom 100's will
   correspond to down-arrow) and may interfere with the normal function
   in an editor (I know, because I was used to not having the cursor
   keys defined in the termcap or terminfo entries, and was horrified
   that when I was using a Freedom 100; I couldn't quote a character.  I
   eventually decided to have my own terminfo entries for most of the
   terminals, since the ones installed on the system were mostly wrong
   anyway).

2) It is often a good idea not to expect the cursor keys to work.  Sure,
   they're often found on most terminals, but you can't always be sure
   if they transmit anything to the computer (for example the editing
   keys on the Teleray 1061 only perform the function locally, and don't
   transmit anything to the computer).  What matters is what the
   computer sees, not what you see.   It's also sometimes not a good
   idea to have the cursor keys defined in the system terminal
   definition database (i.e. termcap, terminfo) since they may conflict
   with the normal functions (for example, ^V is the quote-character
   command in vi, but is also the cursor-down key on the Televideo
   910, 920c, and Freedom 100 terminals).

3) Watch out for differences in terminals with respect to the backspace
   key.  Some terminals send BS (ASCII 8), while others send DEL (ASCII
   127).

4) Watch out for flow-control characters (^S and ^Q a.k.a. XOFF and
   XON).  Some characters will interpret them, others will just pass
   them through.

5) When using a PC to connect to the mainframe or mini, watch out for
   special keys that are interpreted by your terminal program or the
   BIOS.  I often get into trouble when I hit ^P, the PC freezes up
   because it is expecting the printer (I didn't have one) to be ready.

----------
And now my personal opinions on text editors:

    My feelings with regard to editors is that some thought should be
used before complaining about the editor on the system.  As an example,
on one of the IBM systems at UCLA, the editor to use is XEDIT.  Many of
the students often complained about the line-oriented nature of the
editor (often the same complaint about vi).  That was the exact nature
of communication between the computer and the terminal, which they
failed to realize.  To implement the type of editor they were accustomed
to, one would have to change the nature of the communication between the
terminal and computer to a character oriented one, which is often
inefficient.   Some people tried to implement editors that faked that,
but often had trouble because the user had to remember to use the
carriage return to transmit a line (which by the way was limited in
length and ended up being truncated if you ignored the line length
limit).

    I often find myself switching between editors, even on the same
computer.  I often switched between the Rand editor and vi.  The Rand
editor allowed me to mark and move blocks of text (sure vi could do
that, but it didn't preserve the appearance of the block if inserted at
the middle of a line).  Unfortunately, it had a nasty habbit of putting
tabs into the text where there were enough spaces at the beginning of
the line (sure I could've turned the feature off, but that caused it to
expand ALL tabs), and it also tended to strip trailing blanks.  Another
thing I wasn't too happy about was the key mappings (^T, ^G, ^F, ^V were
the keys to move up right, left and down -- all on the left hand, where
the control key often was -- but at least they're little better than
WordStar keys; the reason for why I hate the editor on Turbo Pascal and
QuickC ).  Vi did not allow moving of text around as a rectangular
block, but it did allow me to control what was going into the file, as
it didn't do funny transformation of leading blanks into tabs, or strip
trailing blanks.  By this time, there are probably quite a few people
screaming "USE EMACS!!!!"   The reason I wasn't using emacs was because
it wasn't on the system, not even jove.

    Now I find myself occasionally switching between vi and emacs.  I
know that some of you out there are cringing (from saying that I
actually admit to using that horrid editor vi).   I use it because
it starts up faster and also exits faster, and is often better for
smaller files.   For large files, I usually resort to using emacs,
or if that doesn't work well, I use ed.

    On the IBM-PC, I almost primarily use microEmacs.  I have to admit
that it sure beats the editor in the Turbo Pascal and in the QuickC
integrated environments, and is infinitely better than edlin (though I
have learned to use it by necessity -- they didn't have anything other
editor installed on the machines at work).  What I really want now is an
editor which could handle regular expressions like ed, sed or vi (I find
situations where I might want to use commands that might be like
"1,$s/^ *\(\<[a-zA-Z0-9]*\>\)\.\(\<[a-zA-Z0-9]\>\)/\2 \1/" ).

----------

                //-n-\\				Naoto Kimura
        _____---=======---_____			(csun!csuna!abcscnuk)
    ====____\   /.. ..\   /____====
  //         ---\__O__/---         \\	Enterprise... Surrender or we'll
  \_\                             /_/	send back your *&^$% tribbles !!

P.S.:	One thing that I find to be a great tutor for using the
	cursor movement commands in vi is rogue and its variants
	(srogue, brogue, and reimplementations like hack).  "Snake"
	is also useful for teaching the command keys.   Any others ?
	BTW, anybody have a version that uses the emacs key mappings ?



More information about the Comp.unix.questions mailing list