Skip to content

Commit

Permalink
Merge pull request #879 from tsuyoshicho/update/misc-20210124
Browse files Browse the repository at this point in the history
Update {autocmd,filetype}.{txt,jax}
  • Loading branch information
k-takata authored Feb 4, 2021
2 parents a475c63 + 8f46de1 commit 53cfc8f
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 41 deletions.
36 changes: 31 additions & 5 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: 2020 Oct 26
*autocmd.txt* For Vim バージョン 8.2. Last change: 2021 Jan 28


VIMリファレンスマニュアル by Bram Moolenaar
Expand Down Expand Up @@ -54,6 +54,7 @@
{pat} |autocmd-patterns| に一致するファイルで、{event}
のときに自動的に実行するコマンドのリストに、{cmd} を加
える。
{event} には "*" は使えない。 *E1155*
Note: クォートは :autocmd への引数と見なされ、コメント
を開始しない。
{cmd} は常に既存の自動コマンドの後に追加されるので、
Expand All @@ -67,6 +68,10 @@
特殊なパターン<buffer>や<buffer=N>はバッファローカルな自動コマンドを定義する。
|autocmd-buflocal| を参照。

`:autocmd` が Vim9 script (スクリプトが `:vim9script` で始まるのと `:def` 関数
内) にあると {cmd} は Vim9 script として実行される。したがってこの依存は自動コ
マンドが定義された位置に依存し、トリガーされた位置ではない。

Note: '|' が {cmd} の前にある場合、":autocmd" コマンドの後には別のコマンドを続
けることができる。これは動作する: >
:augroup mine | au! BufRead | augroup END
Expand Down Expand Up @@ -306,6 +311,9 @@ Vimは以下のイベントを認識する。イベント名が大文字か小
|VimLeavePre| Vimを終了する前、viminfoファイルを書き出す前
|VimLeave| Vimを終了する前、viminfoファイルを書き出した後

|VimSuspend| Vimがサスペンドした時
|VimResume| Vimがサスペンド後復帰した時

端末
|TerminalOpen| 端末バッファが生成された後
|TerminalWinOpen| 新しいウィンドウで端末バッファが生成された後
Expand Down Expand Up @@ -558,14 +566,18 @@ CmdlineChanged コマンドラインのテキストに変更が加えられた
|cmdwin-char|
*CmdlineEnter*
CmdlineEnter ユーザーがコマンドを入力もしくは文字列を検索で
きるコマンドラインにカーソルが移動した後。
きるコマンドラインにカーソルが移動した後、非イ
ンタラクティブなマッピング内での ":" 利用を含
むが、|<Cmd>| の利用は含まない。
<afile> はコマンドラインの種類を示す 1 文字に
設定される。
|cmdwin-char|
*CmdlineLeave*
CmdlineLeave カーソルがコマンドラインを離れる前。CTRL-C
しくは <Esc> の入力によってコマンドラインを放
棄する場合も同様。
CmdlineLeave カーソルがコマンドラインを離れる前、非インタラ
クティブなマッピング内での ":" 利用を含むが、
|<Cmd>| の利用は含まない。CTRL-C もしくは
<Esc> の入力によってコマンドラインを放棄する場
合も同様。
コマンドの結果がエラーとなる場合は、コマンドラ
インは引き続き実行中となる。
<afile> はコマンドラインの種類を示す 1 文字に
Expand Down Expand Up @@ -832,6 +844,7 @@ FuncUndefined ユーザー定義関数が使われたが、定義されてい
ある。パターンは関数名に対して照合される。
<amatch><afile> の両方とも関数名に設定され
る。
コンパイルされた |Vim9| 関数では発生しない。
NOTE: Vim script を書くときには autoload 関数
を使う方がよい。
|autoload-functions|を参照。
Expand Down Expand Up @@ -1193,6 +1206,7 @@ VimLeave Vim を終了する前で、ファイル .viminfo を書き込
異常終了の検出には |v:dying| を使うこと。
終了時に v:dying が 2 以上のときはこのイベント
は発生しない。
終了コードは |v:exiting| から得る。
*VimLeavePre*
VimLeavePre Vim を終了する前で、ファイル .viminfo を書き込
む直前。これは終了時にたまたまカレントバッファ
Expand All @@ -1203,10 +1217,22 @@ VimLeavePre Vim を終了する前で、ファイル .viminfo を書き込
< 異常終了の検出には |v:dying| を使うこと。
終了時に v:dying が 2 以上のときはこのイベント
は発生しない。
終了コードは |v:exiting| から得る。
*VimResized*
VimResized Vimウィンドウのサイズが変わったとき。よって
'lines''columns' が変更される。しかし開始
時には発生しない。
*VimResume*
VimResume Vimがサスペンドと |VimSuspend| がトリガーした
後、Vimのインスタンスが復帰したとき。
|:checktime| を実行してVimがサスペンド中にバッ
ファ内容に変化がなかったことを保証するのに便利
である: >
:autocmd VimResume * checktime
< *VimSuspend*
VimSuspend Vimのインスタンスがサスペンドしたとき。Vim内で
CTRL-Z がタイプされた時だけであり、SIGSTOP か
SIGTSTP シグナルがVimに送られた時ではない。
*WinEnter*
WinEnter 別のウィンドウに入った後。Vimの開始直後、1個目
のウィンドウに入ったときは発生しない。ウィンド
Expand Down
36 changes: 19 additions & 17 deletions doc/filetype.jax
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*filetype.txt* For Vim バージョン 8.2. Last change: 2020 Sep 28
*filetype.txt* For Vim バージョン 8.2. Last change: 2021 Jan 21


