Michael A. Stone writes:

> >true probably, have never been able to do a search replace in vi(le) yet in
> >emacs I fly through everything...
>     :%s/[old string]/[new string]/g
> is a global search & replace for all instances of a string within a file.
> [...]
> wasn't that easy?  ;-)
> 
> what you have to do is drop into 'ex' mode, which is the line-by-line
> editing system that preceded vi.   the thing that makes vi such a pain to
> learn is that it's very modal.. what a given key does depends heavily on
> the key you pressed before it.   there /is/ a logic beneath it all, but it
> takes a while to imprint it the cheat sheet on the inside of your skull.
> 
> (personally, i think the cut buffers rule, though.. 52 alternate buffers
> for cutting & pasting.   being able to cut text into one buffer, without
> having to clobber what you just copied from somewhere else, is addictive
> once you get used to it)

     You need to read up on the emacs "kill-ring" and the yank-pop
command, (usually mapped to escape-y).  Essentially, each time you
"kill" a region (or do copy-as-kill) the text is added to the
kill-ring.  Most of the time when you yank (usually with control-y)
something back, you want whatever it is you just killed - as with
standard GUI cut&paste.  

     But if you wanted something you cut earlier you can yank (ctl-y)
and then yank-pop (esc-y - make sure you don't type anything between
the ctl-y and the esc-y) to get the preceding item, yank-pop again to
get the one before that, etc.  I do wish emacs had an option for
dynamically viewing and selecting/editing the kill ring, though.  I'm
sure the size of the ring is configurable but I haven't looked at that
in several years.

     Plus, using emacs standard buffer commands you can just
instantiate a spare buffer and cut&paste stuff into it to your heart's
content.

> emacs is a newer system, specifically designed as a screen editor, IIRC

     "Newer"?  Slightly less old, perhaps, would be a better phrasing. :-)

> emacs takes advantage of the 'bucky bits'
> available on modern keyboards.. the <CTRL>, <SHIFT>, <ALT>, and <META> keys
> [...]
> the challenge of emacs is to remember all the variant mappings each key can
> have within such a rich environment of possibilities.   then there are the
> multi-keystroke commands, which involve further learning still.   

     True, there are a lot of control-keys and meta-keys, etc, to
remember.  I tend to have the common line-editing keys and some of the
buffer manipulation keys memorized.  For the rest I do escape-x
command-name<ret> so I don't have to remember them.  While you're
typing the command name, you can use the tab key to autocomplete (if
there's more than one option it'll display the choices after the
second tab, or you can just press ? to display the choices
immediately).

     Different mappings of keys to commands are a result of a strength
of emacs though, not a weakness.  In emacs the commands are defined
independently of the control-keys, and then a control-key combination
is mapped to invoke the command.  There are default configurations for
most commands and you can edit your own.  The fact that different
installations might use different command keys is a choice that
whoever installed emacs - or built the particular variant distribution
that was installed - made.

     I could as easily say vi mode commands change because people
edit the source and recompile it :-).

> then there's the built-in LISP interpreter, just in case you get
> bored after mastering the previous learning curves.

     A few months back somebody added support for writing emcs
extensions in Perl :-).  

     I feel I should clarify something; emacs doesn't "have" a
built-in LISP interpreter, it IS a lisp interpreter.  Emacs is lisp
interpreter with a special dialect of LISP designed for text
procesing, and the bulk of the editor is then written in that dialect
of LISP.  Though I've never mastered much beyond the trivial in elisp,
over the years I've come to admire that basic design approach in
various programs I've encountered

> then there's the universe of code extensions that other emacs users
> have twiddled together and found useful enough to share, which do
> everything from acting as a mail client to serving as an alarm
> clock.
 
     Not to mention being a:

     mail reader (RMAIL) ,

     news reader (gnus),

     telnet client,

     ftp client (ange-ftp, which can let you transparently ftp a file,
edit it, and ftp the edited version back)

     file hierarchy browser and editor (try opening a directory as if
it were a file),

     having special support for auto-indenting and syntax checking for
