Skip to content

Commit 5028050

Browse files
authored
Merge pull request #322 from vim-jp/update_eval
Update terminal.{txt,jax}
2 parents c335101 + f3709ab commit 5028050

File tree

2 files changed

+60
-25
lines changed

2 files changed

+60
-25
lines changed

doc/terminal.jax

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ Esc を使うことができますが、他のキーが壊れないようにす
115115
tnoremap <Esc> <C-W>N
116116
set notimeout ttimeout timeoutlen=100
117117
118+
端末モードマッピングと同様にメニューを作成することもできますが、|:tmenu| ではな
119+
|:tlmenu| を使用する必要があります。
120+
118121
< *options-in-terminal*
119122
端末ウィンドウを開いて 'buftype' を "terminal" に設定すると、TerminalOpen 自動
120123
コマンドイベントが発生します。これにより、ウィンドウとバッファ専用のオプション
@@ -230,6 +233,10 @@ Normal ハイライトグループにより決定されます。
230233

231234
より詳細なオプションを使いたいならば |term_start()|
232235
数を使ってください。
236+
ウィンドウを縦分割するには、次のようにします: >
237+
:vertical terminal
238+
< または短縮形: >
239+
:vert ter
233240
234241
端末に関連付けられたバッファが強制的にアンロードもしくは削除された場合には、
235242
`job_stop(job, "kill")` を呼んだのと同じようにそのジョブが殺されます。
@@ -521,9 +528,9 @@ VimのほとんどのテストはVimのなかでスクリプトを実行して
521528

522529
関数 ~
523530

524-
term_sendkeys() 端末にキーストロークを送信する (tmap の影響を受けない)
525-
term_wait() 端末画面が更新されるのを待つ
526-
term_scrape() 端末画面の内容を検査する
531+
|term_sendkeys()| 端末にキーストロークを送信する (tmap の影響を受けない)
532+
|term_wait()| 端末画面が更新されるのを待つ
533+
|term_scrape()| 端末画面の内容を検査する
527534

528535

529536
==============================================================================
@@ -548,7 +555,7 @@ Vimの画面ダンプテストを書く ~
548555
- 特定のサイズの端末でVimを実行します。デフォルトは75桁で20行です。これはダン
549556
プが常にこのサイズであることを確認します。RunVimInTerminal() 関数がこれを処
550557
理します。Vimコマンドの引数を渡します。
551-
- term_sendkeys() を使用して任意のコマンドをVimに送信します。例えば: >
558+
- |term_sendkeys()| を使用して任意のコマンドをVimに送信します。例えば: >
552559
call term_sendkeys(buf, ":echo &lines &columns\<CR>")
553560
- VerifyScreenDump() を使用して、画面が期待どおりの状態になっていることを確認
554561
します。これは、参照する画面ダンプが src/testdir/dumps/ ディレクトリに存在す
@@ -575,23 +582,23 @@ Vimの画面ダンプテストを書く ~
575582
*terminal-screendump*
576583

577584
画面ダンプを作成するには、端末でVim (または他のプログラム)を実行し、目的の状態
578-
を表示させます。その後、term_dumpwrite() 関数を使用して画面ダンプファイルを作
579-
成します。例: >
585+
を表示させます。その後、|term_dumpwrite()| 関数を使用して画面ダンプファイルを
586+
作成します。例: >
580587
:call term_dumpwrite(77, "mysyntax.dump")
581588
582589
この "77" は端末のバッファ番号です。それを見るためには `:ls!` を使用してくださ
583590
い。
584591

585-
term_dumpload() で画面ダンプを見ることができます: >
592+
|term_dumpload()| で画面ダンプを見ることができます: >
586593
:call term_dumpload("mysyntax.dump")
587594
588595
Vimがまったく同じ画面を表示していることを確認するには、まったく同じ方法でVimを
589596
再度実行し、目的の状態を表示します。次に、別のファイル名を使用して画面ダンプを
590597
再度作成します: >
591598
:call term_dumpwrite(88, "test.dump")
592599
593-
ファイルがまったく同じものであることを主張するには assert_equalfile() を使いま
594-
: >
600+
ファイルがまったく同じものであることを主張するには |assert_equalfile()| を使い
601+
ます: >
595602
call assert_equalfile("mysyntax.dump", "test.dump")
596603
597604
違いがある場合、v:errors はエラーメッセージを含みます。
@@ -600,8 +607,8 @@ Vimがまったく同じ画面を表示していることを確認するには
600607
画面ダンプを比較する ~
601608
*terminal-diffscreendump*
602609

