Skip to content

Commit 0235b26

Browse files
authored
Merge pull request #2386 from h-east/update-terminal
Update terminal.{txt,jax}
2 parents 0b02faf + 6bffe44 commit 0235b26

File tree

3 files changed

+290
-85
lines changed

3 files changed

+290
-85
lines changed

dict.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ Vim9 script:
299299
- オペレーター
300300
- 演算コマンド
301301

302+
フィルタ:
303+
- フィルター
304+
302305
フォントセット:
303306
- フォント・セット
304307

doc/terminal.jax

Lines changed: 137 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*terminal.txt* For Vim バージョン 9.1. Last change: 2025 Sep 15
1+
*terminal.txt* For Vim バージョン 9.1. Last change: 2025 Oct 14
22

33

44
VIMリファレンスマニュアル by Bram Moolenaar
@@ -13,39 +13,40 @@
1313
結果が "1" の場合、対応している。
1414

1515

16-
1. 基本的な使い方 |terminal-use|
17-
キー入力 |terminal-typing|
18-
サイズと色 |terminal-size-color|
19-
文法 |:terminal|
20-
サイズ変更 |terminal-resizing|
21-
端末モード |Terminal-mode|
22-
カーソルスタイル |terminal-cursor-style|
23-
セッション |terminal-session|
24-
特別なキー |terminal-special-keys|
25-
Unix |terminal-unix|
26-
MS-Windows |terminal-ms-windows|
16+
1. 基本的な使い方 |terminal-use|
17+
キー入力 |terminal-typing|
18+
サイズと色 |terminal-size-color|
19+
文法 |:terminal|
20+
サイズ変更 |terminal-resizing|
21+
端末モード |Terminal-mode|
22+
カーソルスタイル |terminal-cursor-style|
23+
セッション |terminal-session|
24+
特別なキー |terminal-special-keys|
25+
Unix |terminal-unix|
26+
MS-Windows |terminal-ms-windows|
2727
2. 端末関数 |terminal-function-details|
2828
3. 端末通信 |terminal-communication|
29-
Vim からジョブへ: term_sendkeys() |terminal-to-job|
30-
ジョブから Vim へ: JSON API |terminal-api|
31-
クライアントサーバー機能を使う |terminal-client-server|
32-
4. リモートテスト |terminal-testing|
33-
5. 画面ダンプの差分 |terminal-diff|
34-
Vimの画面ダンプテストを書く |terminal-dumptest|
35-
画面ダンプを作成する |terminal-screendump|
36-
画面ダンプを比較する |terminal-diffscreendump|
37-
6. デバッグ |terminal-debug|
38-
はじめに |termdebug-starting|
39-
セッション例 |termdebug-example|
40-
コードをステップ実行する |termdebug-stepping|
41-
変数を検査する |termdebug-variables|
42-
スタックフレームの移動 |termdebug-frames|
43-
その他のコマンド |termdebug-commands|
44-
イベント |termdebug-events|
45-
プロンプトモード |termdebug-prompt|
46-
マッピング |termdebug-mappings|
47-
通信 |termdebug-communication|
48-
カスタマイズ |termdebug-customizing|
29+
Vim からジョブへ: term_sendkeys() |terminal-to-job|
30+
ジョブから Vim へ: JSON API |terminal-api|
31+
クライアントサーバー機能を使う |terminal-client-server|
32+
4. リモートテスト |terminal-testing|
33+
5. 画面ダンプの差分 |terminal-diff|
34+
Vimの画面ダンプテストを書く |terminal-dumptest|
35+
画面ダンプを作成する |terminal-screendump|
36+
画面ダンプを比較する |terminal-diffscreendump|
37+
6. デバッグ |terminal-debug|
38+
はじめに |termdebug-starting|
39+
セッション例 |termdebug-example|
40+
コードをステップ実行する |termdebug-stepping|
41+
変数を検査する |termdebug-variables|
42+
スタックフレームの移動 |termdebug-frames|
43+
その他のコマンド |termdebug-commands|
44+
イベント |termdebug-events|
45+
プロンプトモード |termdebug-prompt|
46+
マッピング |termdebug-mappings|
47+
通信 |termdebug-communication|
48+
リモートデバッグ |termdebug-remote|
49+
カスタマイズ |termdebug-customizing|
4950

5051
{Vimが |+terminal| 機能付きでコンパイルされたときのみ有効}
5152
端末機能を使うには |+job||+channel| 機能が必要である。
@@ -1609,25 +1610,124 @@ gdb は奇妙な動作をしているが、プラグインはその問題を回
16091610
`:Continue` コマンドに "continue" が使用されていることが分かる。
16101611

16111612

