Question

Using macvim, when I copy a text selection, it always includes the character under the cursor.

For example, if the cursor is at the far left and I press shift-down arrow, it selects the entire line plus the first character of the next line (since the cursor is sitting over the next line's first character).

Is there a way to configure macvim to not include the cursor character in text selections?

Was it helpful?

Solution

Take a look at the selection option. By default it's set to inclusive, but you can change it to exclusive to make text selections act the way you want:

:set selection=exclusive

You can also set it to exclusive with the behave command:

:behave mswin

This also sets several other options, however, which may or may not be what you want. See the Vim help for the specifics.

:help :behave

:help 'selection'

OTHER TIPS

I am guessing that shift-down arrow activates visual character mode, and moves the cursor down a line. If you are trying to select entire lines, you would be better off using visual line mode, which is activated from normal mode by pressing V (shift-v). This will select the current line in its entirety. You can then extend your selection to include the lines above and below using the k (or up arrow) and j (or down arrow) keys.

When using Vim, I think it is better to go with the grain rather than to fight against it. Don't expect it to work the same way as other text editors. Accept that the Vim way is different.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top