603-
assert_equalfile() は、何が違うのかを簡単に見分けることはできません。問題を見
604-
つけるには、term_dumpdiff() を使用します: >
610+
|assert_equalfile()| は、何が違うのかを簡単に見分けることはできません。問題を
611+
見つけるには、|term_dumpdiff()| を使用します: >
605612
call term_dumpdiff("mysyntax.dump", "test.dump")
606613
607614
これで3つの部分からなるウィンドウが開きます:
@@ -610,7 +617,17 @@ assert_equalfile() は、何が違うのかを簡単に見分けることはで
610617
3. 2番目のダンプの内容
611618

612619
通常、2番目の部分で何が違うかを見ることができます。1番目または2番目ダンプの位
613-
置に関連付けるには 'ruler' を使用します。
620+
置に関連付けるには 'ruler' を使用します。文字は違いの種類を示します:
621+
X 異なる文字
622+
> 1番目にはカーソルがあるが、2番目にはカーソルがない
623+
< 2番目にはカーソルがあるが、1番目にはカーソルがない
624+
w 文字の幅が異なる (単一 対 2倍幅)
625+
f 文字色が異なる
626+
b 背景色が異なる
627+
a 属性が異なる (ボールド, 下線, 反転, 等)
628+
? 両方に文字がない
629+
+ 1番目に文字がない
630+
- 2番目に文字がない
614631

615632
あるいは、 "s" を押して、1番目と2番目のダンプを入れ替えます。これを何度か実行
616633
して、テキストの文脈における相違を見つけ出すことができます。
@@ -895,7 +912,7 @@ Vimのウィンドウ幅 *termdebug_wide*
895912
デバッグを開始した際に Vim のウィンドウ幅を変更し、垂直分割を利用するには次の
896913
ように設定します: >
897914
let g:termdebug_wide = 163
898-
これは :Termdebug を実行した際に &columns を 163 に設定します。元の値はデバッ
915+
これは `:Termdebug` を実行した際に &columns を 163 に設定します。元の値はデバッ
899916
ガが終了する際に復元されます。
900917
g:termdebug_wide が設定されていて、&columnsがすでに g:termdebug_wide より大き
901918
い場合、&columns を変更せずに垂直分割が使用されます。

en/terminal.txt

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ break: >
114114
tnoremap <Esc> <C-W>N
115115
set notimeout ttimeout timeoutlen=100
116116
117+
You can also create menus similar to terminal mode mappings, but you have to
118+
use |:tlmenu| instead of |:tmenu|.
119+
117120
< *options-in-terminal*
118121
After opening the terminal window and setting 'buftype' to "terminal" the
119122
TerminalOpen autocommand event is triggered. This makes it possible to set
@@ -228,6 +231,10 @@ Syntax ~
228231

229232
If you want to use more options use the |term_start()|
230233
function.
234+
If you want to split the window vertically, use: >
235+
:vertical terminal
236+
< Or short: >
237+
:vert ter
231238
232239
When the buffer associated with the terminal is forcibly unloaded or wiped out
233240
the job is killed, similar to calling `job_stop(job, "kill")` .
@@ -523,9 +530,9 @@ inspects the resulting screen state.
523530

524531
Functions ~
525532

526-
term_sendkeys() send keystrokes to a terminal (not subject to tmap)
527-
term_wait() wait for screen to be updated
528-
term_scrape() inspect terminal screen
533+
|term_sendkeys()| send keystrokes to a terminal (not subject to tmap)
534+
|term_wait()| wait for screen to be updated
535+
|term_scrape()| inspect terminal screen
529536

530537

