Monday, August 31, 2020

Re: Trying to apply macro to all files under a folder

On 2020-08-31 22:57, russurquhart1 via vim_use wrote:
> My next step would have been: :argdo :normal @b

I *think* you need to apply the :normal to the whole file unless the
macro itself does everything in one invocation.

If it only does one line and you need it to do the whole file, you
might try

:argdo :%normal @b

If it's a recursive macro, its fail-at-the-end condition might also
cause issues triggering the :argdo to stop.

:help :argdo

When an error is detected on one file, further files in the
argument list will not be visited.

If I had to point my finger at my first suspect as to why your
attempt isn't working the way you want, this is it.

> Then i would save my files:
> :argdo :write
> Should this work?

this should work as long as 'hidden' is set. It used to default to
off, but I think that recent changes in the defalts flipped this.
Regardless, you want to make sure you

:set hidden

first just to know that it's set. This lets you leave modified
buffers. Once you've made the changes, you can then do

:argdo write

or

:argdo update

to only write those files that have been modified.

-tim



--
--
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/20200831181432.16132c14%40bigbox.attlocal.net.

No comments: