Visual mode: >vim
set mouse=nv
<
To temporarily disable mouse support, hold the shift key while using
the mouse.
Mouse support can be enabled for different modes:
n Normal mode
v Visual mode
i Insert mode
c Command-line mode
h all previous modes when editing a help file
a all previous modes
r for |hit-enter| and |more-prompt| prompt
Left-click anywhere in a text buffer to place the cursor there. This
works with operators too, e.g. type |d| then left-click to delete text
from the current cursor position to the position where you clicked.
Drag the |status-line| or vertical separator of a window to resize it.
If enabled for "v" (Visual mode) then double-click selects word-wise,
triple-click makes it line-wise, and quadruple-click makes it
rectangular block-wise.
For scrolling with a mouse wheel see |scroll-mouse-wheel|.
Note: When enabling the mouse in a terminal, copy/paste will use the
"* register if possible. See also 'clipboard'.
Related options:
'mousefocus' window focus follows mouse pointer
'mousemodel' what mouse button does which action
'mousehide' hide mouse pointer while typing text
'selectmode' whether to start Select mode or Visual mode
*'mousefocus'* *'mousef'* *'nomousefocus'* *'nomousef'*
'mousefocus' 'mousef' boolean (default off)
global
The window that the mouse pointer is on is automatically activated.
When changing the window layout or window focus in another way, the
mouse pointer is moved to the window with keyboard focus. Off is the
default because it makes using the pull down menus a little goofy, as
a pointer transit may activate a window unintentionally.
*'mousehide'* *'mh'* *'nomousehide'* *'nomh'*
'mousehide' 'mh' boolean (default on)
global
only in the GUI
When on, the mouse pointer is hidden when characters are typed.
The mouse pointer is restored when the mouse is moved.
*'mousemodel'* *'mousem'*
'mousemodel' 'mousem' string (default "popup_setpos")
global
Sets the model to use for the mouse. The name mostly specifies what
the right mouse button is used for:
extend Right mouse button extends a selection. This works
like in an xterm.
popup Right mouse button pops up a menu. The shifted left
mouse button extends a selection. This works like
with Microsoft Windows.
popup_setpos Like "popup", but the cursor will be moved to the
position where the mouse was clicked, and thus the
selected operation will act upon the clicked object.
If clicking inside a selection, that selection will
be acted upon, i.e. no cursor move. This implies of
course, that right clicking outside a selection will
end Visual mode.
Overview of what button does what for each model:
mouse extend popup(_setpos) ~
left click place cursor place cursor
left drag start selection start selection
shift-left search word extend selection
right click extend selection popup menu (place cursor)
right drag extend selection -
middle click paste paste
In the "popup" model the right mouse button produces a pop-up menu.
Nvim creates a default |popup-menu| but you can redefine it.
Note that you can further refine the meaning of buttons with mappings.
See |mouse-overview|. But mappings are NOT used for modeless selection.
Example: >vim
map <S-LeftMouse> <RightMouse>
map <S-LeftDrag> <RightDrag>
map <S-LeftRelease> <RightRelease>
map <2-S-LeftMouse> <2-RightMouse>
map <2-S-LeftDrag> <2-RightDrag>
map <2-S-LeftRelease> <2-RightRelease>
map <3-S-LeftMouse> <3-RightMouse>
map <3-S-LeftDrag> <3-RightDrag>
map <3-S-LeftRelease> <3-RightRelease>
map <4-S-LeftMouse> <4-RightMouse>
map <4-S-LeftDrag> <4-RightDrag>
map <4-S-LeftRelease> <4-RightRelease>
<
Mouse commands requiring the CTRL modifier can be simulated by typing
the "g" key before using the mouse:
"g<LeftMouse>" is "<C-LeftMouse> (jump to tag