531538
==============================================================================
@@ -552,7 +559,7 @@ src/testdir/test_syntax.vim. The main parts are:
552559
characters. This makes sure the dump is always this size. The function
553560
RunVimInTerminal() takes care of this. Pass it the arguments for the Vim
554561
command.
555-
- Send any commands to Vim using term_sendkeys(). For example: >
562+
- Send any commands to Vim using |term_sendkeys()|. For example: >
556563
call term_sendkeys(buf, ":echo &lines &columns\<CR>")
557564
- Check that the screen is now in the expected state, using
558565
VerifyScreenDump(). This expects the reference screen dump to be in the
@@ -580,21 +587,21 @@ Creating a screen dump ~
580587
*terminal-screendump*
581588

582589
To create the screen dump, run Vim (or any other program) in a terminal and
583-
make it show the desired state. Then use the term_dumpwrite() function to
590+
make it show the desired state. Then use the |term_dumpwrite()| function to
584591
create a screen dump file. For example: >
585592
:call term_dumpwrite(77, "mysyntax.dump")
586593
587594
Here "77" is the buffer number of the terminal. Use `:ls!` to see it.
588595

589-
You can view the screen dump with term_dumpload(): >
596+
You can view the screen dump with |term_dumpload()|: >
590597
:call term_dumpload("mysyntax.dump")
591598
592599
To verify that Vim still shows exactly the same screen, run Vim again with
593600
exactly the same way to show the desired state. Then create a screen dump
594601
again, using a different file name: >
595602
:call term_dumpwrite(88, "test.dump")
596603
597-
To assert that the files are exactly the same use assert_equalfile(): >
604+
To assert that the files are exactly the same use |assert_equalfile()|: >
598605
call assert_equalfile("mysyntax.dump", "test.dump")
599606
600607
If there are differences then v:errors will contain the error message.
@@ -603,8 +610,8 @@ If there are differences then v:errors will contain the error message.
603610
Comparing screen dumps ~
604611
*terminal-diffscreendump*
605612

606-
assert_equalfile() does not make it easy to see what is different.
607-
To spot the problem use term_dumpdiff(): >
613+
|assert_equalfile()| does not make it easy to see what is different.
614+
To spot the problem use |term_dumpdiff()|: >
608615
call term_dumpdiff("mysyntax.dump", "test.dump")
609616
610617
This will open a window consisting of three parts:
@@ -613,7 +620,18 @@ This will open a window consisting of three parts:
613620
3. The contents of the second dump
614621

615622
You can usually see what differs in the second part. Use the 'ruler' to
616-
relate it to the position in the first or second dump.
623+
relate it to the position in the first or second dump. Letters indicate the
624+
kind of difference:
625+
X different character
626+
> cursor in first but not in second
627+
< cursor in second but not in first
628+
w character width differs (single vs double width)
629+
f foreground color differs
630+
b background color differs
631+
a attribute differs (bold, underline, reverse, etc.)
632+
? character missing in both
633+
+ character missing in first
634+
- character missing in second
617635

618636
Alternatively, press "s" to swap the first and second dump. Do this several
619637
times so that you can spot the difference in the context of the text.
@@ -635,7 +653,7 @@ Starting ~
635653
Load the plugin with this command: >
636654
packadd termdebug
637655
< *:Termdebug*
638-
To start debugging use `:Termdebug` or `:TermdebugCommand`` followed by the
656+
To start debugging use `:Termdebug` or `:TermdebugCommand` followed by the
639657
command name, for example: >
640658
:Termdebug vim
641659
@@ -900,7 +918,7 @@ Vim window width *termdebug_wide*
900918
To change the width of the Vim window when debugging starts, and use a
901919
vertical split: >
902920
let g:termdebug_wide = 163
903-
This will set &columns to 163 when :Termdebug is used. The value is restored
921+
This will set &columns to 163 when `:Termdebug` is used. The value is restored
904922
when quitting the debugger.
905923
If g:termdebug_wide is set and &columns is already larger than
906924
g:termdebug_wide then a vertical split will be used without changing &columns.

0 commit comments

Comments
 (0)