Disable mouse clicks in gvim on ubuntu

11

1

How do I make gvim ignore mouse clicks. I'm really sick of the trackpad making my cursor all over the place. I use xubuntu if that means anything.

Galadude

Posted 2011-12-09T10:15:20.420

Reputation: 293

Answers

11

I use:

:set mouse=c

This sets it to command-line mode. You can read about all of the options by typing,

:help mouse

To avoid needing to type the command each time, you can put it in your ~/.vimrc

Matthew

Posted 2011-12-09T10:15:20.420

Reputation: 966

3

As akira said, you can disable the mouse entirely, but you can also selectively disable mouse buttons by mapping them to <nop>. For example, if it is just a problem in insert mode, and just the left mouse button:

:imap <LeftMouse> <nop>

You can even do it for double clicks:

:imap <2-LeftMouse> <nop>

See:

:help gui-mouse-mapping
:help map-overview

Heptite

Posted 2011-12-09T10:15:20.420

Reputation: 16 267

1

akira

Posted 2011-12-09T10:15:20.420

Reputation: 52 754

1

I had same problem and though one can disable mouse/touchpad entirely there is a better solution: to disable touchpad while typing.

For Ubuntu there is a how-to.

Martian

Posted 2011-12-09T10:15:20.420

Reputation: 749

0

I am using set so=1 in my .gvimrc or .vimrc under the gui section. The other ones are for Ctrl+C and Ctrl+V pasting, which is totally convenient in the gui.

if has('gui_running')
        vmap <C-c> "+yi
        vmap <C-x> "+c
        vmap <C-v> c<ESC>"+p
        imap <C-v> <C-r><C-o>+
        set so=1
endif

cbaxley

Posted 2011-12-09T10:15:20.420

Reputation: 1