Tim Chase
unread,Feb 27, 2018, 1:34:42 PM2/27/18Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to v...@vim.org
I've got a rather large source file for an ETL process containing
several functions (one for each of the files it processes). There's
enough similarity between the file processing that it's easy to do a
search and end up in the wrong function without noticing.
Knowing vim supported matching/colorizing based on line-numbers, I
started out with
:match Error /\%<50l\|\%>120l/
to match anything outside the function I was focused on. But as I'd
edit, those boundaries would change. So I start grumbling, wishing
that vim supported similar functionality for marks instead of
absolute line numbers. BUT HO! It DOES!
So I dropped mark "a" at the beginning of my function, dropped mark
"b" at the end of my function, issued
:match Error /\%<'a\|\%>'b/
and lo, it updates automatically, highlighting the regions outside
the current function. And when I move to the next function, I drop
the "this is the beginning" and "this is the end" marks, and it
updates.
It continues to delight me that vim still holds new/undiscovered
tricks, even after using vim for ~18yrs now.
Anyways, thought I'd share in case it was useful for anybody else.
-tim