unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: Rupert Swarbrick <rswarbrick@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: vim equivalent in emacs %5,50s/serah_term/replace_term/gc
Date: Fri, 09 Nov 2007 23:53:28 +0100	[thread overview]
Message-ID: <4734E4E8.7050904@gmail.com> (raw)
In-Reply-To: <nuWYi.34222$T8.22800@newsfe5-win.ntli.net>

>> Hi I recently moved from vim to emacs and need help to search and
>> replace using line numbers(say between two lines 5 and 50).  This can be
>> done in vim as %5,50s/serah_term/replace_term/gc
>> What is equivalent in emacs?
>> Thanks,
>> Iluvindo
> 
> I don't know whether you can explicitly restrict the replace-string 
> function, but the simplest way to do what you want is with narrow-to-
> region.

 From the doc string for replace-string in Emacs 22:

   In Transient Mark mode, if the mark is active, operate on the contents
   of the region.  Otherwise, operate from point to the end of the
   buffer.

So if region is visibly marked then the replace is only done in the 
region. (This is true if you use cua-mode for example.)

  reply	other threads:[~2007-11-09 22:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.3119.1194512077.18990.help-gnu-emacs@gnu.org>
2007-11-09 10:18 ` vim equivalent in emacs %5,50s/serah_term/replace_term/gc Rupert Swarbrick
2007-11-09 22:53   ` Lennart Borgman (gmail) [this message]
2007-11-08  4:01 iluvindo
2007-11-08 10:48 ` Peter Dyballa
     [not found] ` <mailman.3124.1194518944.18990.help-gnu-emacs@gnu.org>
2007-11-23  2:33   ` David Combs
2007-11-23  2:43     ` Giorgos Keramidas
2007-12-16 19:40       ` David Combs
2007-12-16 23:08         ` Peter Dyballa
2007-11-23 10:15     ` Peter Dyballa
     [not found]     ` <mailman.3967.1195812952.18990.help-gnu-emacs@gnu.org>
2007-12-16 19:42       ` David Combs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4734E4E8.7050904@gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=rswarbrick@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).