Timur Fayzrakhmanov
Timur Fayzrakhmanov

Reputation: 19577

How to assign visual block selection to mouse's middle button in vim?

I want to assign visual block selection to middle button of mouse. Hence, holding middle button means visual block selection is activated, release - stop to select and leave the selection for further actions. Is it possible?

I find no information about assigning middle button in :help and it seems there are only several predefined scenarios how we can use the mouse.

Upvotes: 1

Views: 374

Answers (1)

ryuichiro
ryuichiro

Reputation: 3865

To get into the visual block mode, you need to make a quadruple click. So you can assign it to the middle button. Then you need to assign a drag to make an area.

noremap <MiddleMouse> <4-LeftMouse>
noremap <MiddleDrag> <LeftDrag>

should be sufficient. If you need to get in the select block mode after releasing the middle button, you can add

noremap <MiddleRelease> <C-g>

See :help mouse-using.

Upvotes: 2

Related Questions