Thursday, October 24, 2013

Re: Place a sign on each line between two regexps

On Wednesday, October 23, 2013 4:23:29 AM UTC+2, Ben Fritz wrote:
> Did you include a literal carriage return at the end, by typing CTRL-V and
> then CTRL-M or Enter to get Vim to display ^M?

That's was the problem, thanks.

> I'm seeing a weird pattern for the :g command again in your simplified
> example, I'm not going to test whether it works anyway.

No weird pattern here, it is the same as before:

:g/START/;/END/normal :exe 'echo '.line('.')^M
which you can also write as
:g#START#;/END/normal :exe 'echo '.line('.')^M

This executes the following command on all lines matching /START/. On those
lines, the command is 'further restricted' to the range
;/END/
which stands for 'all lines between the line containing the cursor and the
next match of /END/'

This kind of range (omitting the first component) is not explicitly
documented in the vim help, but it works just fine.


--
--
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/groups/opt_out.

No comments: