[comp.unix.questions] emacs vs vi

roberts@cmr.icst.nbs.gov (John Roberts) (07/09/88)

I believe it is possible to create a <500 word summary which will allow a
complete novice to use vi at a rudimentary level sufficient to create or
arbitrarily modify any text file (append, insert, delete, save, etc.) I have
not heard of any such claim made for emacs. If such a summary does exist,
I would be very glad to hear about it. Please post to me and I will summarize
to the net.
                                                    John Roberts
                                                    roberts@cmr.icst.nbs.gov

ddb@ns.ns.com (David Dyer-Bennet) (07/13/88)

In article <16435@brl-adm.ARPA>, roberts@cmr.icst.nbs.gov (John Roberts) writes:
> I believe it is possible to create a <500 word summary which will allow a
> complete novice to use vi at a rudimentary level sufficient to create or
> arbitrarily modify any text file (append, insert, delete, save, etc.) I have
> not heard of any such claim made for emacs. 

  Try this, composed on the spot:

To invoke editor on a file: emacs <filename>
To save the file: ^X^S
To exit without saving: ^X^C
Cursor keys move you around.  Typing inserts the characters typed.  Delete
deletes the character to the left of the cursor.
To delete from current position to end of line: ^K
To go to beginning of line: ^A  To end of line: ^E
Backspace invokes help.

  63 words, could be much less if I weren't verbose about the descriptions.
For some levels of novices I should explain what "^K" means, maybe another
10 words.
  Of course, there are many other things I could explain about emacs or vi.
This set of commands goes back to the minimal VI command set posted
a while back, and my minimal emacs set response.  Note that I didn't have
to expend any words explaining the different modes and how to get between
them.-- 
	-- David Dyer-Bennet
	...!{rutgers!dayton | amdahl!ems | uunet!rosevax}!umn-cs!ns!ddb
	ddb@viper.Lynx.MN.Org, ...{amdahl,hpda}!bungia!viper!ddb
	Fidonet 1:282/341.0, (612) 721-8967 hst/2400/1200/300

tab@mhuxu.UUCP (Tracey Baker) (07/13/88)

In <422@ns.ns.com>, ddb@ns.ns.com (David Dyer-Bennet) wrote:
>  Try this, composed on the spot:
>
>To invoke editor on a file: emacs <filename>
>To save the file: ^X^S
>To exit without saving: ^X^C
>Cursor keys move you around.  Typing inserts the characters typed.  Delete
>deletes the character to the left of the cursor.
>To delete from current position to end of line: ^K
>To go to beginning of line: ^A  To end of line: ^E
>Backspace invokes help.

  Doesn't work here.  The cursor keys don't work, and backspace doesn't
invoke help.  That's the biggest problem I've found trying to learn emacs.
Someone tells me how to use it, it doesn't work that way, and then they
say "Oh yeah, you've got to bind this to that and write 27 macros to get
it to work that way.  Try this instead...", and the loop repeats.  I ask
for a reference card (I *hate* on-line help), and they say there isn't one
because everyone sets things up differently.

  When I tell someone how to use vi, I don't have to know what kind of
terminal, OS, or hardware they have.  I can put everything they need to
know for basic editing  on an index card, and it will work with any vi.

>[...]  Note that I didn't have
>to expend any words explaining the different modes and how to get between
>them.-- 

  But you do have to expend words explaining exactly what setup I need
to get your command list to work...

-- 
Tracey Baker  {att, rutgers!moss}!mhuxu!tab or tab@mhuxu.att.com  (201)582-5357
Rm. 2F-211,  AT&T Bell Laboratories, 600 Mountain Ave., Murray Hill NJ 07974
Any resemblance to actual opinions,       |"There ain't no cure when the rabid
living or dead, is entirely coincidental. | rock dog bites..." - Split Sydney

ronc@cerebus.UUCP (Ronald O. Christian) (07/14/88)

