Nvim :help
頁面,使用 tree-sitter-vimdoc 解析器從 原始碼 產生。
nvim
(沒有 --embed 或 --headless)時,它會啟動內建的「終端使用者介面」(TUI)。此預設介面是可選的:您可以將 Nvim 作為「無頭」伺服器執行,或者您可以使用 GUI。nvim
時,這會啟動內建的 UI 客戶端,該客戶端啟動一個 nvim --embed
伺服器(子)進程,UI 客戶端會連接到該進程。在連接到伺服器後,UI 客戶端會呼叫 nvim_set_client_info()(如 dev-ui 中針對所有 UI 建議的那樣),並在其通道上設定以下欄位client = { attributes = { license = 'Apache 2', pid = …, website = 'https://neovim.dev.org.tw', }, 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>