On 2020-09-19 16:43, 'Grant Taylor' via vim_use wrote:
> > - the thing looked for in the s// command
>
> This is actually where I was wanting to use the contents of
> g/first/. ;-)
>
>> Using the :norm method, you don't have the two boundary regexen
>> to change the most-recently-used-search,
On 9/19/20 3:13 PM, Tim Chase wrote:
My assumption was that "aaa" was a meta-regex that matched whatever
was needed, including any word-boundaries or other matching/context
the OP needed.
That seems like a reasonable assumption. Thank you for clarifying.
Depends on what you mean. There
On 2020-09-19 14:06, 'Grant Taylor' via vim_use wrote:
> >:g/aaa/norm vip:s//bbb^V^M
> >
> > where ^V^M is a control-V followed by a control-M (which makes
> > this nasty to put in a mapping or vimrc). This works because vim
> > knows that a "paragraph" is bounded by empty lines *or* BOF/EOF
On 9/19/20 9:27 AM, Tim Chase wrote:
The only gotcha with this is that a paragraph must have a blank
line before & after it. I've gotten stung doing this exact format
of command because the match was in the first/last paragraph of the
document. So you need to also ("\|") accept a match of
On 2020-09-19 12:02, Igor wrote:
> I specially like bellow solution, that I have tested
> and it works fine.
>
> :g/^XXX/.,/^$/s:aaa:bbb:g
>
> Just one question, why is there a "." character in command?
> If I understand it correctly, a "." character means the line where
> cursor is,
> and with
Hi,
thank you all for kind suggestions. I would like to use the simplest
solution,
that is easily typed from the head and well understood. I specially like
bellow
solution, that I have tested and it works fine.
:g/^XXX/.,/^$/s:aaa:bbb:g
Just one question, why is there a "." character in
On 2020-09-19 14:08, Sven Guckes wrote:
>> I need to replace string "aaa" with "bbb"
>> only in paragraphs that starts with "XXX".
>
> :g/^XXX/?^$?,/^$/s:aaa:bbb:g
The only gotcha with this is that a paragraph must have a blank line
before & after it. I've gotten stung doing this exact
-- Original Message --
From: "Salman Halim"
To: "Vim Users"
Sent: Saturday, 19 Sep, 2020 At 15:48
Subject: Re: How to replace string in specific paragraph only?
On Sat, Sep 19, 2020, 10:41 'c.willis...@btinternet.com
<mailto:c.willis...@btinte
On Sat, Sep 19, 2020, 10:41 'c.willis...@btinternet.com' via vim_use <
vim_use@googlegroups.com> wrote:
>
>
>
>
> -- Original Message --
> From: "Salman Halim"
> To: "vim_use"
> Sent: Saturday, 19 Sep, 2020 At 14:15
> Subject:
-- Original Message --
From: "Salman Halim"
To: "vim_use"
Sent: Saturday, 19 Sep, 2020 At 14:15
Subject: Re: How to replace string in specific paragraph only?
On Sat, Sep 19, 2020, 08:08 Sven Guckes <mailto:guc...@guckes.net> > wrote:
* Igor mailto
On Sat, Sep 19, 2020, 08:08 Sven Guckes wrote:
> * Igor [2020-09-19 12:55]:
> > I have the following sample text file: ...
> > *REPLACE RULE:*
> > I need to replace string "aaa" with "bbb"
> > only in paragraphs that starts with "XXX".
>
> :g/^XXX/?^$?,/^$/s:aaa:bbb:g
>
> i wish i could write
* Igor [2020-09-19 12:55]:
> I have the following sample text file: ...
> *REPLACE RULE:*
> I need to replace string "aaa" with "bbb"
> only in paragraphs that starts with "XXX".
:g/^XXX/?^$?,/^$/s:aaa:bbb:g
i wish i could write that with less characters. ;)
Sven
--
#Kielux2020
Hi,
I have come out with one of the possible solution:
" move to first line/character in buffer
gg
" find "XXX", visually select paragraph and replace "aaa" with bb", then
move to the next paragraph.
execute "normal! /XXX\v}:s/aaa/bbb/g\\}"
Above command works perfectly for first paragraph.
13 matches
Mail list logo