VIMリファレンスマニュアル by Bram Moolenaar
Expand Down Expand Up @@ -153,6 +153,7 @@ NOTE: Vi互換とは全てのオプションがグローバルであることを
*.w g:filetype_w |ft-cweb-syntax|
*.i g:filetype_i |ft-progress-syntax|
*.p g:filetype_p |ft-pascal-syntax|
*.pp g:filetype_pp |ft-pascal-syntax|
*.sh g:bash_is_sh |ft-sh-syntax|
*.tex g:tex_flavor |ft-tex-plugin|

Expand Down Expand Up @@ -553,17 +554,17 @@ GIT COMMIT *ft-gitcommit-plugin*

MAN *ft-man-plugin* *:Man* *man.vim*

マニュアルページを洗練された方法で表示する。ユーザーマニュアルの
|find-manpage|も参照のこと。
このプラグインはマニュアルページを洗練された方法で表示する。ユーザーマニュアル
の詳細な情報は |find-manpage| も参照のこと。

マニュアルページを読み込む前に ":Man" を利用するには、起動vimrcファイルでこの
スクリプトを読み込む必要がある: >
マニュアルページが読み込まれる前に |:Man| を利用するには、起動 |vimrc| ファイ
ルでこのスクリプトを読み込む必要がある: >
runtime ftplugin/man.vim
オプション:
'iskeyword' マニュアルページの名前の上でCTRL-]を使えるようにするために文字
'.' が追加される。
'iskeyword' マニュアルページの名前の上で CTRL-] の利用をサポートするように
するために文字 '.' が追加される。

コマンド:
Man {name} {name} についてのマニュアルページを表示する。
Expand All @@ -573,24 +574,25 @@ Man {number} {name}

グローバルキーマップ:
<Leader>K カーソル下の単語についてのマニュアルページを表示する。
<Plug>ManPreGetPage 同上、マッピングを使うことを可能にする: >
nmap <F1> <Plug>ManPreGetPage<CR>
<Plug>ManPreGetPage
同上、マッピングを使うことを可能にする: >
nmap <F1> <Plug>ManPreGetPage
ローカルキーマップ:
CTRL-] カーソルの下の単語についてのマニュアルページへ移動する。
CTRL-T 直前のマニュアルページへ戻る。
q ":quit" と同じ
q |:quit| コマンドと同じ。

