Vim Tips Wiki

Easy block selection with mouse

Redirected from VimTip1132

1,623pages on
this wiki
Add New Page
Add New Page Talk0

Duplicate tip

This tip is very similar to the following:

These tips need to be merged – see the merge guidelines.

Tip 1132 Printable Monobook Previous Next

created 2006 · complexity basic · author Georg Dahn · version 6.0

In some editors it is possible to make a block selection by holding the Alt-key and the left mouse key. Since <M-LeftMouse> is not used in Vim, nor is <M-LeftDrag>, it is reasonable to enable this behavior in Vim, too. To do this, just add the following mappings to your vimrc file:

noremap <M-LeftMouse> <4-LeftMouse>
inoremap <M-LeftMouse> <4-LeftMouse>
onoremap <M-LeftMouse> <C-C><4-LeftMouse>
noremap <M-LeftDrag> <LeftDrag>
inoremap <M-LeftDrag> <LeftDrag>
onoremap <M-LeftDrag> <C-C><LeftDrag>


At least on gnome the alt+mouse-left key is used to move the application window around.

KDE too.

On X Servers in general that is alt+left mouse, but no one prevents you from using any mapping unused for you to do the same if you need it

Also on Fandom

Random Wiki