From: Deniz Dogan <deniz@dogan.se>
To: help-gnu-emacs@gnu.org
Subject: Re: Emacs equivalent of the ":g" command in vi
Date: Fri, 22 Jul 2011 12:46:41 +0200 [thread overview]
Message-ID: <4E295511.4040108@dogan.se> (raw)
In-Reply-To: <4E2954BA.7040800@dogan.se>
On 2011-07-22 12:45, Deniz Dogan wrote:
> On 2011-07-22 12:02, C K Kashyap wrote:
>> > which could be as simple as in vi/vim.)
>> I think he want to delete lines matching a regexp, so C-k is not what he
>> wants here.
>>
>> `query-replace-regexp' can be used with a regexp like this:
>>
>> ^.*\(your_regexp\).*$
>>
>> and you replace with nothing (empty prompt).
>>
>> --
>>
>>
>> replace-regexp is indeed closer to what I am looking for. However, I'd
>> like the result to not leave blank lines.
>>
>> Regards,
>> Kashyap
>
> First, either move to the start of where you want to search OR make an
> active region (select) the parts where you want it to take effect. M-<
> goes to the beginning of the buffer and C-x h marks the whole buffer, FYI.
>
> Now, M-x delete-matching-lines RET your_regexp RET
>
You may also want to know about:
Global Bindings Starting With M-s:
key binding
--- -------
M-s h Prefix Command
M-s o occur
M-s w isearch-forward-word
M-s h f hi-lock-find-patterns
M-s h l highlight-lines-matching-regexp
M-s h p highlight-phrase
M-s h r highlight-regexp
M-s h u unhighlight-regexp
M-s h w hi-lock-write-interactive-patterns
As you can see, e.g. M-s h r can be very useful at times.
Deniz
next prev parent reply other threads:[~2011-07-22 10:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-22 8:42 Emacs equivalent of the ":g" command in vi C K Kashyap
2011-07-22 9:27 ` Peter Dyballa
2011-07-22 9:48 ` Thierry Volpiatto
2011-07-22 10:02 ` C K Kashyap
2011-07-22 10:12 ` Peter Dyballa
2011-07-22 10:41 ` C K Kashyap
2011-07-22 10:34 ` Thien-Thi Nguyen
2011-07-22 10:44 ` C K Kashyap
2011-07-22 10:45 ` Deniz Dogan
2011-07-22 10:46 ` Deniz Dogan [this message]
2011-07-22 19:03 ` Eric Abrahamsen
2011-07-22 20:27 ` MBR
2011-07-22 20:37 ` Andreas Röhler
2011-07-22 20:51 ` MBR
2011-07-23 7:10 ` Andreas Röhler
2011-08-15 0:27 ` Ken Goldman
2011-07-23 3:02 ` C K Kashyap
2011-07-23 8:44 ` suvayu ali
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=4E295511.4040108@dogan.se \
--to=deniz@dogan.se \
--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.