水平の代わりに垂直分割を使用するには: >
let g:ft_man_open_mode = 'vert'
新しいタブを使うには: >
let g:ft_man_open_mode = 'tab'
折畳を有効にするにはこの変数を使う: >
let g:ft_man_folding_enable = 1
もしデフォルトの折畳が好みではないのなら、代わりに autocommand を使って望んだ
折畳スタイルを追加できる。例: >
autocmd FileType man setlocal foldmethod=indent foldenable
折畳 |folding| を有効にするにはこの変数を使う: >
let g:ft_man_folding_enable = 1
もしデフォルトの折畳が好みではないのなら、代わりに |autocommand| を使って望ん
だ折畳スタイルを追加できる。例: >
autocmd FileType man setlocal foldmethod=indent foldenable
:Man {number} {name} が man {number} {name} のように振る舞い、ページが見つから
ない場合に man {name} を実行させたくなければ、これを使用する: >
Expand All @@ -603,8 +605,8 @@ q ":quit" と同じ
MANPAGER *manpager.vim*

:Man コマンドを使うと、Vim をマンページにできる(その構文はマンページをハイライ
ト表示しCTRL-] でヒットしたリンク先のマンページをたどる)。
|:Man| コマンドを使うと、Vim をマンページにできる(その構文はマンページをハイラ
イト表示しCTRL-] でヒットしたリンク先のマンページをたどる)。

bash, zsh, ksh もしくは dash の場合、設定ファイル (.bashrc, .zshrc, ...) に以
下の設定を追加する。
Expand Down
35 changes: 31 additions & 4 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: 2020 Oct 26
*autocmd.txt* For Vim version 8.2. Last change: 2021 Jan 28


VIM REFERENCE MANUAL by Bram Moolenaar
Expand Down Expand Up @@ -54,7 +54,8 @@ effects. Be careful not to destroy your text.
:au[tocmd] [group] {event} {pat} [++once] [++nested] {cmd}
Add {cmd} to the list of commands that Vim will
execute automatically on {event} for a file matching
{pat} |autocmd-patterns|.
{pat} |autocmd-patterns|.
Here {event} cannot be "*". *E1155*
Note: A quote character is seen as argument to the
:autocmd and won't start a comment.
Vim always adds the {cmd} after existing autocommands,
Expand All @@ -70,6 +71,11 @@ effects. Be careful not to destroy your text.
The special pattern <buffer> or <buffer=N> defines a buffer-local autocommand.
See |autocmd-buflocal|.

If the `:autocmd` is in Vim9 script (a script that starts with `:vim9script`
and in a `:def` function) then {cmd} will be executed as in Vim9
script. Thus this depends on where the autocmd is defined, not where it is
triggered.

Note: The ":autocmd" command can only be followed by another command when the
'|' appears before {cmd}. This works: >
:augroup mine | au! BufRead | augroup END
Expand Down Expand Up @@ -301,6 +307,9 @@ Name triggered by ~
|VimLeavePre| before exiting Vim, before writing the viminfo file
|VimLeave| before exiting Vim, after writing the viminfo file

|VimSuspend| when suspending Vim
|VimResume| when Vim is resumed after being suspended

Terminal
|TerminalOpen| after a terminal buffer was created
|TerminalWinOpen| after a terminal buffer was created in a new window
Expand Down Expand Up @@ -551,12 +560,15 @@ CmdlineChanged After a change was made to the text in the
*CmdlineEnter*
CmdlineEnter After moving the cursor to the command line,
where the user can type a command or search
string.
string; including non-interactive use of ":"
in a mapping, but not when using |<Cmd>|.
<afile> is set to a single character,
indicating the type of command-line.
|cmdwin-char|
*CmdlineLeave*
CmdlineLeave Before leaving the command line.
CmdlineLeave Before leaving the command line; including
non-interactive use of ":" in a mapping, but
not when using |<Cmd>|.
Also when abandoning the command line, after
typing CTRL-C or <Esc>.
When the commands result in an error the
Expand Down Expand Up @@ -840,6 +852,8 @@ FuncUndefined When a user function is used but it isn't
when it's used. The pattern is matched
against the function name. Both <amatch> and
<afile> are set to the name of the function.
Not triggered when compiling a |Vim9|
function.
NOTE: When writing Vim scripts a better
alternative is to use an autoloaded function.
See |autoload-functions|.
Expand Down Expand Up @@ -1207,6 +1221,7 @@ VimLeave Before exiting Vim, just after writing the
To detect an abnormal exit use |v:dying|.
When v:dying is 2 or more this event is not
triggered.
To get the exit code use |v:exiting|.
*VimLeavePre*
VimLeavePre Before exiting Vim, just before writing the
.viminfo file. This is executed only once,
Expand All @@ -1217,10 +1232,22 @@ VimLeavePre Before exiting Vim, just before writing the
< To detect an abnormal exit use |v:dying|.
When v:dying is 2 or more this event is not
triggered.
To get the exit code use |v:exiting|.
*VimResized*
VimResized After the Vim window was resized, thus 'lines'
and/or 'columns' changed. Not when starting
up though.
*VimResume*
VimResume When the Vim instance is resumed after being
suspended and |VimSuspend| was triggered.
Useful for triggering |:checktime| and ensure
the buffers content did not change while Vim
was suspended: >
: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.
*WinEnter*
WinEnter After entering another window. Not done for
the first window, when Vim has just started.
Expand Down
31 changes: 16 additions & 15 deletions en/filetype.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*filetype.txt* For Vim version 8.2. Last change: 2020 Sep 28
*filetype.txt* For Vim version 8.2. Last change: 2021 Jan 21


