Tuesday, April 12, 2016

Regex failure in macro def. in Vim 7.4.580

I have a bunch of lines in a file that start:
---------

when (/users[^@]*\@.*domain\.com/) {
...
-------

I have tried defining a macro to replace the "when (/" with "m{".

It works interactively, but not in a macro (my magic level is
set to 'magic' -- i.e. default).

I.e. in interactive:
:s/when\s*(\/m{/

works.

But if I start on the line before (presumption), and define macro
like this:

qp (says "recording" down below)
/when<CR> (CR=where I press carriage return), then
'0' (just to make sure i am going to operate on the 1st
pattern in the line)
:s/when\s*(\/m{/ (and here is the fail -- says pattern not found)
---
Then I'd want to do more things to that line, go down 1 line and
make some changes there, then end macro.

At that point I'd be 1-2 lines (normally) above the next instance
of the pattern so I could press
@p

But since it fails in the sub. I never really get that far.

What am I doing wrong? (vim version 7.4.580).

Thanks for any cluesticks, etc... ;-)

-l




--
--
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.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment