Skip to content

Update autocmd.{txt,jax} #1032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 33 additions & 28 deletions doc/autocmd.jax
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*autocmd.txt* For Vim バージョン 8.2. Last change: 2021 Nov 20
*autocmd.txt* For Vim バージョン 8.2. Last change: 2022 Feb 09


VIMリファレンスマニュアル by Bram Moolenaar
Expand Down Expand Up @@ -50,10 +50,10 @@
2. 自動コマンドの定義 *autocmd-define*

*:au* *:autocmd*
:au[tocmd] [group] {event} {pat} [++once] [++nested] {cmd}
{pat} |autocmd-patterns| に一致するファイルで、{event}
のときに自動的に実行するコマンドのリストに、{cmd} を加
える
:au[tocmd] [group] {event} {aupat} [++once] [++nested] {cmd}
{aupat} |autocmd-patterns| に一致するファイルで、
{event} のときに自動的に実行するコマンドのリストに、
{cmd} を加える
{event} には "*" は使えない。 *E1155*
Note: クォートは :autocmd への引数と見なされ、コメント
を開始しない。
Expand Down Expand Up @@ -142,19 +142,19 @@ Note [group] はあらかじめ定義されていなければならないこと
==============================================================================
3. 自動コマンドの除去 *autocmd-remove*

:au[tocmd]! [group] {event} {pat} [++once] [++nested] {cmd}
{event} と {pat} に関連づけられた全ての自動コマンドを
除去し、コマンド {cmd} を加える。
:au[tocmd]! [group] {event} {aupat} [++once] [++nested] {cmd}
{event} と {aupat} に関連づけられた全ての自動コマンド
を除去し、コマンド {cmd} を加える。
[++once] については |autocmd-once| を参照。
[++nested] については |autocmd-nested| を参照。

:au[tocmd]! [group] {event} {pat}
{event} と {pat} に関連づけられた全ての自動コマンドを
除去する
:au[tocmd]! [group] {event} {aupat}
{event} と {aupat} に関連づけられた全ての自動コマンド
を除去する

:au[tocmd]! [group] * {pat}
{pat} に関連づけられた、全てのイベントに関する自動コマ
ンドを全て除去する
:au[tocmd]! [group] * {aupat}
{aupat} に関連づけられた、全てのイベントに関する自動コ
マンドを全て除去する

:au[tocmd]! [group] {event}
{event} に関連づけられた「全ての」自動コマンドを除去す
Expand All @@ -175,13 +175,13 @@ Note [group] はあらかじめ定義されていなければならないこと
==============================================================================
4. 自動コマンドの列挙 *autocmd-list*

:au[tocmd] [group] {event} {pat}
{event} と {pat} に関連づけられた全ての自動コマンドを
表示する
:au[tocmd] [group] {event} {aupat}
{event} と {aupat} に関連づけられた全ての自動コマンド
を表示する

:au[tocmd] [group] * {pat}
{pat} に関連づけられた、全てのイベントに関する自動コマ
ンドを表示する
:au[tocmd] [group] * {aupat}
{aupat} に関連づけられた、全てのイベントに関する自動コ
マンドを表示する

:au[tocmd] [group] {event}
{event} に関連づけられた全ての自動コマンドを表示する。
Expand Down Expand Up @@ -330,6 +330,7 @@ Vimは以下のイベントを認識する。イベント名が大文字か小
|FileChangedRO| 読み込み専用ファイルに対して最初に変更を加える前

|DiffUpdated| 差分が更新された後
|DirChangedPre| 作業ディレクトリが変更される前
|DirChanged| 作業ディレクトリが変更された後

