Wednesday, September 2, 2020

Re: Applying macros to all files, macro stops processing files




-----Original Message-----
From: Tim Chase <vim@tim.thechases.com>
To: russurquhart1 via vim_use <vim_use@googlegroups.com>
Sent: Wed, Sep 2, 2020 7:18 pm
Subject: Re: Applying macros to all files, macro stops processing files



In theory, this should do it

  :set hidden
  :argdo 1/---/-2put='beta: true'

(this assumes that the first "---" doesn't fall on the first line;
otherwise make sure you have 'wrapscan' set too and use '$/---/'
instead)

Depending on whether you insert the text above or below the line 2
above the "---", you might need to change that to "-3" instead of
"-2".


IN the case of these files, the FIRST line IS a line of '---'. I was looking for the next line of '---'. Interestingly this:

 :argdo 1/---/-2put='beta: true'

seems to find the second one, and do exactly what I want. i'll try this!

Thanks again!!

Russ



If you like the results,

  :wall


--
--
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/232596974.2044401.1599094758651%40mail.yahoo.com.

No comments:

Post a Comment