In article <422@ns.ns.com> ddb@ns.ns.com (David Dyer-Bennet) writes:
>  Try this, composed on the spot:
>
>To invoke editor on a file: emacs <filename>
>To save the file: ^X^S
>To exit without saving: ^X^C
>Cursor keys move you around.  Typing inserts the characters typed.  Delete
>deletes the character to the left of the cursor.
>To delete from current position to end of line: ^K
>To go to beginning of line: ^A  To end of line: ^E
>Backspace invokes help.

Putting on my novice user hat for a minute:

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.



				Ron
-- 

      Ronald O. Christian (Fujitsu America Inc., San Jose, Calif.)
      {amdahl, pyramid, sun, unisoft, uunet}!cerebus!ronc

      Calling all Fujitsu Usenet sites!  Contact cerebus!ronc or
      ronc@fai.com to establish uucp connection.

aad@stpstn.UUCP (Anthony A. Datri) (07/15/88)

>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?
.
.
.
.
.
.
.
.
.-- 
@disclaimer(Any concepts or opinions above are entirely mine, not those of my
	    employer, my GIGI, or my 11/34)
beak is								  beak is not
Anthony A. Datri,SysAdmin,StepstoneCorporation,stpstn!aad

abcscnuk@csuna.UUCP (Naoto Kimura) (07/18/88)

In article <1872@stpstn.UUCP> aad@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 ?

rbj@nav.icst.nbs.gov (Root Boy Jim) (07/19/88)

? I believe it is possible to create a <500 word summary which will allow a
? complete novice to use vi at a rudimentary level sufficient to create or
? arbitrarily modify any text file (append, insert, delete, save, etc.) I have
? not heard of any such claim made for emacs. If such a summary does exist,
? I would be very glad to hear about it. Please post to me and I will summarize
? to the net.
?                                                     John Roberts
?                                                     roberts@cmr.icst.nbs.gov

Emacs has an online tutorial invoked by ^h t. Try it. Emacs also has online
documentation of all variables and funtions, as well as info-mode, which is
invoked by ^h i. The editor is self documenting. With vi you need the docs
handy or you must have already memorized the command set.

I have no problems with vi, other than the fact that I keep typing emacs
commands to it :-). Vi is good enough to avoid learning emacs, and I
resisted it for years. However, when you *do* invest the time and effort
to learn emacs, it pays off royally.

The ability to edit multiple files in multople windows and the unlimited
undo feature I consider to be the main reasons for switching. You also
get dired mode (the ability to edit/delete/rename/copy files in somewhat
of a menu mode), integrated make, grep, and shell mode, as well as a
nifty mail mode that undigests those long messages for you. I could
expound further, but will leave the rest for the novice to discover.

	(Root Boy) Jim Cottrell	<rbj@icst-cmr.arpa>
	National Bureau of Standards
	Flamer's Hotline: (301) 975-5688
	The opinions expressed are solely my own
	and do not reflect NBS policy or agreement
	Careful with that VAX Eugene!

ddb@ns.UUCP (David Dyer-Bennet) (07/20/88)

In article <811@cerebus.UUCP>, ronc@cerebus.UUCP (Ronald O. Christian) writes:
> I tried the above and when I tried to save the file the screen froze.
> ...
> David, I think you'd have to add some to your instructions.
  I didn't think I had to provide a complete set of instructions for
getting things to work on an arbitrary terminal.  There's little questions
of setting up terminal types and things, too, but I assumed all that had
been done as part of setting up the new user account, and so would be
transparent to the new user.  The first time I tried to use vi I got
an error message saying I needed a terminal that supported cursor
positioning, because the system administrator HADN'T done that stuff.
But I still think it should be done before the user ever sees the system.
-- 
	-- David Dyer-Bennet
	...!{rutgers!dayton | amdahl!ems | uunet!rosevax}!umn-cs!ns!ddb
	ddb@viper.Lynx.MN.Org, ...{amdahl,hpda}!bungia!viper!ddb
	Fidonet 1:282/341.0, (612) 721-8967 hst/2400/1200/300

