* vim equivalent in emacs %5,50s/serah_term/replace_term/gc
@ 2007-11-08 4:01 iluvindo
2007-11-08 10:48 ` Peter Dyballa
[not found] ` <mailman.3124.1194518944.18990.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 10+ messages in thread
From: iluvindo @ 2007-11-08 4:01 UTC (permalink / raw)
To: Help-gnu-emacs
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
--
View this message in context: http://www.nabble.com/vim-equivalent-in-emacs--5%2C50s-serah_term-replace_term-gc-tf4768884.html#a13640969
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: vim equivalent in emacs %5,50s/serah_term/replace_term/gc
2007-11-08 4:01 iluvindo
@ 2007-11-08 10:48 ` Peter Dyballa
[not found] ` <mailman.3124.1194518944.18990.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 10+ messages in thread
From: Peter Dyballa @ 2007-11-08 10:48 UTC (permalink / raw)
To: iluvindo; +Cc: Help-gnu-emacs
Am 08.11.2007 um 05:01 schrieb iluvindo:
> 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?
Activate 'active region highlighting' from Options menu, mark the
region either by dragging with the mouse cursor or with the keyboard
(M-g g 5 RET C-SPC M-g g 50 RET), and then substitute:
M-x replace-string RET <from> RET <to> RET
The number of replacements in one line cannot be limited to one.
Details can be found in the GNU Emacs tutorial (C-h t) or when asking
for a description of the function:
C-h f <function name> RET
There is also a hypertext based documentation:
C-h i RET m emacs RET
There is also the function replace-regexp which uses regular
expressions to search for a string and replace it with another one.
--
Greetings
Pete
Make it simple, as simple as possible but no simpler.
Albert Einstein
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: vim equivalent in emacs %5,50s/serah_term/replace_term/gc
[not found] <mailman.3119.1194512077.18990.help-gnu-emacs@gnu.org>
@ 2007-11-09 10:18 ` Rupert Swarbrick
2007-11-09 22:53 ` Lennart Borgman (gmail)
0 siblings, 1 reply; 10+ messages in thread
From: Rupert Swarbrick @ 2007-11-09 10:18 UTC (permalink / raw)
To: help-gnu-emacs
> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: vim equivalent in emacs %5,50s/serah_term/replace_term/gc
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)
0 siblings, 0 replies; 10+ messages in thread
From: Lennart Borgman (gmail) @ 2007-11-09 22:53 UTC (permalink / raw)
To: Rupert Swarbrick; +Cc: help-gnu-emacs
>> 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.)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: vim equivalent in emacs %5,50s/serah_term/replace_term/gc
[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
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: David Combs @ 2007-11-23 2:33 UTC (permalink / raw)
To: help-gnu-emacs
In article <mailman.3124.1194518944.18990.help-gnu-emacs@gnu.org>,
Peter Dyballa <Peter_Dyballa@Web.DE> wrote:
>
>Am 08.11.2007 um 05:01 schrieb iluvindo:
>
>> 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?
>
>Activate 'active region highlighting' from Options menu, mark the
>region either by dragging with the mouse cursor or with the keyboard
>(M-g g 5 RET C-SPC M-g g 50 RET), and then substitute:
M-g? So I did C-h k on M-g, and in a mini-or-whatever buffer at
screen bottom, a line saying "set-face: default m-g d, ......".
My question: how to grab that doc-line?
Trying to regionize it kills it, nor does it seem to be in *Messages*.
Thanks!,
David
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: vim equivalent in emacs %5,50s/serah_term/replace_term/gc
2007-11-23 2:33 ` David Combs
@ 2007-11-23 2:43 ` Giorgos Keramidas
2007-12-16 19:40 ` David Combs
2007-11-23 10:15 ` Peter Dyballa
[not found] ` <mailman.3967.1195812952.18990.help-gnu-emacs@gnu.org>
2 siblings, 1 reply; 10+ messages in thread
From: Giorgos Keramidas @ 2007-11-23 2:43 UTC (permalink / raw)
To: help-gnu-emacs
On Fri, 23 Nov 2007 02:33:24 +0000 (UTC), dkcombs@panix.com (David Combs) wrote:
>In article <mailman.3124.1194518944.18990.help-gnu-emacs@gnu.org>,
>Peter Dyballa <Peter_Dyballa@Web.DE> wrote:
>>
>>Am 08.11.2007 um 05:01 schrieb iluvindo:
>>
>>> 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?
>>
>>Activate 'active region highlighting' from Options menu, mark the
>>region either by dragging with the mouse cursor or with the keyboard
>>(M-g g 5 RET C-SPC M-g g 50 RET), and then substitute:
>
> M-g? So I did C-h k on M-g, and in a mini-or-whatever buffer at
> screen bottom, a line saying "set-face: default m-g d, ......".
>
> My question: how to grab that doc-line?
M-g is a `command prefix'. You can see the help of `M-g g' by typing
`C-h k M-g g'. This opens a new buffer/window, and you can switch to
that window using `C-x o' (one more more times, if necessary), to copy
text, move around, etc.
If you are using a GUI version of Emacs, point with your favorite
pointing device and click somewhere in the help buffer. It will become
the active buffer, and you can copy text, move around, and so on...
HTH,
Giorgos
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: vim equivalent in emacs %5,50s/serah_term/replace_term/gc
2007-11-23 2:33 ` David Combs
2007-11-23 2:43 ` Giorgos Keramidas
@ 2007-11-23 10:15 ` Peter Dyballa
[not found] ` <mailman.3967.1195812952.18990.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 10+ messages in thread
From: Peter Dyballa @ 2007-11-23 10:15 UTC (permalink / raw)
To: David Combs; +Cc: help-gnu-emacs
Am 23.11.2007 um 03:33 schrieb David Combs:
>> Activate 'active region highlighting' from Options menu, mark the
>> region either by dragging with the mouse cursor or with the keyboard
>> (M-g g 5 RET C-SPC M-g g 50 RET), and then substitute:
>
>
> M-g? So I did C-h k on M-g, and in a mini-or-whatever buffer at
> screen bottom, a line saying "set-face: default m-g d, ......".
M-g has become a command prefix in GNU Emacs 22. M-g g invokes the
function goto-line. In earlier version(s) in invoked the set-face
function.
>
> My question: how to grab that doc-line?
Which ``doc-line´´? Do you mean what the key combination is doing/
stands for? C-h k <key combination>.
>
> Trying to regionize it kills it, nor does it seem to be in *Messages*.
Could be there is also activation of transient-mark-mode necessary.
And again: GNU Emacs 21 might miss this and that ...
--
Greetings
Pete
From error to error, one discovers the entire truth.
- Sigmund Freud
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: vim equivalent in emacs %5,50s/serah_term/replace_term/gc
2007-11-23 2:43 ` Giorgos Keramidas
@ 2007-12-16 19:40 ` David Combs
2007-12-16 23:08 ` Peter Dyballa
0 siblings, 1 reply; 10+ messages in thread
From: David Combs @ 2007-12-16 19:40 UTC (permalink / raw)
To: help-gnu-emacs
In article <87y7cpwujb.fsf@kobe.laptop>,
Giorgos Keramidas <keramida@ceid.upatras.gr> wrote:
>On Fri, 23 Nov 2007 02:33:24 +0000 (UTC), dkcombs@panix.com (David Combs) wrote:
>>In article <mailman.3124.1194518944.18990.help-gnu-emacs@gnu.org>,
>>Peter Dyballa <Peter_Dyballa@Web.DE> wrote:
>>>
>>>Am 08.11.2007 um 05:01 schrieb iluvindo:
>>>
>>>> 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?
>>>
>>>Activate 'active region highlighting' from Options menu, mark the
>>>region either by dragging with the mouse cursor or with the keyboard
>>>(M-g g 5 RET C-SPC M-g g 50 RET), and then substitute:
>>
>> M-g? So I did C-h k on M-g, and in a mini-or-whatever buffer at
>> screen bottom, a line saying "set-face: default m-g d, ......".
>>
>> My question: how to grab that doc-line?
>
>M-g is a `command prefix'. You can see the help of `M-g g' by typing
>`C-h k M-g g'.
(Sorry for the very-late response!)
As you suggested, I (again) do:
C-h k on Meta(ie esc)-g(as in grep)
and I still get that set-face thing in that one-line window-thingie
down at the very bottom of the screen
, and that's before I even get a chance to enter that *second*
g (In M-g g).
What do *you* get when you try it?
And I do your suggested C-x o (which of course I use
all the time) while sitting there at the end of
that set-face line (*in* that bottom-of-screen one-line window),
and the only effect is to erase that set-face line.
I'm using 21.3.2.
>This opens a new buffer/window, and you can switch to
>that window using `C-x o' (one more more times, if necessary), to copy
>text, move around, etc.
>
>If you are using a GUI version of Emacs, point with your favorite
>pointing device and click somewhere in the help buffer. It will become
>the active buffer, and you can copy text, move around, and so on...
But I'm not in the help buffer! I'm in that little ephemeral bottom-of-screen,
what, "mini window"?
>
>HTH,
>Giorgos
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: vim equivalent in emacs %5,50s/serah_term/replace_term/gc
[not found] ` <mailman.3967.1195812952.18990.help-gnu-emacs@gnu.org>
@ 2007-12-16 19:42 ` David Combs
0 siblings, 0 replies; 10+ messages in thread
From: David Combs @ 2007-12-16 19:42 UTC (permalink / raw)
To: help-gnu-emacs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1208 bytes --]
In article <mailman.3967.1195812952.18990.help-gnu-emacs@gnu.org>,
Peter Dyballa <Peter_Dyballa@Web.DE> wrote:
>
>Am 23.11.2007 um 03:33 schrieb David Combs:
>
>>> Activate 'active region highlighting' from Options menu, mark the
>>> region either by dragging with the mouse cursor or with the keyboard
>>> (M-g g 5 RET C-SPC M-g g 50 RET), and then substitute:
>>
>>
>> M-g? So I did C-h k on M-g, and in a mini-or-whatever buffer at
>> screen bottom, a line saying "set-face: default m-g d, ......".
>
>M-g has become a command prefix in GNU Emacs 22. M-g g invokes the
>function goto-line. In earlier version(s) in invoked the set-face
>function.
AH-HA! THANK YOU!
>
>>
>> My question: how to grab that doc-line?
>
>Which ``doc-line´´? Do you mean what the key combination is doing/
>stands for? C-h k <key combination>.
>
>>
>> Trying to regionize it kills it, nor does it seem to be in *Messages*.
>
>
>Could be there is also activation of transient-mark-mode necessary.
>And again: GNU Emacs 21 might miss this and that ...
>
>--
>Greetings
>
> Pete
>
> From error to error, one discovers the entire truth.
> - Sigmund Freud
>
>
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: vim equivalent in emacs %5,50s/serah_term/replace_term/gc
2007-12-16 19:40 ` David Combs
@ 2007-12-16 23:08 ` Peter Dyballa
0 siblings, 0 replies; 10+ messages in thread
From: Peter Dyballa @ 2007-12-16 23:08 UTC (permalink / raw)
To: David Combs; +Cc: help-gnu-emacs
Am 16.12.2007 um 20:40 schrieb David Combs:
> I'm using 21.3.2.
In this version M-g goes right into the face!
--
Greetings
Pete
(This space left blank for technical reasons.)
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-12-16 23:08 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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)
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
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.