I am editing line number N in a text file open in vim. I would like to find all occurrences of either patter P or pattern Q if and only if they appear in line numbers in the inclusive range [N-K, N+K], with K being the value of a defined variable. Is such a thing possible at all? It would be the basic of a much needed script…
I am editing line number N in a text file open in vim .
Share
shows all the lines containing
PorQbetween 5 lines above the current line and 5 lines below.See
:help search()if you want to do that into a script.See
:help rangefor more info on ranges.