0

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:

enter image description here

What's wrong with it?


temporary image (see comments):

enter image description here

  • 1
    Do set selection=exclusive and try again. Now after wv13w the cursor is still on the a, but when you yank the visual area, the a is not included. See help for selection and for visual-mode. I don't know why it is that way. – Ralf Feb 17 at 23:04
  • @Ralf Thanks, it works. However, a is not selected at all (I added temporary image). Also, does set selection=exclusive have any pitfalls? – john c. j. Feb 17 at 23:12
  • John, I don't know it exactly. Let's hope, that someone knows more and provides an answer. – Ralf Feb 18 at 5:37
  • it's because w 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 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.