From: Rupert Swarbrick <rswarbrick@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: vim equivalent in emacs %5,50s/serah_term/replace_term/gc
Date: Fri, 09 Nov 2007 10:18:59 GMT [thread overview]
Message-ID: <nuWYi.34222$T8.22800@newsfe5-win.ntli.net> (raw)
In-Reply-To: mailman.3119.1194512077.18990.help-gnu-emacs@gnu.org
> 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.
Go to the start of line 5 and C-space to set the mark and then go to
line 50 and C-x n n to call narrow-to-region. Emacs will warn you
you're doing something weird, so tell it that you really want to. Then
most of the buffer disappears, leaving just the stuff you want to
change.
Now replace-string just changes stuff in this region. To get back to
the whole file, you need C-x n w which calls "widen".
For getting to lines, M-g g is goto-line, which might help.
Rupert
next parent reply other threads:[~2007-11-09 10:18 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 ` Rupert Swarbrick [this message]
2007-11-09 22:53 ` vim equivalent in emacs %5,50s/serah_term/replace_term/gc Lennart Borgman (gmail)
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='nuWYi.34222$T8.22800@newsfe5-win.ntli.net' \
--to=rswarbrick@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.