This is mainly for working on multiple files in vifm (log1.txt
, log2.txt
, etc.) so lines can be assumed to be sorted, though this should work in normal vim/nvim.
Let's say we have this:
test 1
test 2
test 3
test 4
test 5
testing 1
testing 2
testing 3
another
I'm on the line with test 3
(normal mode) and want to select everything from test 1
to test 5
. I can choose to select every consecutive line (up & down) with the same starting substring test
(with a space).
May be I'm on test 3
and want to select every consecutive line with the starting substring test
(without a space), which is test 1
till testing 3
but not another
.
In such cases, I want to visually select all consecutive lines with the same <count>
characters. I can set this to 3,5,10,etc. I know the lines I want to select typically work with 5 starting characters so I can set that as a constant. However, I don't know beforehand what those 5 characters would be.
How can I make a macro/binding to do such selection?