1613+
リモートデバッグ ~
1614+
*termdebug-remote*
1615+
リモートデバッグにおける主な問題の 1 つは、デバッグ対象のソースファイルへのアク
1616+
セスである。プラグインは、システムと Vim のネットワーク機能を使用してこの問題を
1617+
回避できる。
1618+
*termdebug-remote-example*
1619+
|termdebug-example| は、`gdb` デバッガーを実行して `ssh` 経由でアクセス可能な
1620+
リモート Linux マシン上の Vim をデバッグすることで再現できる。
1621+
1622+
- ローカルの例の説明に従って Vim をビルドする。
1623+
1624+
リモートマシンで "socat" が使用できない場合、'terminal' モードは正常に動作しな
1625+
い。|termdebug_use_prompt| にフォールバックする: >
1626+
:let g:termdebug_config = {}
1627+
:let g:termdebug_config['use_prompt'] = v:true
1628+
1629+
- リモート `gdb` インスタンスを実行するためのコマンドラインを指定する: >
1630+
:let g:termdebug_config['command'] = ['ssh', 'hostname', 'gdb']
1631+
< この例では `ssh` の説明は範囲外だが、`$HOME/.ssh/config` ファイルにユーザー、
1632+
キー、その他のオプションを指定することによって、コマンドラインを大幅に簡素化
1633+
できることに注目して欲しい。
1634+
1635+
- リモートパスを |netrw| パスに変換するためのヒントを提供する: >
1636+
:let g:termdebug_config['substitute_path'] = { '/': 'scp://hostname//' }
1637+
1638+
- termdebug プラグインをロードし、Vim のデバッグを開始する: >
1639+
:packadd termdebug
1640+
:Termdebug vim
1641+
1642+
これで、ローカルの例と同じ 3 つのウィンドウが表示され、同じ手順を実行できる。
1643+
唯一の違いは、ソースウィンドウにローカルバッファではなく netrw バッファが表示
1644+
されることである。
1645+
1646+
*termdebug-substitute-path*
1647+
`g:termdebug_config['substitute_path']` エントリを使用して、gdb の
1648+
`substitute-path` コマンドと同じ戦略でリモートファイルをローカルファイルにマッ
1649+
ピングする。例:
1650+
- ssh 経由でリモートファイルにアクセスするには、|netrw| を使用する: >
1651+
let g:termdebug_config['command'] = ['ssh', 'hostname', 'gdb']
1652+
let g:termdebug_config['substitute_path'] = { '/': 'scp://hostname//' }
1653+
< Note: キーはリモートマシンのルートパスを指定し、値はローカルマシンのルートパ
1654+
スを指定する。
1655+
- Windows の `UNC` パスを使用して `WSL2` ソースにアクセスする: >
1656+
let g:termdebug_config['command'] = ['wsl', 'gdb']
1657+
let g:termdebug_config['substitute_path'] = {
1658+
\ '/': '\\wsl.localhost\Ubuntu-22.04\',
1659+
\ '/mnt/c/': 'C:/' }
1660+
< Note: 複数のマッピングが必要である。各ドライブユニットに 1 つ、Linux ファイ
1661+
ルシステムに 1 つ (`wslpath` 経由で照会)。
1662+
1663+
このモードでは、すべての `ssh` または `wsl` コマンドが検出され、同様のコマンド
1664+
を使用してリモート `tty` 端末セッションで `socat` を起動し、それを `gdb` に接
1665+
続する。
1666+
`socat` が使用できない場合は、フォールバックとして通常のリモート端末が使用され
1667+
る。
1668+
次のセッションでは、このデフォルトの動作をオーバーライドする方法を説明する。
1669+
1670+
*termdebug-remote-window*
1671+
別のリモート端末クライアントを使用するには、`:Termdebug` を呼び出す前に、
1672+
`g:termdebug_config` 変数の "remote_window" エントリを設定する。例:
1673+
- "prompt" モードを使用して Docker コンテナ内でデバッグする: >
1674+
let g:termdebug_config['use_prompt'] = v:true
1675+
let g:termdebug_config['command'] = ['docker', 'run', '-i',
1676+
\ '--rm', '--name', 'container-name', 'image-name', 'gdb']
1677+
let g:termdebug_config['remote_window'] =
1678+
\ ['docker', 'exec', '-ti', 'container-name'
1679+
\ ,'socat', '-dd', '-', 'PTY,raw,echo=0']
1680+
1681+
- "terminal buffer" を使用して Docker コンテナ内でデバッグする。
1682+
コンテナは既に実行されているはずである。これは、前述の `terminal mode` の場
1683+
合とは異なり、"program" および "communication" pty が gdb pty の前に作成され
1684+
るためである: >
1685+
$ docker run -ti --rm --name container-name immage-name
1686+
1687+
< 次に、デバッガーを起動する: >
1688+
let g:termdebug_config['use_prompt'] = v:false " default
1689+
let g:termdebug_config['command'] =
1690+
\ ['docker', 'exec', '-ti', 'container-name', 'gdb']
1691+
let g:termdebug_config['remote_window'] =
1692+
\ ['docker', 'exec', '-ti', 'container-name'
1693+
\ ,'socat', '-dd', '-', 'PTY,raw,echo=0']
1694+
1695+
Note: プロンプトバッファが `tty` 接続を処理できないため、"command" は
1696+
|termdebug-prompt| モードで `-t` を使用できない。
1697+
"remote_window" コマンドでは `-t` を使用する必要がある。そうしなければ、gdb が
1698+
接続するための `pty slave device` が不足する。
1699+
Note: "socat" は、リモートマシンの "terminal" モードで使用可能である必要がある。
1700+
Note: docker コンテナソースは、`volumes` とマッピングを組み合わせてアクセスで
1701+
きる (|termdebug-substitute-path| を参照)。
1702+
16121703
GDBコマンド ~
16131704
*g:termdebugger*
16141705
gdb コマンド以外のデバッガを使うには、`:Termdebug` を実行する前に
16151706
g:termdebug_config の "debugger" エントリか "g:termdebugger" 変数を変更する: >
16161707
let g:termdebug_config['command'] = "mygdb"
1708+
16171709
g:termdebug_config がない場合は、以下を使用できる: >
16181710
let g:termdebugger = "mygdb"
16191711
16201712
ただし、後者の形式は将来のリリースでは非推奨になりる。
16211713

