Nvim 的 :help 页面,从 生成 于 源代码,使用 tree-sitter-vimdoc 解析器。
nvim(不使用 --embed 或 --headless)时,它会启动内置的“终端 UI”(TUI)。此默认 UI 是可选的:你可以将 Nvim 作为“无头”服务器运行,或者你可以使用 GUI。nvim 时,这将启动内置的 UI 客户端,该客户端会启动一个 nvim --embed 服务器(子)进程,UI 客户端将连接到该进程。在连接到服务器后,UI 客户端会调用 nvim_set_client_info()(如所有 UI dev-ui 所建议的那样)并在其通道上设置这些字段client = {
attributes = {
license = 'Apache 2',
pid = …,
website = 'https://neovim.cn',
},
name = 'nvim-tui',
type = 'ui',
version = { … },
}Nvim 在启动时会猜测终端类型(除了 --embed 和 --headless 模式)。$TERM 环境变量是决定终端类型的主要提示。curl -LO https://invisible-island.net/datafiles/current/terminfo.src.gz gunzip terminfo.src.gz tic -x terminfo.src
For this terminal Set $TERM to |builtin-terms| ------------------------------------------------------------------------- anything libvte-based vte, vte-256color Y (e.g. GNOME Terminal) (aliases: gnome, gnome-256color) iTerm (original) iterm, iTerm.app N iTerm2 (new capabilities) iterm2, iTerm2.app Y Konsole konsole-256color N Linux virtual terminal linux, linux-256color Y PuTTY putty, putty-256color Y rxvt rxvt, rxvt-256color Y screen screen, screen-256color Y simple terminal (st) st, st-256color Y Terminal.app nsterm N 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
if $TERM =~ '^\(rxvt\|screen\|interix\|putty\)\(-.*\)\?$'
set notermguicolors
elseif $TERM =~ '^\(tmux\|iterm\|vte\|gnome\)\(-.*\)\?$'
set termguicolors
elseif $TERM =~ '^\(xterm\)\(-.*\)\?$'
if $XTERM_VERSION != ''
set termguicolors
elseif $KONSOLE_PROFILE_NAME != ''
set termguicolors
elseif $VTE_VERSION != ''
set termguicolors
else
set notermguicolors
endif
elseif $TERM =~ ...
... and so forth ...
endif
<C-I> 和 <Tab> 在表示方式上相同,<Esc> 和 <C-[> 也是如此,<CR> 和 <C-M> 也是如此,<NL> 和 <C-J> 也是如此。tmux send-keys 'Escape' [ 2 7 u 'C-W' j其中
'Escape' [ 2 7 u 是 <Esc> 键的明确的“CSI u”序列。<C-kEnter>CSI 57414 ; 5 u并且可以在映射中与
<C-CR> 区分开来使用。CSI ? u CSI c如果你的终端模拟器以以下方式响应
CSI ? <flags> u这意味着你的终端支持“CSI u”编码,Nvim 将通过写入序列来告诉你的终端启用它
CSI > 1 u如果你的终端不支持“CSI u”,那么 Nvim 将改为通过写入序列来启用“modifyOtherKeys”编码
CSI > 4 ; 2 m当 Nvim 正常退出时,它会发送相应的序列来禁用特殊键编码。如果 Nvim 未正常退出,则你的终端模拟器可能处于错误状态。如果发生这种情况,只需运行“reset”。
set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'或者(唉!)对于 Konsole 18.07.70 或更早版本,看起来更复杂,像这样set -ga terminal-overrides 'xterm*:\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%{1}%;%d\007'
hi NonText cterm=NONE ctermfg=NONE这会使用默认颜色和属性绘制空格,从而使第二遍绘制可以被优化掉。 注意: 虽然从理论上来说,空白处的颜色无关紧要,但在实际应用中,它们会改变跨越它们的游标和选区的颜色。这可能会对某些 UI 产生可见但微小的影响。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)
<LeftDrag> yes start or extend (1) no
<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
<S-RightMouse> yes no change yes "#" (2)
<C-RightMouse> no no change no "CTRL-T"
<RightDrag> yes extend no
<RightRelease> yes extend no插入或替换模式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"在帮助窗口中event position selection change action
cursor window
---------------------------------------------------------------------------
<2-LeftMouse> yes (cannot be active) no "^]" (jump to help tag)当 'mousemodel' 为 "popup" 时,这些操作会有所不同event position selection change action
cursor window
---------------------------------------------------------------------------
<S-LeftMouse> yes start or extend (1) no
<A-LeftMouse> yes start/extend blockw no
<RightMouse> no popup menu no插入或替换模式event position selection change action
cursor window
---------------------------------------------------------------------------
<S-LeftMouse> yes start or extend (1) no like CTRL-O (1)
<A-LeftMouse> yes start/extend blockw no
<RightMouse> no popup menu no(1) 仅当鼠标指针自按下后移动 (2) 仅当点击在同一缓冲区内click select --------------------------------- double word or % match triple line quadruple rectangular block例外:在帮助窗口中,双击将跳转到所点击单词的帮助信息。
:map <2-LeftMouse> :exe "tag " .. expand("<cword>")<CR>用双击拖动鼠标(按键按下、按键释放、按键按下,然后拖动)会导致选择整个单词。这将持续到释放按钮为止,此时选择将再次按字符进行。CTRL-O。当 'selectmode' 选项包含 "mouse" 时,将使用选择模式。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 - <X1Drag> X1 moved while pressed - <X1Release> X1 button release - <X2Mouse> X2 button pressed - <X2Drag> X2 moved while pressed - <X2Release> X2 button release -X1 和 X2 按钮是指某些鼠标上额外的按钮。'Microsoft Explorer' 鼠标在右边的拇指处提供这些按钮。目前,X1 和 X2 仅在 Win32 和 X11 环境中有效。
:noremap <MiddleMouse> <LeftMouse><MiddleMouse>将粘贴内容粘贴到鼠标中键点击的位置(否则,粘贴内容将粘贴到光标位置)。:noremap <LeftRelease> <LeftRelease>y在使用可视模式时,立即将选择内容复制。:map <X1Mouse> <C-O>
:map <X2Mouse> <C-I>将 X1 和 X2 按钮映射到跳转列表中的前进和后退,请参见 CTRL-O 和 CTRL-I。: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>