Does Vim 7 really have Visual Block mouse support? If so, how is it used? I don't see any documentation of this, and a little experimenting shows that <ctrl><left-mouse>, <alt><left-mouse>, and <shift><left-mouse> don't initiate block-selection.

+

Does Vim 7 really have Visual Block mouse support? If so, how is it used? I don't see any documentation of this, and a little experimenting shows that <ctrl><left-mouse>, <alt><left-mouse>, and <shift><left-mouse> don't initiate block-selection. --February 11, 2014

+

:The mouse can be used if options are set correctly. For example, after <code>:set mousemodel=extend</code>, you can left-click to set an initial position, then hold down Alt and right-click at another position to select a visual block ({{help|mouse-overview}}). Another method that is convenient for occasional use is to use <code>:set mousemodel=popup</code> then left-click to set an initial position, then hold down Shift and left-click at another position. That gives a character-wise selection. Then type Ctrl-V (or Ctrl-Q if Ctrl-V is mapped to paste) to change to block-wise. [[User:JohnBeckett|JohnBeckett]] ([[User talk:JohnBeckett|talk]]) 07:16, February 11, 2014 (UTC)

As much as it is against the Vim-way of doing things, it would be nice to have the mouse do the right thing when it is used once in a while. This tip refines tip Use Alt-Mouse to select blockwise for gvim.

Holding down Alt + dragging the left mouse button will activate the Visual Block, much like how MS Word works. Holding down Shift + dragging will switch it back to Visual mode, and vice versa. Insert-Visual[Block] mode is called if mouse highlight is activated from Insert mode. This tip also fixes some issues with the default Alt/Shift + clicking to make it work more seamlessly.

This tip also attempts to resolve an issue that was brought up in the Vim mailing list:

Console/terminal* Vims that are not compiled with the +xterm_clipboard option (see :version) have trouble pasting from external sources. They are not able to access the clipboard, and have to make use of the middleclick paste function. Unfortunately, if the mouse option was set as ':set mouse=a', the middleclick paste will not help. On the other hand, if the mouse option wasn't set, the middleclick paste would work fine, but instead, many of the console mouse functionalities such as positioning, wheel-scrolling and window sizing would not work.

This is fixed by only allowing middleclick paste to work in Insert mode. Extended mouse functionalities are sacrificed in Insert mode but will work in other modes like Normal and Visual modes.When a middleclick paste is issued in Normal mode, it switches to Insert mode to do the paste. If it is issued in Visual mode, it cuts the highlighted text, and switches to Insert mode to do the paste to simulate a "paste over selection".

The tip makes use of mark s, so make sure it's not already used. Also, I tested it with Vim 6.3 and above. What version of Vim are you using?

It's good that you found a mapping that works for you. I tailored the mappings above so that it tries to be as faithful to the current mode that you are in. For instance, performing <A-LeftMouse> when in Insert mode block highlights, visually, from the position of the cursor to the position of the leftclick, invoking Insert-Visual mode (not Visual-only mode).

I believe Vim 7 has native Visual Block mouse support.

Does Vim 7 really have Visual Block mouse support? If so, how is it used? I don't see any documentation of this, and a little experimenting shows that <ctrl><left-mouse>, <alt><left-mouse>, and <shift><left-mouse> don't initiate block-selection. --February 11, 2014

The mouse can be used if options are set correctly. For example, after :set mousemodel=extend, you can left-click to set an initial position, then hold down Alt and right-click at another position to select a visual block (:help mouse-overview). Another method that is convenient for occasional use is to use :set mousemodel=popup then left-click to set an initial position, then hold down Shift and left-click at another position. That gives a character-wise selection. Then type Ctrl-V (or Ctrl-Q if Ctrl-V is mapped to paste) to change to block-wise. JohnBeckett (talk) 07:16, February 11, 2014 (UTC)