|ShellCmdPost| シェルコマンドを実行した後
Expand Down Expand Up @@ -737,6 +738,10 @@ FileChangedRO 読み込み専用ファイルに最初の変更を加える前
DiffUpdated 差分が更新された後。使用されているdiffコマンド
の種類(内部または外部)に応じて、変更毎か
|:diffupdate| 実行時に発生する。
*DirChangedPre*
DirChangedPre |DirChanged| と同じように、作業ディレクトリが変更
されようとしているとき。パターンは |DirChanged| と同様。新し
いディレクトリ名は v:event.directory にある。
*DirChanged*
DirChanged |:cd|, |:tcd| もしくは |:lcd| コマンドによって、
もしくは 'autochdir' オプションの結果として作業
Expand Down Expand Up @@ -1194,7 +1199,7 @@ TextYankPost カレントバッファでテキストがヤンクもしくは
|quote_| が使用された場合、もしくは再帰的に呼
び出された場合には発生しない。
バッファのテキストを変更することは許されていな
い、|textlock| を参照。
い、|textlock| を参照。 *E1064*
{+eval 機能付きでコンパイルされた場合のみ有効}

*User*
Expand Down Expand Up @@ -1261,8 +1266,8 @@ VimResume Vimがサスペンドと |VimSuspend| がトリガーした
:autocmd VimResume * checktime
< *VimSuspend*
VimSuspend Vimのインスタンスがサスペンドしたとき。Vim内で
CTRL-Z がタイプされた時だけであり、SIGSTOP か
SIGTSTP シグナルがVimに送られた時ではない
CTRL-Z がタイプされた時、もしくは SIGTSTP シグ
ナルがVimに送られた時で、SIGSTOP ではない
*WinClosed*
WinClosed ウィンドウが閉じた後。パターンは |window-ID|
に対して照合される。<amatch> と <afile> は共に
Expand Down Expand Up @@ -1290,17 +1295,17 @@ WinNew 新しいウィンドウが作成されたとき。Vim がちょう
れない。WinEnter イベントの前。

==============================================================================
6. パターン *autocmd-patterns* *{pat}*
6. パターン *autocmd-patterns* *{aupat}*

引数 {pat} にはコンマ区切りのリストを指定することができる。これによりコマンド
は指定されたそれぞれのパターンについて実行される。例えばこのコマンド: >
引数 {aupat} にはコンマ区切りのリストを指定することができる。これによりコマン
ドは指定されたそれぞれのパターンについて実行される。例えばこのコマンド: >
:autocmd BufRead *.txt,*.info set et
は下記と等しくなる:
:autocmd BufRead *.txt set et
:autocmd BufRead *.info set et

ファイルパターン {pat} がファイル名とマッチするかどうかは、2通りの方法で調べら
れる。
ファイルパターン {aupat} がファイル名とマッチするかどうかは、2通りの方法で調べ
られる:
1. パターンに '/' が含まれないとき: Vimはファイル名の後ろの部分からのみマッチ
を調べる (ファイル名の前につくディレクトリパスは除く)。
2. パターンに '/' が含まれるとき: Vimは短いファイル名 (ユーザーが打ち込んだも
Expand Down
48 changes: 27 additions & 21 deletions en/autocmd.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*autocmd.txt* For Vim version 8.2. Last change: 2021 Nov 20
*autocmd.txt* For Vim version 8.2. Last change: 2022 Feb 09


VIM REFERENCE MANUAL by Bram Moolenaar
Expand Down Expand Up @@ -51,10 +51,10 @@ effects. Be careful not to destroy your text.
2. Defining autocommands *autocmd-define*

*:au* *:autocmd*
:au[tocmd] [group] {event} {pat} [++once] [++nested] {cmd}
:au[tocmd] [group] {event} {aupat} [++once] [++nested] {cmd}
Add {cmd} to the list of commands that Vim will
execute automatically on {event} for a file matching
{pat} |autocmd-patterns|.
{aupat} |autocmd-patterns|.
Here {event} cannot be "*". *E1155*
Note: A quote character is seen as argument to the
:autocmd and won't start a comment.
Expand Down Expand Up @@ -145,19 +145,19 @@ prompt. When one command outputs two messages this can happen anyway.
==============================================================================
3. Removing autocommands *autocmd-remove*

:au[tocmd]! [group] {event} {pat} [++once] [++nested] {cmd}
:au[tocmd]! [group] {event} {aupat} [++once] [++nested] {cmd}
Remove all autocommands associated with {event} and
{pat}, and add the command {cmd}.
{aupat}, and add the command {cmd}.
See |autocmd-once| for [++once].
See |autocmd-nested| for [++nested].

:au[tocmd]! [group] {event} {pat}
:au[tocmd]! [group] {event} {aupat}
Remove all autocommands associated with {event} and
{pat}.
{aupat}.

:au[tocmd]! [group] * {pat}
Remove all autocommands associated with {pat} for all
events.
:au[tocmd]! [group] * {aupat}
Remove all autocommands associated with {aupat} for
all events.

:au[tocmd]! [group] {event}
Remove ALL autocommands for {event}.
Expand All @@ -177,12 +177,12 @@ with ":augroup"); otherwise, Vim uses the group defined with [group].
==============================================================================
4. Listing autocommands *autocmd-list*