16221714
コマンドに引数が必要な場合はリストを使用する: >
16231715
let g:termdebug_config['command'] = ['rr', 'replay', '--']
1716+
16241717
g:termdebug_config がない場合は、以下を使用できる: >
16251718
let g:termdebugger = ['rr', 'replay', '--']
16261719
16271720
gdb がデバッガで適切に動作するように、いくつかの引数が追加される。それらを変更
16281721
したい場合は、引数リストをフィルタリングする関数を追加する: >
16291722
let g:termdebug_config['command_filter'] = MyDebugFilter
16301723
1724+
"command_filter" シナリオは、ssh 経由のリモートデバッグにおけるエスケープの問
1725+
題を解決する。便宜上、引数内の空白をエスケープするためのデフォルトフィルタが用
1726+
意されている。このフィルタは ssh 用に自動的に設定されるが、以下のような他のユー
1727+
スケースにも使用できる: >
1728+
let g:termdebug_config['command_filter'] =
1729+
/ function('g:Termdebug_escape_whitespace')
1730+
16311731
引数を追加したくないが、"pty" を設定する必要がある場合は、関数を使用して必要な
16321732
引数を追加する: >
16331733
let g:termdebug_config['command_add_args'] = MyAddArguments
@@ -1682,15 +1782,15 @@ g:termdebug_config がない場合は、以下を使用できる: >
16821782
デフォルトの目印の変更 ~
16831783
*termdebug_signs*
16841784
Termdebug は、signcolumn のブレークポイント ID の 16 進数を使用してブレークポ
1685-
イントを表す。"0xFF" より大きい場合は、実際には記号用の画面セルが 2 つしかない
1686-
ため、"F+" と表示される。
1687-
代わりに 10 進数のブレークポイントの目印を使用することもできる。その場合、99
1688-
より大きい ID は "9+" と表示される。
1785+
イントを表す。"0xFF" より大きい場合、目印に使用できる画面セルは 2 つしかないた
1786+
め、"F+" と表示される。代わりに 10 進数のブレークポイントの目印を使用すること
1787+
もできる。その場合、99 より大きい ID は "9+" と表示される。
16891788

16901789
ブレークポイントの目印をカスタマイズして、signcolumn に `>>` を表示するには: >
16911790
let g:termdebug_config['sign'] = '>>'
16921791
最初のいくつかのブレークポイントに個別の記号を指定することもできる: >
1693-
let g:termdebug_config['signs'] = ['>1', '>2', '>3', '>4', '>5', '>6', '>7', '>8', '>9']
1792+
let g:termdebug_config['signs'] = ['>1', '>2', '>3', '>4', '>5',
1793+
\ '>6', '>7', '>8', '>9']
16941794
let g:termdebug_config['sign'] = '>>'
16951795
10 進数 (基数 10) のブレークポイントの目印を使用するには: >
16961796
let g:termdebug_config['sign_decimal'] = 1

0 commit comments

Comments
 (0)