ddb@ns.UUCP (David Dyer-Bennet) (07/20/88)

In article <7793@mhuxu.UUCP>, tab@mhuxu.UUCP (Tracey Baker) writes:
>   But you do have to expend words explaining exactly what setup I need
> to get your command list to work...
  If I were adopting emacs as an editor I regularly gave to novices,
I'd have the configuration for our terminals worked out, and print
out the command chart for that configuration.  I'm really not interested
in declaring "flexibility" to be a disadvantage.
-- 
	-- David Dyer-Bennet
	...!{rutgers!dayton | amdahl!ems | uunet!rosevax}!umn-cs!ns!ddb
	ddb@viper.Lynx.MN.Org, ...{amdahl,hpda}!bungia!viper!ddb
	Fidonet 1:282/341.0, (612) 721-8967 hst/2400/1200/300

james@h-three.UUCP (james) (07/20/88)

[
    I have conceded long ago to our local emacs fanatic that emacs is much more
    powerful and perhaps a better editor than vi.  I have not switched.  I just
    don't fee like learning a new set of commands.
]

I have often heard emacs described as 'a mono-modal editor'.  And the largest
complaint I have heard about vi is the 'constant switching of modes' (which
I never even notice, and never thought was a problem when I learned vi).

I've been following this emacs vs. vi stuff and seen this sort of thing
a lot about emacs:

> documentation of all variables and funtions, as well as info-mode, which is
    ...
> get dired mode (the ability to edit/delete/rename/copy files in somewhat
> of a menu mode), integrated make, grep, and shell mode, as well as a
> nifty mail mode that undigests those long messages for you. I could
    ...

I have also heard of vi-mode, vip-mode, 'normal'-mode, gnu-emacs, micro-emacs,
unipress emacs, ....



I've never heard two vi users argue about which version of vi was better :-)


-- 
=============================================================================
James P. Sutton
h-three Systems Corporation             {akgua,decvax}!mcnc!rti!h-three!james
Research Triangle Park, NC              (919) 549-8334 

greywolf@unisoft.UUCP (The Grey Wolf) (07/26/88)

I have never used honest-to-hot-puppies Emacs before, but I have used a very
nice, compact, fast derivative called "jove" (some of you may have heard of
it...).  There are quite a few differences, namely in the macro definitions,
but other than that, it appears to fit everyone else's definition of Emacs.