VIM REFERENCE MANUAL by Bram Moolenaar
Expand Down Expand Up @@ -147,6 +147,7 @@ can be used to overrule the filetype used for certain extensions:
*.w g:filetype_w |ft-cweb-syntax|
*.i g:filetype_i |ft-progress-syntax|
*.p g:filetype_p |ft-pascal-syntax|
*.pp g:filetype_pp |ft-pascal-syntax|
*.sh g:bash_is_sh |ft-sh-syntax|
*.tex g:tex_flavor |ft-tex-plugin|

Expand Down Expand Up @@ -563,16 +564,15 @@ Local mappings:

MAN *ft-man-plugin* *:Man* *man.vim*

Displays a manual page in a nice way. Also see the user manual
|find-manpage|.

To start using the ":Man" command before any manual page was loaded, source
this script from your startup vimrc file: >
This plugin displays a manual page in a nice way. See |find-manpage| in the
user manual for more information.

To start using the |:Man| command before any manual page has been loaded,
source this script from your startup |vimrc| file: >
runtime ftplugin/man.vim
Options:
'iskeyword' the '.' character is added to be able to use CTRL-] on the
'iskeyword' The '.' character is added to support the use of CTRL-] on the
manual page name.

Commands:
Expand All @@ -582,24 +582,25 @@ Man {number} {name}

Global mapping:
<Leader>K Displays the manual page for the word under the cursor.
<Plug>ManPreGetPage idem, allows for using a mapping: >
nmap <F1> <Plug>ManPreGetPage<CR>
<Plug>ManPreGetPage
idem, allows for using a mapping: >
nmap <F1> <Plug>ManPreGetPage
Local mappings:
CTRL-] Jump to the manual page for the word under the cursor.
CTRL-T Jump back to the previous manual page.
q Same as ":quit"
q Same as the |:quit| command.

To use a vertical split instead of horizontal: >
let g:ft_man_open_mode = 'vert'
To use a new tab: >
let g:ft_man_open_mode = 'tab'
To enable folding use this: >
let g:ft_man_folding_enable = 1
If you do not like the default folding, use an autocommand to add your desired
To enable |folding|, use this: >
let g:ft_man_folding_enable = 1
If you do not like the default folding, use an |autocommand| to add your desired
folding style instead. For example: >
autocmd FileType man setlocal foldmethod=indent foldenable
autocmd FileType man setlocal foldmethod=indent foldenable
If you would like :Man {number} {name} to behave like man {number} {name} by
not running man {name} if no page is found, then use this: >
Expand All @@ -612,7 +613,7 @@ page in a Vim window: >
MANPAGER *manpager.vim*

The :Man command allows you to turn Vim into a manpager (that syntax highlights
The |:Man| command allows you to turn Vim into a manpager (that syntax highlights
manpages and follows linked manpages on hitting CTRL-]).

For bash,zsh,ksh or dash, add to the config file (.bashrc,.zshrc, ...)
Expand Down

0 comments on commit 53cfc8f

Please sign in to comment.