Skip to content

Update develop.{txt,jax} #2069

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 3 commits into from
May 16, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
97 changes: 30 additions & 67 deletions doc/develop.jax
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*develop.txt* For Vim バージョン 9.1. Last change: 2025 Apr 18
*develop.txt* For Vim バージョン 9.1. Last change: 2025 May 05


VIMリファレンスマニュアル by Bram Moolenaar
Expand Down Expand Up @@ -217,7 +217,7 @@ sound.c と sign.c は、配布された .clang-format ファイルに従って
Marriott)


☆コメント *style-comments*
☆コメント *style-comments*

関数本体内に複数行のコメントを入れないようにすること。関数が非常に複雑で、一部
を個別にコメントする必要がある場合は、関数の構造を再検討する必要がある。
Expand All @@ -232,15 +232,15 @@ sound.c と sign.c は、配布された .clang-format ファイルに従って
<


☆インデント *style-indentation*
☆インデント *style-indentation*

コードのインデントには 4 つのスペースを使用する。Vim を使用してソースを編集し
ている場合は、|modeline| があるため何もする必要はない。

他のエディタの場合は、リポジトリのルートに `.editorconfig` が提供される。


☆宣言 *style-declarations*
☆宣言 *style-declarations*

可能であれば、ガード内で `for` ループ変数を宣言する:
OK: >
Expand All @@ -261,113 +261,77 @@ OK: >
<


☆括弧 *style-braces*
☆括弧 *style-braces*

すべての波括弧は改行しなければならない:
OK: >
if (cond)
{
cmd;
cmd;
cmd;
cmd;
}
else
{
cmd;
cmd;
cmd;
cmd;
}
<
間違い: >
if (cond) {
cmd;
cmd;
cmd;
cmd;
} else {
cmd;
cmd;
cmd;
cmd;
}
<
OK: >
while (cond)
{
cmd;
cmd;
}
<
間違い: >
while (cond) {
cmd;
cmd;
}
<
ブロックがコメントを含めて 1 行の場合は、波括弧は省略できる。
OK: >
if (cond)
cmd;
else
cmd;
<
間違い: >
if (cond)
/*
* comment
*/
do
{
cmd;
else
cmd;
} while (cond);
<
`if`/`else` の一方のブロックに波括弧がある場合は、もう一方のブロックにも波括弧
が必要である。
OK: >
if (cond)
{
cmd;
}
else
または >
do
{
cmd;
cmd;
}
while (cond);
<
間違い: >
if (cond)
do {
cmd;
else
{
cmd;
cmd;
}

if (cond)
{
cmd;
cmd;
}
else
cmd;
<
OK: >
while (cond)
cmd;
<
間違い:
>
while (cond)
if (cond)
cmd;
} while (cond);
<


☆型 *style-types*

記述的な型を使用すること。それらのリストは src/structs.h ファイル内、またはお
そらく作業中のファイルの typedef 内にある。

説明的な型を使用すること。これらは src/vim.h、src/structs.h などで定義されてい
る。
Note すべてのカスタム型には「_T」という接尾辞が付けられることに注意

OK: >
int is_valid_line_number(linenr_T lnum);
例: >
linenr_T
buf_T
pos_T
<
間違い: >
int is_valid_line_number(unsigned long lnum);
<


☆空白と句読法 *style-spaces*

Expand All @@ -388,8 +352,8 @@ OK: func(arg1, arg2); for (i = 0; i < 2; ++i)

'=', '+', '/' 等の前後に空白を入れる。

間違い: var=a*5;
OK: var = a * 5;
間違い: var=a*5;

似たような動作をグループ化するには、空行を使う。

Expand All @@ -414,7 +378,6 @@ OK: >
while (buf != NULL && !got_int)
<


☆関数 *style-functions*

関数宣言は、戻り値の型を別のインデントされた行に記述して使用する:
Expand Down
98 changes: 29 additions & 69 deletions en/develop.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*develop.txt* For Vim version 9.1. Last change: 2025 Apr 18
*develop.txt* For Vim version 9.1. Last change: 2025 May 05


VIM REFERENCE MANUAL by Bram Moolenaar
Expand Down Expand Up @@ -215,7 +215,7 @@ them:
- flexible array members: Not supported by HP-UX C compiler (John Marriott)


COMMENTS *style-comments*
COMMENTS *style-comments*

Try to avoid putting multiline comments inside a function body: if the
function is so complex that you need to separately comment parts of it, you
Expand All @@ -230,16 +230,15 @@ For everything else use: >
// comment
<


INDENTATION *style-indentation*
INDENTATION *style-indentation*

We use 4 space to indent the code. If you are using Vim to edit the source,
you don't need to do anything due to the |modeline|.

For other editors an `.editorconfig` is provided at the root of the repo.


DECLARATIONS *style-declarations*
DECLARATIONS *style-declarations*

Declare, when possible, `for` loop variables in the guard:
OK: >
Expand All @@ -259,114 +258,76 @@ Wrong: >
int *ptr;
<


BRACES *style-braces*
BRACES *style-braces*

All curly braces must be returned onto a new line:
OK: >
if (cond)
{
cmd;
cmd;
cmd;
cmd;
}
else
{
cmd;
cmd;
cmd;
cmd;
}
<
Wrong: >
if (cond) {
cmd;
cmd;
cmd;
cmd;
} else {
cmd;
cmd;
cmd;
cmd;
}
<
OK: >
while (cond)
{
cmd;
cmd;
}
<
Wrong: >
while (cond) {
cmd;
cmd;
}
<
When a block has one line, including comments, the braces can be left out.
OK: >
if (cond)
cmd;
else
cmd;
<
Wrong: >
if (cond)
/*
* comment
*/
do
{
cmd;
else
cmd;
} while (cond);
<
When an `if`/`else` has braces on one block, the other should have it too.
OK: >
if (cond)
{
cmd;
}
else
or >
do
{
cmd;
cmd;
}
while (cond);
<
Wrong: >
if (cond)
cmd;
else
{
cmd;
cmd;
}

if (cond)
{
cmd;
cmd;
}
else
do {
cmd;
<
OK: >
while (cond)
cmd;
} while (cond);
<
Wrong:
>
while (cond)
if (cond)
cmd;
<


TYPES *style-types*

Use descriptive types. You can find a list of them in the src/structs.h file
and probably in a typedef in the file you are working on.

Use descriptive types. These are defined in src/vim.h, src/structs.h etc.
Note that all custom types are postfixed with "_T"

OK: >
int is_valid_line_number(linenr_T lnum);
<
Wrong: >
int is_valid_line_number(unsigned long lnum);
Example: >
linenr_T
buf_T
pos_T
<


SPACES AND PUNCTUATION *style-spaces*

No space between a function name and the bracket:
Expand All @@ -386,8 +347,8 @@ Wrong: func(arg1,arg2); for (i = 0;i < 2;++i)

Use a space before and after '=', '+', '/', etc.

Wrong: var=a*5;
OK: var = a * 5;
Wrong: var=a*5;

Use empty lines to group similar actions together.

Expand All @@ -412,7 +373,6 @@ Wrong: >
while (buf != NULL && !got_int)
<


FUNCTIONS *style-functions*

Use function declarations with the return type on a separate indented line.
Expand Down