You need to see this as an action (<c-v>
) followed by a motion (? <CR>
) which is the basis of the Vim "grammar". For example ve
is an action (v
visually selection) followed by a motion (e
until the end of the word).
Here
<c-v>
starts a block selection from the cursor position to the next motion
?
starts a backward search
is your search pattern
<cr>
starts the search
Here the next match (i.e. the previous whitespace) is the "next motion" expected by <c-v>
So your command starts a block selection from the cursor to the previous whitespace.
You could get the equivalent behavior with <c-v>B
.
Edit To answer your example:
:h visual-block
tells us that
With CTRL-V (blockwise Visual mode) the highlighted text will be a rectangle between start position and the cursor.
Your start position is the first whitespace of the first line. After you use the backward search your cursor position is last whitespace of the last line. If you draw a rectangle between these two points, you should see why all of the whitespaces are selected.
Now in your example remove a whitespace on the last line:
abc
abc
abc
And use the same selection. You will notice that only the first two columns are selected because your start position didn't change but the cursor position changed since the previous whitespace isn't in the same place anymore.
About my <c-v>B
example it doesn't work in your case because the motion B
doesn't look for another line.
You will notice that if you use set nowrapscan
the backward search will not be allowed to go to the last line so you will not select the rectangle anymore. (:h 'wrapscan'
)