I have a problem: When I initiate Operator-Pending Mode with d or c and I click on the active window, the mouse click acts as a motion. For example, I can position my cursor at the start of a paragraph, press d, then click on a word at the end of the paragraph and Vim will delete from the cursor position to the end of the paragraph. I would like to disable this feature to prevent accidental mouse clicks.
I have added the following in my .vimrc, which tells Vim to enable the mouse only in Normal Mode and Visual Mode.
set mouse=nv
However, this does not work. I can enter Operator-Pending Mode and still use a mouse click as the motion. Is it possible to tell Vim not to accept mouse clicks for motions in Operator-Pending Mode?
:help 'mouse'won't help, here, so you can set it toaor any desired value.You could disable the left mouse in operator-pending mode, though:
which prevents mouse clicks motions in operator-pending mode. Note that, with that mapping, a mouse click is not considered as a motion anymore but it also sort of "breaks out" of operator-pending mode, which may or may not be a problem.