Set Macvim text selection to not include the character under the cursor

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

For example, if the cursor is in the far left corner and I press the down arrow, it selects the entire line plus the first character of the next line (since the cursor sits above the next character of the first line).

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

+7
vim macvim
source share
2 answers

Take a look at the selection parameter. By default it is set to inclusive , but you can change it to exclusive to make the text selection the way you want:

 :set selection=exclusive 

You can also set it exclusive with the behave :

 :behave mswin 

It also sets a few other parameters, which may or may not be what you want. See Vim specifics help.

 :help :behave :help 'selection' 
+9
source share

I assume that the shift-down arrow activates the visual feature mode and moves the cursor down the line. If you are trying to select whole lines, you better use the visual line mode, which is activated from normal mode by pressing V (shift-v). This will allow you to select the current row as a whole. You can then expand your selection by including lines at the top and bottom using the k (or up arrow) and j (or down arrow) keys.

When using Vim, I think it's better to go with the grain, rather than fight it. Do not expect it to work just like other text editors. Accept that the Vim way is different.

-one
source share

All Articles