Since vi starts up almost instantly at every site I've ever logged into, I
use vi for small files and trivial adjustments.  I use Jove for large projects
because I find that I need those multiple windows, buffers and in-editor
shells (just so I don't have to exit/suspend to do something else).

With respect to regular expression matching, jove seems to handle just about
everything (it doesn't know how to do many of the RE suffixes, but as far as
substitute and/or search, it is very compatible with full RE's).

The main thing I find that I like about Emacs-style editors is that they are
stateless.  It is a royal pain in the /dev/null to have to alternate between
command and insert mode, at least for me (you are entitled to your own opin-
ions; I can't very well hold them against you...:-).  (My roommate complains
about stateless editors; he's used to touch-typing and likes being able to
have most of the movement and control keys in the home row.  Of course, he'll
have to remap everything when he gets his Dvorak keyboard...:-).

Summary:  While I can't make any claims against/for emacs, I can certainly
support each of jove and vi for their various advantages (vi for speed, jove
for versatility).  There is one thing that vi has that no other (non-vi, non-
ed related) editor seems to have:  An UNDO feature!  How many times have you
really trashed something in one swell foop and been grateful to have that
'u' key handy?  How many times have you not had it handy and wished you had?

Not wishing to start/perpetrate/perpetuate another religious war (waste of
time and bandwidth), the above represents my two cents worth.  I hope it
helps somehow.

-- 
 ** All views expressed herein are my own and not those of UniSoft Corp. **
# Statement: Not Invented Here.  My answer:  See Figure 1. 		  #
# Roan (RO-an) Anderson, UniSoft Corporation, (415) 420-6410 x 168.	  #
# ...sun!unisoft!greywolf # /harley/davidson: Mount device busy.###########

chet@pirate.CWRU.EDU (Chet Ramey) (07/27/88)

In article <1225@unisoft.UUCP> greywolf@unisoft.UUCP (The Grey Wolf) writes:

[about how he uses both vi and jove, each in its place]

>There is one thing that vi has that no other (non-vi, non-
>ed related) editor seems to have:  An UNDO feature!  How many times have you
>really trashed something in one swell foop and been grateful to have that
>'u' key handy?  How many times have you not had it handy and wished you had?

Try "M-x undo" in GNU emacs.  It will do the trick for you (it's saved my
-ss plenty of times).

Chet Ramey
chet@cwjcc.CWRU.EDU





| Chet Ramey            chet@cwjcc.CWRU.EDU    chet@alpha.CES.CWRU.EDU
|
|	"It is, it is a glorious thing to be a pirate king"

nate@mipos3.intel.com (Nate Hess) (07/28/88)

In article <1225@unisoft.UUCP> greywolf@unisoft.UUCP (The Grey Wolf) writes:
>There is one thing that vi has that no other (non-vi, non-ed related)
>editor seems to have: An UNDO feature!  How many times have you really
>trashed something in one swell foop and been grateful to have that 'u'
>key handy?  How many times have you not had it handy and wished you
>had?

Yes, an undo feature is nice, but vi's is massively limited.  For
example, if you accidentally have the shift lock key engaged and press 5 or
6 'J's, you're hosed, since pressing 'u' will only undo the last one of
them -- your file still looks like a bloody mess, and the only way to
"recover" is to :q!.

GNU Emacs, on the other hand, has a fully featured undo that allows one
to undo all the way back to an untouched file, one change at a time.

--woodstock
-- 
	   "How did you get your mind to tilt like your hat?"

...!{decwrl|hplabs!oliveb|pur-ee|qantel|amd}!intelca!mipos3!nate
<domainish> :   nate@mipos3.intel.com		ATT :    (408) 765-4309

davef@kcl-cs.UUCP (David Furber) (07/28/88)

This debate will doubtless run forever, but here is my three-penneth anyway:

As well as working for King's College I sometimes teach a five day C course
for a commercial training company.  It's a hands-on course and at the start
of the week I have to teach them to use the system.  Usually this has been
UNIX with VI as the editor.  Few have used either before and it takes most of
the Monday morning to get them going; also about 15% of the class are still
regularly hitting command keys without getting out of insert mode at the end of
the week (and hateing VI).

Last week I taught the course but, because we were using PS/2's and didn't have
VI, we used EMACS (stricty micro-emacs).  The results were better: they could 
use it adequately by coffe-time; on one person wasn't completly comfortable 
with it by the end of Tuesday, and even he was happy by the end of Wednesday.


CONCLUSION:  This seems to demostrate that EMACS is easier to learn than VI,
or at least that fewer people have real problems with it.  

It doesn't give any clue as to which is better for long term use, and
I still use VI for most work, but then people still program in languages
that have long since been superceded: I'll resist the temptation to name 
any for fear of starting another long argument :-).
-- 
        David Furber        ...ukc!kcl-cs!davef    davef%kcl-cs@uk.ac.ukc

gwyn@brl-smoke.ARPA (Doug Gwyn ) (08/01/88)

In article <2661@mipos3.intel.com> nate@mipos3.intel.com (Nate Hess) writes:
-In article <1225@unisoft.UUCP> greywolf@unisoft.UUCP (The Grey Wolf) writes:
->There is one thing that vi has that no other (non-vi, non-ed related)
->editor seems to have: An UNDO feature!
-Yes, an undo feature is nice, but vi's is massively limited.
-GNU Emacs, on the other hand, has a fully featured undo that allows one
-to undo all the way back to an untouched file, one change at a time.

A truly useful "undo" is another thing that "sam" offers.