Skip to content
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
23 changes: 11 additions & 12 deletions doc/change.jax
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*change.txt* For Vim バージョン 9.1. Last change: 2024 Nov 12
*change.txt* For Vim バージョン 9.1. Last change: 2024 Dec 15


VIMリファレンスマニュアル by Bram Moolenaar
Expand Down Expand Up @@ -1468,18 +1468,17 @@ gww "gw" と同様にして現在行を整形する。
れ、かつそのスクリプト名は <filetype>format.vim とされるべきなので、|autoload|
スクリプトを使用することは理にかなっている。

例えば、Vim と共に配布され $VIMRUNTIME ディレクトリに配置されている XML ファイ
ルタイププラグインは、オプション 'formatexpr' を以下のように設定する: >

例えば、Vim と共に配布され $VIMRUNTIME/ftplugin ディレクトリに配置されている
XML ファイルタイププラグインは、オプション 'formatexpr' を以下のように設定する:
>
setlocal formatexpr=xmlformat#Format()

これは、xmlformat#Format() を定義している対応したスクリプトが以下のディレクト
リで見つかることを意味している:
`$VIMRUNTIME/autoload/xmlformat.vim`
これは、xmlformat#Format() を定義している対応したスクリプトがファイル
`$VIMRUNTIME/autoload/xmlformat.vim` で見つかることを意味している。

以下は、選択されたテキストから末尾の空白を取り除くスクリプトの例である。これを
autoload ディレクトリに置くこと。例、~/.vim/autoload/format.vim: >

autoload ディレクトリに置くこと。例、~/.vim/autoload/format.vim:
>vim
func! format#Format()
" 明示的な gq コマンドの場合だけ再整形する
if mode() != 'n'
Expand Down Expand Up @@ -1512,8 +1511,8 @@ Note: この関数は、挿入モードから呼ばれた場合に明示的に

*right-justify*
テキストを右揃えするコマンドは、Vimには存在しない。"par" 等の外部コマンド (例:
"!}par" で段落の最後までを整形する) を実行したり、'formatprg' に "par" を指定
することで、これを行うことができる。
`:.,}!par` で段落の最後までを整形する) を実行したり、'formatprg' に "par" を指
定することで、これを行うことができる。

*format-comments*
コメント整形の概要がユーザーマニュアルの |30.6| にある。
Expand Down Expand Up @@ -1575,7 +1574,7 @@ Vimは特殊な方法で自動的にコメントを挿入・整形できる。Vi
べきインデントが存在しているときのみ機能する。

コメント文字列にフラグ 'f', 's', 'm', 'e' のいずれも指定しないとき、Vimはコメ
ント文字列を行の最初に繰り返すと仮定する。フラグ欄は空になる
ント文字列を行の最初に繰り返すと仮定する。{flags} 欄は空になる

{string} の前や後にある余白は、{string} の一部とされる。コメント文字列に必要で
ない限り、余白を前や後に付けないこと。
Expand Down
17 changes: 8 additions & 9 deletions en/change.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*change.txt* For Vim version 9.1. Last change: 2024 Nov 12
*change.txt* For Vim version 9.1. Last change: 2024 Dec 15


VIM REFERENCE MANUAL by Bram Moolenaar
Expand Down Expand Up @@ -1512,18 +1512,17 @@ since formatting is highly dependent on the type of file. It makes
sense to use an |autoload| script, so the corresponding script is only loaded
when actually needed and the script should be called <filetype>format.vim.

For example, the XML filetype plugin distributed with Vim in the $VIMRUNTIME
directory, sets the 'formatexpr' option to: >
For example, the XML filetype plugin distributed with Vim in the
$VIMRUNTIME/ftplugin directory, sets the 'formatexpr' option to: >

setlocal formatexpr=xmlformat#Format()

That means, you will find the corresponding script, defining the
xmlformat#Format() function, in the directory:
`$VIMRUNTIME/autoload/xmlformat.vim`
xmlformat#Format() function, in the file `$VIMRUNTIME/autoload/xmlformat.vim`

Here is an example script that removes trailing whitespace from the selected
text. Put it in your autoload directory, e.g. ~/.vim/autoload/format.vim: >

text. Put it in your autoload directory, e.g. ~/.vim/autoload/format.vim:
>vim
func! format#Format()
" only reformat on explicit gq command
if mode() != 'n'
Expand Down Expand Up @@ -1556,7 +1555,7 @@ debugging it helps to set the 'debug' option.

*right-justify*
There is no command in Vim to right justify text. You can do it with
an external command, like "par" (e.g.: "!}par" to format until the end of the
an external command, like "par" (e.g.: `:.,}!par` to format until the end of the
paragraph) or set 'formatprg' to "par".

*format-comments*
Expand Down Expand Up @@ -1622,7 +1621,7 @@ type of comment string. A part consists of:
some indent for the start or end part that can be removed.

When a string has none of the 'f', 's', 'm' or 'e' flags, Vim assumes the
comment string repeats at the start of each line. The flags field may be
comment string repeats at the start of each line. The {flags} field may be
empty.

Any blank space in the text before and after the {string} is part of the
Expand Down
Loading