2017-03-21 09:08:19 -07:00
|
|
|
*term.txt* Nvim
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
|
2017-07-30 12:16:37 -07:00
|
|
|
NVIM REFERENCE MANUAL
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
|
2018-06-27 15:48:17 -07:00
|
|
|
Terminal UI *TUI* *tui*
|
2014-07-10 21:05:51 -07:00
|
|
|
|
2019-01-10 17:20:15 -07:00
|
|
|
Nvim uses a list of terminal capabilities to display its user interface
|
|
|
|
(except in |--embed| and |--headless| modes). If that information is wrong,
|
|
|
|
the screen may be messed up or keys may not be recognized.
|
2014-07-10 21:05:51 -07:00
|
|
|
|
2017-10-20 17:33:58 -07:00
|
|
|
Type |gO| to see the table of contents.
|
2017-05-01 08:09:29 -07:00
|
|
|
|
2014-07-10 21:05:51 -07:00
|
|
|
==============================================================================
|
2017-04-29 07:56:40 -07:00
|
|
|
Startup *startup-terminal*
|
2014-07-10 21:05:51 -07:00
|
|
|
|
2019-01-10 17:20:15 -07:00
|
|
|
Nvim guesses the terminal type when it starts (except in |--embed| and
|
|
|
|
|--headless| modes). The |$TERM| environment variable is the primary hint that
|
|
|
|
determines the terminal type.
|
2014-07-10 21:05:51 -07:00
|
|
|
|
2017-05-24 13:09:25 -07:00
|
|
|
*terminfo* *E557* *E558* *E559*
|
2017-07-30 12:16:37 -07:00
|
|
|
The terminfo database is used if available.
|
2017-05-24 13:09:25 -07:00
|
|
|
|
2017-05-30 12:50:22 -07:00
|
|
|
The Unibilium library (used by Nvim to read terminfo) allows you to override
|
2017-07-30 12:16:37 -07:00
|
|
|
the system terminfo with one in $HOME/.terminfo/ directory, in part or in
|
|
|
|
whole.
|
2017-05-30 12:50:22 -07:00
|
|
|
|
2017-07-30 12:16:37 -07:00
|
|
|
Building your own terminfo is usually as simple as running this as
|
|
|
|
a non-superuser:
|
2017-05-30 12:50:22 -07:00
|
|
|
>
|
2017-07-30 12:16:37 -07:00
|
|
|
curl -LO http://invisible-island.net/datafiles/current/terminfo.src.gz
|
2017-05-30 12:50:22 -07:00
|
|
|
gunzip terminfo.src.gz
|
|
|
|
tic terminfo.src
|
|
|
|
<
|
2017-07-30 12:16:37 -07:00
|
|
|
*$TERM*
|
|
|
|
The $TERM environment variable must match the terminal you are using!
|
|
|
|
Otherwise Nvim cannot know what sequences your terminal expects, and weird
|
|
|
|
or sub-optimal behavior will result (scrolling quirks, wrong colors, etc.).
|
2017-05-29 00:02:39 -07:00
|
|
|
|
2019-01-10 17:20:15 -07:00
|
|
|
$TERM is also important because it is forwarded by SSH to the remote session,
|
2018-01-01 11:38:18 -07:00
|
|
|
unlike most other environment variables.
|
2017-06-07 06:21:53 -07:00
|
|
|
|
2017-08-24 03:48:32 -07:00
|
|
|
For this terminal Set $TERM to |builtin-terms|
|
|
|
|
-------------------------------------------------------------------------
|
2019-01-10 17:20:15 -07:00
|
|
|
anything libvte-based vte, vte-256color Y
|
|
|
|
(e.g. GNOME Terminal) (aliases: gnome, gnome-256color)
|
2017-08-24 03:48:32 -07:00
|
|
|
iTerm (original) iterm, iTerm.app N
|
|
|
|
iTerm2 (new capabilities) iterm2, iTerm2.app Y
|
2018-01-01 11:38:18 -07:00
|
|
|
Konsole konsole-256color N
|
2019-01-10 17:20:15 -07:00
|
|
|
Linux virtual terminal linux, linux-256color Y
|
2017-08-24 03:48:32 -07:00
|
|
|
PuTTY putty, putty-256color Y
|
2019-01-10 17:20:15 -07:00
|
|
|
rxvt rxvt, rxvt-256color Y
|
|
|
|
screen screen, screen-256color Y
|
|
|
|
simple terminal (st) st, st-256color Y
|
2017-08-24 03:48:32 -07:00
|
|
|
Terminal.app nsterm N
|
2019-01-10 17:20:15 -07:00
|
|
|
tmux tmux, tmux-256color Y
|
|
|
|
Windows/ConEmu conemu Y
|
|
|
|
Windows/Cygwin-built Nvim cygwin Y
|
|
|
|
Windows/Interix interix Y
|
|
|
|
Windows/VTP console vtpcon Y
|
|
|
|
Windows/legacy console win32con Y
|
|
|
|
xterm or compatible xterm, xterm-256color Y
|
2017-06-07 06:21:53 -07:00
|
|
|
|
2017-05-24 13:09:25 -07:00
|
|
|
*builtin-terms* *builtin_terms*
|
2019-01-10 17:20:15 -07:00
|
|
|
If a |terminfo| database is not available or there is no entry for the current
|
|
|
|
terminal, Nvim will map |$TERM| to a builtin entry according to the above
|
|
|
|
table, or "ansi" if there is no match. For example "TERM=putty-256color" will
|
|
|
|
be mapped to the builtin "putty" entry. See also |tui-colors|.
|
|
|
|
|
|
|
|
The builtin terminfo is not combined with any external terminfo database, nor
|
|
|
|
can it be used in preference to one. You can thus entirely override any
|
|
|
|
omissions or out-of-date information in the builtin terminfo database by
|
2017-05-29 08:14:09 -07:00
|
|
|
supplying an external one with entries for the terminal type.
|
2017-05-29 00:02:39 -07:00
|
|
|
|
2014-07-10 21:05:51 -07:00
|
|
|
Settings depending on terminal *term-dependent-settings*
|
|
|
|
|
2017-07-30 12:16:37 -07:00
|
|
|
If you want to set terminal-dependent options or mappings, you can do this in
|
|
|
|
your init.vim. Example: >
|
2017-05-29 16:25:58 -07:00
|
|
|
|
2017-06-16 07:57:19 -07:00
|
|
|
if $TERM =~ '^\(rxvt\|screen\|interix\|putty\)\(-.*\)\?$'
|
2017-05-29 16:25:58 -07:00
|
|
|
set notermguicolors
|
2017-06-16 07:57:19 -07:00
|
|
|
elseif $TERM =~ '^\(tmux\|iterm\|vte\|gnome\)\(-.*\)\?$'
|
2017-05-29 16:25:58 -07:00
|
|
|
set termguicolors
|
2017-06-16 07:57:19 -07:00
|
|
|
elseif $TERM =~ '^\(xterm\)\(-.*\)\?$'
|
|
|
|
if $XTERM_VERSION != ''
|
|
|
|
set termguicolors
|
|
|
|
elseif $KONSOLE_PROFILE_NAME != ''
|
|
|
|
set termguicolors
|
|
|
|
elseif $VTE_VERSION != ''
|
|
|
|
set termguicolors
|
|
|
|
else
|
|
|
|
set notermguicolors
|
|
|
|
endif
|
2017-05-29 16:25:58 -07:00
|
|
|
elseif $TERM =~ ...
|
2017-06-16 07:57:19 -07:00
|
|
|
... and so forth ...
|
2017-05-29 16:25:58 -07:00
|
|
|
endif
|
2014-07-10 21:05:51 -07:00
|
|
|
<
|
2017-05-24 13:09:25 -07:00
|
|
|
*scroll-region* *xterm-scroll-region*
|
|
|
|
Where possible, Nvim will use the terminal's ability to set a scroll region in
|
|
|
|
order to redraw faster when a window is scrolled. If the terminal's terminfo
|
|
|
|
description describes an ability to set top and bottom scroll margins, that is
|
|
|
|
used.
|
|
|
|
|
|
|
|
This will not speed up scrolling in a window that is not the full width of the
|
|
|
|
terminal. Xterm has an extra ability, not described by terminfo, to set left
|
|
|
|
and right scroll margins as well. If Nvim detects that the terminal is Xterm,
|
|
|
|
it will make use of this ability to speed up scrolling that is not the full
|
|
|
|
width of the terminal.
|
|
|
|
|
2017-07-30 17:50:34 -07:00
|
|
|
*tui-colors*
|
2017-07-30 12:16:37 -07:00
|
|
|
Nvim uses 256 colours by default, ignoring |terminfo| for most terminal types,
|
|
|
|
including "linux" (whose virtual terminals have had 256-colour support since
|
|
|
|
4.8) and anything claiming to be "xterm". Also when $COLORTERM or $TERM
|
|
|
|
contain the string "256".
|
2017-05-24 13:09:25 -07:00
|
|
|
|
2017-07-30 12:16:37 -07:00
|
|
|
Nvim similarly assumes that any terminal emulator that sets $COLORTERM to any
|
|
|
|
value, is capable of at least 16-colour operation.
|
2017-05-24 13:09:25 -07:00
|
|
|
|
|
|
|
*true-color* *xterm-true-color*
|
2017-07-30 12:16:37 -07:00
|
|
|
Nvim emits true (24-bit) colours in the terminal, if 'termguicolors' is set.
|
|
|
|
|
|
|
|
It uses the "setrgbf" and "setrgbb" |terminfo| extensions (proposed by Rüdiger
|
|
|
|
Sonderfeld in 2013). If your terminfo definition is missing them, then Nvim
|
|
|
|
will decide whether to add them to your terminfo definition, using the ISO
|
|
|
|
8613-6:1994/ITU T.416:1993 control sequences for setting RGB colours (but
|
|
|
|
modified to use semicolons instead of colons unless the terminal is known to
|
|
|
|
follow the standard).
|
|
|
|
|
|
|
|
Another convention, pioneered in 2016 by tmux, is the "Tc" terminfo extension.
|
|
|
|
If terminfo has this flag, Nvim will add constructed "setrgbf" and "setrgbb"
|
|
|
|
capabilities as if they had been in the terminfo definition.
|
|
|
|
|
|
|
|
If terminfo does not (yet) have this flag, Nvim will fall back to $TERM and
|
|
|
|
other environment variables. It will add constructed "setrgbf" and "setrgbb"
|
2022-01-04 11:07:40 -07:00
|
|
|
capabilities in the case of the "rxvt", "linux", "st", "tmux", and "iterm"
|
2017-07-30 12:16:37 -07:00
|
|
|
terminal types, or when Konsole, genuine Xterm, a libvte terminal emulator
|
|
|
|
version 0.36 or later, or a terminal emulator that sets the COLORTERM
|
|
|
|
environment variable to "truecolor" is detected.
|
2017-05-24 13:09:25 -07:00
|
|
|
|
|
|
|
*xterm-resize*
|
|
|
|
Nvim can resize the terminal display on some terminals that implement an
|
2017-07-30 12:16:37 -07:00
|
|
|
extension pioneered by dtterm. |terminfo| does not have a flag for this
|
|
|
|
extension. So Nvim simply assumes that (all) "dtterm", "xterm", "teraterm",
|
|
|
|
"rxvt" terminal types, and Konsole, are capable of this.
|
2017-05-24 13:09:25 -07:00
|
|
|
|
2019-01-10 17:20:15 -07:00
|
|
|
*tui-cursor-shape*
|
2017-05-24 13:09:25 -07:00
|
|
|
Nvim will adjust the shape of the cursor from a block to a line when in insert
|
2017-05-25 11:12:52 -07:00
|
|
|
mode (or as specified by the 'guicursor' option), on terminals that support
|
|
|
|
it. It uses the same |terminfo| extensions that were pioneered by tmux for
|
2017-07-30 12:16:37 -07:00
|
|
|
this: "Ss" and "Se".
|
2019-12-19 13:27:21 -07:00
|
|
|
Similarly, if you set the cursor highlight group with blend=100, Nvim hides
|
|
|
|
the cursor through the "cvvis" and "civis" extensions.
|
2017-05-25 11:12:52 -07:00
|
|
|
|
2017-06-07 06:21:53 -07:00
|
|
|
If your terminfo definition is missing them, then Nvim will decide whether to
|
2017-07-30 12:16:37 -07:00
|
|
|
add them to your terminfo definition, by looking at $TERM and other
|
2017-06-07 06:21:53 -07:00
|
|
|
environment variables. For the "rxvt", "putty", "linux", "screen",
|
|
|
|
"teraterm", and "iterm" terminal types, or when Konsole, a libvte-based
|
|
|
|
terminal emulator, or genuine Xterm are detected, it will add constructed
|
|
|
|
"Ss" and "Se" capabilities.
|
|
|
|
|
2019-01-10 17:20:15 -07:00
|
|
|
*tui-cursor-tmux*
|
|
|
|
Within tmux it may appear that Nvim is not changing the cursor, but in fact it
|
|
|
|
is tmux receiving instructions from Nvim to change the cursor and not knowing
|
|
|
|
what to do in turn. tmux must translate what it receives from Nvim into
|
|
|
|
whatever control sequence is appropriate for the host terminal. It shares
|
|
|
|
a common mechanism with Nvim, of using the "Ss" and "Se" capabilities from
|
|
|
|
terminfo (for the output terminal) if they are present. Unlike Nvim, if they
|
|
|
|
are not in terminfo you must add them by setting "terminal-overrides" in
|
|
|
|
~/.tmux.conf .
|
2017-06-07 06:21:53 -07:00
|
|
|
|
|
|
|
See the tmux(1) manual page for the details of how and what to do in the tmux
|
2017-05-25 11:12:52 -07:00
|
|
|
configuration file. It will look something like: >
|
2017-07-30 12:16:37 -07:00
|
|
|
set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
|
2019-01-10 17:20:15 -07:00
|
|
|
<or (alas!) for Konsole 18.07.70 or older, something more complex like: >
|
2017-07-30 12:16:37 -07:00
|
|
|
set -ga terminal-overrides 'xterm*:\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%{1}%;%d\007'
|
|
|
|
<
|
2014-07-10 21:05:51 -07:00
|
|
|
==============================================================================
|
2017-04-29 07:56:40 -07:00
|
|
|
Window size *window-size*
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
[This is about the size of the whole window Vim is using, not a window that is
|
|
|
|
created with the ":split" command.]
|
|
|
|
|
2014-12-09 22:07:19 -07:00
|
|
|
On Unix systems, three methods are tried to get the window size:
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
- an ioctl call (TIOCGSIZE or TIOCGWINSZ, depends on your system)
|
|
|
|
- the environment variables "LINES" and "COLUMNS"
|
2017-05-25 12:43:48 -07:00
|
|
|
- from the |terminfo| entries "lines" and "columns"
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
If everything fails a default size of 24 lines and 80 columns is assumed. If
|
|
|
|
a window-resize signal is received the size will be set again. If the window
|
|
|
|
size is wrong you can use the 'lines' and 'columns' options to set the
|
2017-03-14 16:12:21 -07:00
|
|
|
correct values. See |:mode|.
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
==============================================================================
|
2017-04-29 07:56:40 -07:00
|
|
|
Slow and fast terminals *slow-fast-terminal*
|
2014-07-10 21:05:51 -07:00
|
|
|
*slow-terminal*
|
|
|
|
|
2017-05-25 12:43:48 -07:00
|
|
|
If you have a slow terminal you may want to reset the 'showcmd' and 'ruler'
|
2017-05-25 16:18:24 -07:00
|
|
|
options. The command characters and cursor positions will not be shown in the
|
2017-05-25 12:43:48 -07:00
|
|
|
status line (which involves a lot of cursor motions and attribute changes for
|
|
|
|
every keypress or movement). If the terminal scrolls very slowly, set the
|
|
|
|
'scrolljump' to 5 or so. If the cursor is moved off the screen (e.g., with
|
|
|
|
"j") Vim will scroll 5 lines at a time. Another possibility is to reduce the
|
|
|
|
number of lines that Vim uses with the command "z{height}<CR>".
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
If the characters from the terminal are arriving with more than 1 second
|
|
|
|
between them you might want to set the 'timeout' and/or 'ttimeout' option.
|
|
|
|
See the "Options" chapter |options|.
|
|
|
|
|
2017-05-25 12:43:48 -07:00
|
|
|
If you are using a color terminal that is slow when displaying lines beyond
|
|
|
|
the end of a buffer, this is because Nvim is drawing the whitespace twice, in
|
|
|
|
two sets of colours and attributes. To prevent this, use this command: >
|
2014-07-10 21:05:51 -07:00
|
|
|
hi NonText cterm=NONE ctermfg=NONE
|
2017-05-25 12:43:48 -07:00
|
|
|
This draws the spaces with the default colours and attributes, which allows the
|
|
|
|
second pass of drawing to be optimized away. Note: Although in theory the
|
|
|
|
colours of whitespace are immaterial, in practice they change the colours of
|
|
|
|
cursors and selections that cross them. This may have a visible, but minor,
|
|
|
|
effect on some UIs.
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
==============================================================================
|
2017-04-29 07:56:40 -07:00
|
|
|
Using the mouse *mouse-using*
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
*mouse-mode-table* *mouse-overview*
|
2018-09-21 05:59:02 -07:00
|
|
|
Overview of what the mouse buttons do, when 'mousemodel' is "extend":
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
Normal Mode:
|
|
|
|
event position selection change action ~
|
|
|
|
cursor window ~
|
|
|
|
<LeftMouse> yes end yes
|
|
|
|
<C-LeftMouse> yes end yes "CTRL-]" (2)
|
|
|
|
<S-LeftMouse> yes no change yes "*" (2) *<S-LeftMouse>*
|
|
|
|
<LeftDrag> yes start or extend (1) no *<LeftDrag>*
|
|
|
|
<LeftRelease> yes start or extend (1) no
|
|
|
|
<MiddleMouse> yes if not active no put
|
|
|
|
<MiddleMouse> yes if active no yank and put
|
|
|
|
<RightMouse> yes start or extend yes
|
|
|
|
<A-RightMouse> yes start or extend blockw. yes *<A-RightMouse>*
|
|
|
|
<S-RightMouse> yes no change yes "#" (2) *<S-RightMouse>*
|
|
|
|
<C-RightMouse> no no change no "CTRL-T"
|
|
|
|
<RightDrag> yes extend no *<RightDrag>*
|
|
|
|
<RightRelease> yes extend no *<RightRelease>*
|
|
|
|
|
|
|
|
Insert or Replace Mode:
|
|
|
|
event position selection change action ~
|
|
|
|
cursor window ~
|
|
|
|
<LeftMouse> yes (cannot be active) yes
|
|
|
|
<C-LeftMouse> yes (cannot be active) yes "CTRL-O^]" (2)
|
|
|
|
<S-LeftMouse> yes (cannot be active) yes "CTRL-O*" (2)
|
|
|
|
<LeftDrag> yes start or extend (1) no like CTRL-O (1)
|
|
|
|
<LeftRelease> yes start or extend (1) no like CTRL-O (1)
|
|
|
|
<MiddleMouse> no (cannot be active) no put register
|
|
|
|
<RightMouse> yes start or extend yes like CTRL-O
|
|
|
|
<A-RightMouse> yes start or extend blockw. yes
|
|
|
|
<S-RightMouse> yes (cannot be active) yes "CTRL-O#" (2)
|
|
|
|
<C-RightMouse> no (cannot be active) no "CTRL-O CTRL-T"
|
|
|
|
|
|
|
|
In a help window:
|
|
|
|
event position selection change action ~
|
|
|
|
cursor window ~
|
|
|
|
<2-LeftMouse> yes (cannot be active) no "^]" (jump to help tag)
|
|
|
|
|
|
|
|
When 'mousemodel' is "popup", these are different:
|
|
|
|
|
|
|
|
Normal Mode:
|
|
|
|
event position selection change action ~
|
|
|
|
cursor window ~
|
|
|
|
<S-LeftMouse> yes start or extend (1) no
|
|
|
|
<A-LeftMouse> yes start or extend blockw. no *<A-LeftMouse>*
|
|
|
|
<RightMouse> no popup menu no
|
|
|
|
|
|
|
|
Insert or Replace Mode:
|
|
|
|
event position selection change action ~
|
|
|
|
cursor window ~
|
|
|
|
<S-LeftMouse> yes start or extend (1) no like CTRL-O (1)
|
|
|
|
<A-LeftMouse> yes start or extend blockw. no
|
|
|
|
<RightMouse> no popup menu no
|
|
|
|
|
|
|
|
(1) only if mouse pointer moved since press
|
|
|
|
(2) only if click is in same buffer
|
|
|
|
|
|
|
|
Clicking the left mouse button causes the cursor to be positioned. If the
|
|
|
|
click is in another window that window is made the active window. When
|
|
|
|
editing the command-line the cursor can only be positioned on the
|
|
|
|
command-line. When in Insert mode Vim remains in Insert mode. If 'scrolloff'
|
|
|
|
is set, and the cursor is positioned within 'scrolloff' lines from the window
|
|
|
|
border, the text is scrolled.
|
|
|
|
|
|
|
|
A selection can be started by pressing the left mouse button on the first
|
|
|
|
character, moving the mouse to the last character, then releasing the mouse
|
|
|
|
button. You will not always see the selection until you release the button,
|
2021-04-24 20:14:11 -07:00
|
|
|
only in some versions (GUI, Win32) will the dragging be shown immediately.
|
2016-01-06 16:45:50 -07:00
|
|
|
Note that you can make the text scroll by moving the mouse at least one
|
|
|
|
character in the first/last line in the window when 'scrolloff' is non-zero.
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
In Normal, Visual and Select mode clicking the right mouse button causes the
|
|
|
|
Visual area to be extended. When 'mousemodel' is "popup", the left button has
|
|
|
|
to be used while keeping the shift key pressed. When clicking in a window
|
|
|
|
which is editing another buffer, the Visual or Select mode is stopped.
|
|
|
|
|
|
|
|
In Normal, Visual and Select mode clicking the right mouse button with the alt
|
|
|
|
key pressed causes the Visual area to become blockwise. When 'mousemodel' is
|
|
|
|
"popup" the left button has to be used with the alt key. Note that this won't
|
|
|
|
work on systems where the window manager consumes the mouse events when the
|
|
|
|
alt key is pressed (it may move the window).
|
|
|
|
|
|
|
|
*double-click*
|
2016-01-06 16:45:50 -07:00
|
|
|
Double, triple and quadruple clicks are supported when the GUI is active, for
|
2021-04-24 20:14:11 -07:00
|
|
|
Win32 and for an xterm. For selecting text, extra clicks extend the
|
2016-01-15 13:34:04 -07:00
|
|
|
selection:
|
2014-07-10 21:05:51 -07:00
|
|
|
click select ~
|
|
|
|
double word or % match *<2-LeftMouse>*
|
|
|
|
triple line *<3-LeftMouse>*
|
|
|
|
quadruple rectangular block *<4-LeftMouse>*
|
|
|
|
Exception: In a Help window a double click jumps to help for the word that is
|
|
|
|
clicked on.
|
|
|
|
A double click on a word selects that word. 'iskeyword' is used to specify
|
|
|
|
which characters are included in a word. A double click on a character
|
|
|
|
that has a match selects until that match (like using "v%"). If the match is
|
|
|
|
an #if/#else/#endif block, the selection becomes linewise.
|
2021-04-25 08:56:17 -07:00
|
|
|
For MS-Windows and xterm the time for double clicking can be set with the
|
|
|
|
'mousetime' option. For the other systems this time is defined outside of Vim.
|
2014-07-10 21:05:51 -07:00
|
|
|
An example, for using a double click to jump to the tag under the cursor: >
|
2022-02-27 03:56:30 -07:00
|
|
|
:map <2-LeftMouse> :exe "tag " .. expand("<cword>")<CR>
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
Dragging the mouse with a double click (button-down, button-up, button-down
|
|
|
|
and then drag) will result in whole words to be selected. This continues
|
|
|
|
until the button is released, at which point the selection is per character
|
|
|
|
again.
|
|
|
|
|
|
|
|
In Insert mode, when a selection is started, Vim goes into Normal mode
|
|
|
|
temporarily. When Visual or Select mode ends, it returns to Insert mode.
|
|
|
|
This is like using CTRL-O in Insert mode. Select mode is used when the
|
|
|
|
'selectmode' option contains "mouse".
|
|
|
|
|
|
|
|
*<MiddleRelease>* *<MiddleDrag>*
|
|
|
|
Mouse clicks can be mapped. The codes for mouse clicks are:
|
|
|
|
code mouse button normal action ~
|
|
|
|
<LeftMouse> left pressed set cursor position
|
|
|
|
<LeftDrag> left moved while pressed extend selection
|
|
|
|
<LeftRelease> left released set selection end
|
|
|
|
<MiddleMouse> middle pressed paste text at cursor position
|
|
|
|
<MiddleDrag> middle moved while pressed -
|
|
|
|
<MiddleRelease> middle released -
|
|
|
|
<RightMouse> right pressed extend selection
|
|
|
|
<RightDrag> right moved while pressed extend selection
|
|
|
|
<RightRelease> right released set selection end
|
|
|
|
<X1Mouse> X1 button pressed - *X1Mouse*
|
|
|
|
<X1Drag> X1 moved while pressed - *X1Drag*
|
|
|
|
<X1Release> X1 button release - *X1Release*
|
|
|
|
<X2Mouse> X2 button pressed - *X2Mouse*
|
|
|
|
<X2Drag> X2 moved while pressed - *X2Drag*
|
|
|
|
<X2Release> X2 button release - *X2Release*
|
|
|
|
|
|
|
|
The X1 and X2 buttons refer to the extra buttons found on some mice. The
|
|
|
|
'Microsoft Explorer' mouse has these buttons available to the right thumb.
|
2016-05-03 12:10:30 -07:00
|
|
|
Currently X1 and X2 only work on Win32 and X11 environments.
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
Examples: >
|
|
|
|
:noremap <MiddleMouse> <LeftMouse><MiddleMouse>
|
|
|
|
Paste at the position of the middle mouse button click (otherwise the paste
|
|
|
|
would be done at the cursor position). >
|
|
|
|
|
|
|
|
:noremap <LeftRelease> <LeftRelease>y
|
|
|
|
Immediately yank the selection, when using Visual mode.
|
|
|
|
|
|
|
|
Note the use of ":noremap" instead of "map" to avoid a recursive mapping.
|
|
|
|
>
|
|
|
|
:map <X1Mouse> <C-O>
|
|
|
|
:map <X2Mouse> <C-I>
|
|
|
|
Map the X1 and X2 buttons to go forwards and backwards in the jump list, see
|
|
|
|
|CTRL-O| and |CTRL-I|.
|
|
|
|
|
|
|
|
*mouse-swap-buttons*
|
|
|
|
To swap the meaning of the left and right mouse buttons: >
|
|
|
|
:noremap <LeftMouse> <RightMouse>
|
|
|
|
:noremap <LeftDrag> <RightDrag>
|
|
|
|
:noremap <LeftRelease> <RightRelease>
|
|
|
|
:noremap <RightMouse> <LeftMouse>
|
|
|
|
:noremap <RightDrag> <LeftDrag>
|
|
|
|
:noremap <RightRelease> <LeftRelease>
|
|
|
|
:noremap g<LeftMouse> <C-RightMouse>
|
|
|
|
:noremap g<RightMouse> <C-LeftMouse>
|
|
|
|
:noremap! <LeftMouse> <RightMouse>
|
|
|
|
:noremap! <LeftDrag> <RightDrag>
|
|
|
|
:noremap! <LeftRelease> <RightRelease>
|
|
|
|
:noremap! <RightMouse> <LeftMouse>
|
|
|
|
:noremap! <RightDrag> <LeftDrag>
|
|
|
|
:noremap! <RightRelease> <LeftRelease>
|
|
|
|
<
|
|
|
|
vim:tw=78:ts=8:ft=help:norl:
|