Nvim の :help
ページ。 生成元は ソース で、 tree-sitter-vimdoc パーサーを使用しています。
nvim
を実行する際(--embed または --headless オプションなし)、組み込みの「ターミナルUI」(TUI)が起動します。このデフォルトのUIはオプションです。Nvim を「ヘッドレス」サーバーとして実行したり、GUI を使用したりできます。nvim
を実行すると、組み込みのUIクライアントが起動し、UIクライアントが接続するnvim --embed
サーバー(子プロセス)が開始されます。サーバーに接続した後、UIクライアントは(すべてのUI dev-ui で推奨されているように)nvim_set_client_info() を呼び出し、そのチャネルにこれらのフィールドを設定します。client = { attributes = { license = 'Apache 2', pid = …, website = 'https://neovim.dokyumento.jp', }, 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 mNvim がクリーンに終了すると、対応するシーケンスが送信され、特別なキーエンコーディングが無効になります。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
これにより、空白がデフォルトの色と属性で描画され、2回目の描画パスを最適化できます。注記:理論的には空白の色は重要ではありませんが、実際にはカーソルや選択範囲の色を変更します。これにより、一部の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>