Another Chapter in the vi vs. emacs War
Bill Campbell
linux-sxs at celestial.com
Mon Feb 4 14:17:46 PST 2008
On Mon, Feb 04, 2008, Rick Bowers wrote:
>At Monday 2/4/2008 08:54 AM, you wrote:
>>On Feb 4, 2008 1:46 AM, <kwall at kurtwerks.com> wrote:
>>> http://xkcd.com/378/
>>>
>>> The nice thing about Linux is that I can (and do) use both.
>>
>>I haven't yet grown that required third hand to properly use emacs
>>(eight-hundred megs and constantly swapping), so I stick to vi
>>(nvi|vim).
>>
>>But I do like the chaos editor (aka butterfly).
>>
>>Ciao,
>>
>>David A. Bandel
>>--
>
>I've used both VI and EMACS for many years. I mostly use VI these
>days, but still haven't figured out if/how VI does macros. In EMACS,
>it's Meta-( <a bunch of commands> Meta-)
>Then I can Meta-X or ESC<numeric value>Meta-X (or is that
>Meta-<numeric value>) ?
>
>Anyone know the VI equivalent?
There are several ways to accomplish this type of thing. One can
map keys so they are short cuts to commands when in command mode.
Set up abbreviations using ``abbr'' with something in the .vimrc
file like ``abbr linux \fBLinux\fP'' which would expand lower
case linux to groff boldface Linux.
One can also yank commands into buffers, then execute the buffer
using ``@bufferchar'' which I find handy when trying to get
complex substitutions right.
# here's part of my ~/.vimrc file...
set shell=/bin/bash
set showmode
set autoindent
set nonumber
set autowrite
set ignorecase
set showmatch
set wrapscan
set mesg
set ai sw=4 ts=4 aw ic shell=/bin/bash sm wm=15
set tags=tags\ ../util/utiltags\ ../util/libtags
map <F5> {!}fmt
map <F6> {!}/usr/bin/fmt
set ruler
set mps+=<:>
syntax off
The ``map'' commands above map the F5 and F6 keys to the fmt command in my
PATH and /usr/bin/fmt respectively (my fmt runs the text through nroff
allowing more flexibility). They take the cursor to the top of the current
paragraph ``{'', execute a command to the end of the paragraph ``!}'', and
the command follows.
Another useful capability I use frequently is ``!!sh'' which executes
whatever is on the current line, replacing the line with the output of the
command. Say I want to insert the calendar for 2008 in this message, I
would type ``cal 2008'' on the line type ``!!sh<enter>'':
2008
January February March
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 1 2 1
6 7 8 9 10 11 12 3 4 5 6 7 8 9 2 3 4 5 6 7 8
13 14 15 16 17 18 19 10 11 12 13 14 15 16 9 10 11 12 13 14 15
20 21 22 23 24 25 26 17 18 19 20 21 22 23 16 17 18 19 20 21 22
27 28 29 30 31 24 25 26 27 28 29 23 24 25 26 27 28 29
30 31
April May June
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 1 2 3 1 2 3 4 5 6 7
6 7 8 9 10 11 12 4 5 6 7 8 9 10 8 9 10 11 12 13 14
13 14 15 16 17 18 19 11 12 13 14 15 16 17 15 16 17 18 19 20 21
20 21 22 23 24 25 26 18 19 20 21 22 23 24 22 23 24 25 26 27 28
27 28 29 30 25 26 27 28 29 30 31 29 30
July August September
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 1 2 1 2 3 4 5 6
6 7 8 9 10 11 12 3 4 5 6 7 8 9 7 8 9 10 11 12 13
13 14 15 16 17 18 19 10 11 12 13 14 15 16 14 15 16 17 18 19 20
20 21 22 23 24 25 26 17 18 19 20 21 22 23 21 22 23 24 25 26 27
27 28 29 30 31 24 25 26 27 28 29 30 28 29 30
31
October November December
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 1 1 2 3 4 5 6
5 6 7 8 9 10 11 2 3 4 5 6 7 8 7 8 9 10 11 12 13
12 13 14 15 16 17 18 9 10 11 12 13 14 15 14 15 16 17 18 19 20
19 20 21 22 23 24 25 16 17 18 19 20 21 22 21 22 23 24 25 26 27
26 27 28 29 30 31 23 24 25 26 27 28 29 28 29 30 31
30
Bill
--
INTERNET: bill at celestial.com Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way
FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676
Just because you do not take an interest in politics doesn't mean politics
won't take an interest in you. -- Pericles
-------------- next part --------------
set shell=/bin/sh
set showmode
set autoindent
set nonumber
set autowrite
set ignorecase
set showmatch
set wrapscan
set mesg
set ai sw=4 ts=4 aw ic shell=/bin/sh sm wm=15
map :!sh -x %
map mrGme:w!
:r !Lint %
map :!cc -c $CFLAGS %
map Gme:w!
:r !ulint %
map :!putcvs %
set tags=tags\ ../util/utiltags\ ../util/libtags
map <F5> {!}fmt
map <F6> {!}/usr/bin/fmt
set ruler
set mps+=<:>
syntax off
More information about the Linux-users
mailing list