Monday, July 12, 2021

Re: Seach and follow with keystrokes or a macro

* lgc <jdupont655@gmail.com> wrote:
> > Is there anyway to search and replace in a single colon command?
> Yes, use `:normal`, possibly in combination with `:global`. Record your
> key presses (` 9lv10l~0`) into the macro `q`. Then, execute:
>
> :%norm! @q
>
> To execute the macro on all the lines in the file.
>
> Or:
>
> :*norm! @q
>
> To execute the macro on all the lines which were in the last visual
> selection.
>
> Or:
>
> :g/^keyword:/norm! @q
>
> To execute the macro on all the line starting with the text `keyword:`.
Yes, thanks, I also found ...

:g[!]/pattern/exec 'norm[!]' "/pattern\<CR><cmd>"

It is very interesting.

--
Gua Chung Lim

Nothing ever exists entirely alone without dualities.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/YOw4nFunWAR8O0bn%40gmail.com.

No comments: