On Tue, Feb 27, 2018 at 10:34 AM, Tim Chase <[email protected]> wrote:

> 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.
>
>
Very true, vim always amazes me. The learning is always there which keeps
it ever interesting.

As for the above issue, "folds" are good too.

- goto just before start of function and: zfgg
- after end of function: zfG

To prevent search from opening folds:
  :set foldopen-=search

For running commands that skips closed folds
  :foldd {cmd}

Regards,
-Arun

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

Reply via email to