[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: vi



On Mon, 14 Apr 1997, Rick Macdonald wrote:

> Ralph Winslow wrote:
> 
> > > emacs:
> > >
> > > M-<                     ; go to beginning of file
> > > C-x (                   ; start recording kbd macro
> > > C-s 129.168.1 RET       ; search for 192.168.1
> > > M-b M-b M-b             ; go back three words
> > > M-d M-d M-d             ; delete three words
> > > 129.168.200             ; insert new string
> > > C-x )                   ; end kbd macro
> > > C-x e                   ; repeat
> > > C-x e                   ; repeat
> > > C-x e                   ; repeat
> 
> I could care less what editor anybody (not in my patroll ;-)
> uses. I'm sending this for the benefit of the emacs user
> who wrote the above.
> 
> I beg to differ the emacs case:
> 
> M-<                     ; go to beginning of file
> M-%			; query-replace
> 129.168.1 RET     	; search for 192.168.1
> 129.168.200 RET		; replace with 129.168.200
> !			; repeat for all occurrences
> 
> This is fewer keystrokes than vi. If you don't want every
> occurrence changed, then you press one key to perform or
> another toskip each one as you see it.

Well, in vi you can do:
1G				Go to the beginning
:%s/129.168.1/129.168.200/	(if I remember it right)
Still better...

Vadik.

--
Vadim Vygonets * vadik@cs.huji.ac.il * vadik@debian.org * Unix admin
If you think C++ is not overly complicated, just what is a protected
abstract virtual base pure virtual private destructor, and when was
the last time you needed one?  -- Tom Cargil, C++ Journal, Fall 1990.


Reply to: