[Sussex] Vi?

Geoff Teale gteale at cmedltd.com
Wed Jul 28 11:12:39 UTC 2004


OK ok.. ;)

It's not easy to convince someone how great emacs is until they've tried
using it for more than just simple text editing, but here goes:

5 things. 
==========
(Note Emacs is platform independent and thus keyboard independent, on
PC's "Meta" means Alt, on Mac's it's the propellor key, Esc usually
works as well on any platform)

0.
==
You can learn the basics in half an hour.  Open a GUI emacs session,
goto the help menu and select tutorial.

1.  
==
Emacs is an environment - you can use it as a single point of
interatcion with the operating system for all your everyday tasks.  Why
would you want to do this?  Well:
   
   a. You only have to learn to use one tool.
   
   b. Emacs works in the same way whether it's running on Linux,
Windows, Mac OS X, Solaris, QNX, AIX, BeOS, .... etc. etc..
   
   c. Every tasks you undertake benefits from the same standard
functionality.  Imagine looking at a directory lisiting and being able
to find and replace on file-names, sort them, switch them, search for
them and in them.  Imagine that this achieved in the same way for your
mail, NNTP, calendar, C, C++, Java, Python, Perl, Bash, PHP, your CVS
respository, your LDAP Directory, everything under /etc, your IRC
session, your CDWriter, your remote Apache configuration, your package
manager (on Debian, Gentoo, Arch,.. etc... etc) and your MP3 player(!). 

   d. You can script your everyday tasks in Emacs and install those
scripts anywhere emacs runs.


2.
==
Emacs makes basic text editing quick and easy and provides thos
facilities to all the tools built around it.  In this respect it is now
different to vi or vim - it's mechanisms are different, but that's a
matter of preference.  Emacs some things following things you won't find
in the average notepad app, here's just a few:

   a. Delete from the cursor to the end of the line with one action.  
(Ctrl-K)

   b. Delete forwards or back one logical block (the definition of a
logical block depends on the type of file you're editing).  This is
(Meta-D) or (Meta-Backspace).  

   c. Switch two characters in place (Ctrl-t), or switch to logical
blocks in place (Meta-t).

   d. Move text from it's postion to the end of the last line (no matter
how much whitespace is inbetween - more useful than it sounds). 
(Meta-^)

   e. Intelligent completion.  Not the inspection used in a lot of IDE's
(some emacs tools, i.e. jde, do this as well), but intelligent
completion of words used in open files of the same type.  This feature
is sensitive to where you are in a file, and what you've typed most
recently, most frequently, etc. (Meta-/)

   f. Progressive search.  Searches as you type, highlighting everything
in the buffer that matches and actively restricting the search as you
type more. (Ctrl-s).

   g. Kill and Yank.  Rather than provide copy and past, emacs adds any
copy (Meta-W) or "kill" (Ctrl-W) to the "kill ring".  When you "Yank"
(Ctrl-y) emacs pastes in the last things it added into the "kill ring". 
If you actually wanted the previous thing you copied, just hit (Meta-y)
and emacs will remove the thing it just pasted and relace it with the
previous thing in it's kill ring.  Continuously pressing (Meta-y) will
step back through all the things you've copied or killed.  I've seen
microsoft trying to implement this with Office's copy and paste
facilities in recent years, but their implementation is awful, emacs
does it easily.


3.
==
Emacs is extensible.  Almost every programming language, config file or
tool can be edited or controlled through emacs.  These features are not
"built-in" but rather come as plugin programs.  You're not tied to a
release schedule to get some new feature you need, generally a quick
google will find you the support and you can download it and begin using
it immediately.  Best of all you can write your own extensions in
Emacs-LISP, python, perl, ruby, Java, PHP, Bash or C/C++.  You have
absolute control over the editor, you can _make_ emacs do things you
want that no editor other editor can do.  If all that's too much for
you, then recording macros and binding them to menu's and key-combos is
simple.

4.
==
If you don't like the keybindings you can change them and those changes
will propogate to all the things you control/edit through emacs.

5.
==
Try a few emacs key-bindings in bash and see what you can do... 
 
     
-- 
Geoff Teale
Cmed Technology





More information about the Sussex mailing list