I'm trying to understand the difference in character counting between Normal and Visual modes.
Roses are red,
Violets are blue,
Sugar is sweet,
And so are you.
The task is to copy everything from are
on the 1st line to so
on the last:
are red,
Violets are blue,
Sugar is sweet,
And so
In Normal mode it could be achieved with wy13w
. However, when I use the same command in Visual mode (wv13w
), the selection looks wrong:
What's wrong with it?
temporary image (see comments):
set selection=exclusive
and try again. Now afterwv13w
the cursor is still on thea
, but when you yank the visual area, thea
is not included. See help forselection
and forvisual-mode
. I don't know why it is that way. – Ralf Feb 17 '19 at 23:04a
is not selected at all (I added temporary image). Also, doesset selection=exclusive
have any pitfalls? – john c. j. Feb 17 '19 at 23:12w
by default is an exclusive motion, however when using a default selection, it will be changed to an inclusive motion. This can be controlled by the'selection'
option as mentioned – Christian Brabandt Feb 18 '19 at 10:02