a wide variety of programming languages,

     integration with gcc and gdb for a powerful integrated C
development environment,

     supporting some sort of client/server emacs system (I've never
used it but apparently you can have an emacs server on one machine and
run the interface as a client on another machine),

     the "texinfo " hypertext browser (and authoring system) that
predatges the web by several years at least, 

     oh and now that I've mentioned the web, there're at least a
couple web-browser extensions written for emacs (though obviously
those work better in the GUI versions of emacs),

     having two or three "vi emulation" modes so vi users can 
upgrade to emacs fairly comfortably,

     Having an "outline mode" which, while not the best, certainl beat
most GUI wp programs up until a few years ago when they finally
started adding those features,

     etc.

> the standard jabs are:
> 
>     'vi'    : Virtually Impossible

     My favorite is

     "vi is the editor of the beast, after all:  vi vi vi = 666!"

     It's fun and theatrical and it pretty well demonstrates the
futility of the debate.

     One of my old martial arts teachers touched on a similar topic
when discussing some techniques.  He used the metaphor of hand tools.
A generic tool like a screwdriver, though designd and optimized for
one thing, can be used for many things (prying open a paint can, not
to mention stirring it if it's a cheap screwdriver, punching holes in
things, etc) while a specialized tool like a pipe-cutter is pretty
much only good for one thing, pipe-cutting.  But when you need to cut
pipes, nothing else will do.

>     'emacs ': Eight Megs And Constantly Swapping

     I spend a lot of time doing most of my work from within emacs.  I
know people who seldom leave emacs once they've logged in.  It can
indeed swell up a bit, particularly if you're using some of your
buffers as telnet clients and they're constantly receiving input over
four or five days.
 
> technologically, they're both dinosaurs.   OTOH, they're both damn useful

     True; vi is quite small and ubiquitous.  Fairly powerful if you
know its secrets (I don't).  

     My favorite part about emacs is that it lets me do so much, with
a fairly logical command-scheme.  This is hard for me to describe.
For some tasks, you still can't beat a GUI ( for example, for cut &
paste and for DTP type layout; mostly visual tasks, unsurprisingly),
but the rest of the time emacs feels like an extension of my brain.
It's as if the GUI is inside my brain and I can communicate directly
with the editor.  Imagine if you had, instead of a word processor, the
world's best secretary and a comprehensive shorthand language with
which to communicate with him/her.

     This isn't just a matter of familiarity (although obviously
that's necessary) but of the complex regular expressions, buffer
controls, and various commands that make doing quick throwaway macros
easy to write in a few seconds, and in general let you deal with the
text neither as sequences of letters (like traditional world
processors) nor as a structure of objects (as perhaps a good SGML
editor would allow you to) but something in between.
 
> one of these days i want to see an SF movie, set in the 23d century,
> which shows two characters /still/ engaged in the holy war between
> vi & emacs.  ;-)

     Hee!  Actually, if you think about it , the recent movie _The
Matrix_, is a subtle statement of the classic command-line vs. GUI
holy war.  Go see it, it's a fun action flick in any event.  Don't
expect lots of acting, but plenty of good visuals, good martial arts
action and lots of gunshots and explosions.  Plus some pretty decent
SF for something appearing on the big screen.

Steven J. Owens
[EMAIL PROTECTED]

____________________________________________________________________
--------------------------------------------------------------------
 Join The NEW Web Consultants Association FORUMS and CHAT:
   Register Today at: http://just4u.com/forums/
Web Consultants Web Site : http://just4u.com/webconsultants
   Give the Gift of Life This Year...
     Just4U Stop Smoking Support forum - helping smokers for
      over three years-tell a friend: http://just4u.com/forums/
          To get 500 Banner Ads for FREE
    go to http://www.linkbuddies.com/start.go?id=111261
---------------------------------------------------------------------

Reply via email to