:au[tocmd] [group] {event} {pat}
:au[tocmd] [group] {event} {aupat}
Show the autocommands associated with {event} and
{pat}.
{aupat}.

:au[tocmd] [group] * {pat}
Show the autocommands associated with {pat} for all
:au[tocmd] [group] * {aupat}
Show the autocommands associated with {aupat} for all
events.

:au[tocmd] [group] {event}
Expand Down Expand Up @@ -326,6 +326,7 @@ Name triggered by ~
|FileChangedRO| before making the first change to a read-only file

|DiffUpdated| after diffs have been updated
|DirChangedPre| before the working directory will change
|DirChanged| after the working directory has changed

|ShellCmdPost| after executing a shell command
Expand Down Expand Up @@ -738,6 +739,11 @@ DiffUpdated After diffs have been updated. Depending on
what kind of diff is being used (internal or
external) this can be triggered on every
change or when doing |:diffupdate|.
*DirChangedPre*
DirChangedPre The working directory is going to be changed,
as with |DirChanged|. The pattern is like
with |DirChanged|. The new directory can be
found in v:event.directory.
*DirChanged*
DirChanged The working directory has changed in response
to the |:cd| or |:tcd| or |:lcd| commands, or
Expand Down Expand Up @@ -1211,7 +1217,7 @@ TextYankPost After text has been yanked or deleted in the
Not triggered when |quote_| is used nor when
called recursively.
It is not allowed to change the buffer text,
see |textlock|.
see |textlock|. *E1064*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この行以降の変更がjaxに反映されていないようです。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

すみません、確認します...

{only when compiled with the +eval feature}

*User*
Expand Down Expand Up @@ -1279,8 +1285,8 @@ VimResume When the Vim instance is resumed after being
:autocmd VimResume * checktime
< *VimSuspend*
VimSuspend When the Vim instance is suspended. Only when
CTRL-Z was typed inside Vim, not when the
SIGSTOP or SIGTSTP signal was sent to Vim.
CTRL-Z was typed inside Vim, or when the SIGTSTP
signal was sent to Vim, but not for SIGSTOP.
*WinClosed*
WinClosed After closing a window. The pattern is
matched against the |window-ID|. Both
Expand Down Expand Up @@ -1311,16 +1317,16 @@ WinNew When a new window was created. Not done for
Before a WinEnter event.

==============================================================================
6. Patterns *autocmd-patterns* *{pat}*
6. Patterns *autocmd-patterns* *{aupat}*

The {pat} argument can be a comma separated list. This works as if the
command was given with each pattern separately. Thus this command: >
The {aupat} argument of `:autocmd` can be a comma separated list. This works as
if the command was given with each pattern separately. Thus this command: >
:autocmd BufRead *.txt,*.info set et
Is equivalent to: >
:autocmd BufRead *.txt set et
:autocmd BufRead *.info set et

The file pattern {pat} is tested for a match against the file name in one of
The file pattern {aupat} is tested for a match against the file name in one of
two ways:
1. When there is no '/' in the pattern, Vim checks for a match against only
the tail part of the file name (without its leading directory path).
Expand Down