Skip to content

Update indent.{txt,jax} #1431

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 2 commits into from
Feb 5, 2024
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
50 changes: 26 additions & 24 deletions doc/indent.jax
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*indent.txt* For Vim バージョン 9.1. Last change: 2023 Dec 05
*indent.txt* For Vim バージョン 9.1. Last change: 2023 Dec 27


VIMリファレンスマニュアル by Bram Moolenaar
Expand Down Expand Up @@ -701,32 +701,34 @@ Clojure のいくつかのフォームは、'lispwords' に依らず、すべて
<
FORTRAN *ft-fortran-indent*

Block if、select case、where、forall 構造がインデントされる。さらに type、
interface、associate、block、enum 構造も。サブルーチン、関数、モジュール、プロ
グラムブロックのインデントは任意。コメント、ラベル付き文、そして2行にまたがっ
た行は、Fortranが自由形式のソースではインデントされるが、一方Fortranが固定形式
ソースの場合には左余白が言語仕様により決定されているのでインデントされない。そ
れ故に固定形式ソースを使っている時にはラベル付き文と2行にまたがった行について
は手動でインデントを修正する必要がある。ソース形式の判定に使われている方法につ
いてのさらなる議論は|ft-fortran-syntax|を参照のこと。
ブロック if、select case、select type、select Rank、where、forall、type、
interface、associate、block、enum、critical、および change team 構造はインデン
トされる。サブルーチン、関数、モジュール、プログラムブロックのインデントは任
意。コメント、ラベル付き文、そして 2 行にまたがった行は、Fortran が自由形式の
ソースではインデントされるが、一方 Fortran が固定形式ソースの場合には左余白が
言語仕様により決定されているのでインデントされない。それ故に固定形式ソースを
使っている時にはラベル付き文と2行にまたがった行については手動でインデントを修
正する必要がある。ソース形式の判定に使われている方法についてのさらなる議論は
|ft-fortran-syntax| を参照のこと。

Doループ ~
デフォルトでは全てのdoループはインデントされない。Fortranでは、ループはラベル
付けされたほとんど任意の型の実行可能な文で(場合によっては多重に)終わるので、do
ループは非構造的になる。これを正しくインデントするにはコンパイラ級の構文解析が
必要になる。任意の型の実行可能文で終わるdoループを持っていたとしても、古いコー
ドであればTidyのように念入りに作られたプログラムでインデントすることはできる。
構造化do/continueループも、continue文がdoループを終了する以外の目的でも使用さ
れるので、インデントせずに残される。Tidyのようなプログラムは構造化do/continue
ループをdo/enddo形式に変換することができる。do/enddoタイプのdoループならばイン
デントすることができる。do/enddoの形の構造化されたループしか使わないのならば、
.vimrcで以下のようにfortran_do_enddo変数を設定してそのことを宣言するべきである:
デフォルトでは全ての do ループはインデントされない。Fortran では、ループはラベ
ル付けされたほとんど任意の型の実行可能な文で (場合によっては多重に) 終わるの
で、do ループは非構造的になる。これを正しくインデントするにはコンパイラ級の構
文解析が必要になる。任意の型の実行可能文で終わる do ループを持っていたとして
も、古いコードであれば Tidy のように念入りに作られたプログラムでインデントする
ことはできる。構造化 do/continue ループも、continue 文が do ループを終了する以
外の目的でも使用されるので、インデントせずに残される。Tidy のようなプログラム
は構造化 do/continue ループを do/enddo 形式に変換することができる。do/enddo タ
イプの do ループならばインデントすることができる。do/enddo の形の構造化された
ループしか使わないのならば、.vimrc で以下のように fortran_do_enddoi 変数を設定
してそのことを宣言するべきである:
>
let fortran_do_enddo=1

このようにすればdoループはインデントされる。例えば拡張子が.f90 であるファイル
の中にある全てのループがdo/enddoタイプだけならば、このようなautocommandを使っ
てのバッファフラグを設定することができる: >
このようにすれば do ループはインデントされる。例えば拡張子が .f90 であるファイ
ルの中にある全てのループが do/enddo タイプだけならば、このような自動コマンドを
使ってのバッファフラグを設定することができる: >

au! BufRead,BufNewFile *.f90 let b:fortran_do_enddo=1

Expand Down Expand Up @@ -1021,8 +1023,8 @@ r_indent_comment_column の値を設定すること。次のようにする:
let r_indent_comment_column = 30
<
行末が "<-" で終わる行に続くコードはインデントされる。Emacs/ESS ではそれがトッ
プレベル関数ならインデントはされない。Emacs/ESS と同じようにインデントしたい場
合は次の設定を |vimrc| に書くこと:
プレベル関数ならインデントはされない。この点で Emacs/ESS のような動作を希望す
る場合は、次の設定を |vimrc| に書くこと:
>
let r_indent_ess_compatible = 1
<
Expand Down
25 changes: 13 additions & 12 deletions en/indent.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*indent.txt* For Vim version 9.1. Last change: 2023 Dec 05
*indent.txt* For Vim version 9.1. Last change: 2023 Dec 27


VIM REFERENCE MANUAL by Bram Moolenaar
Expand Down Expand Up @@ -712,15 +712,16 @@ clojure-mode.el:

FORTRAN *ft-fortran-indent*

Block if, select case, where, and forall constructs are indented. So are
type, interface, associate, block, and enum constructs. The indenting of
subroutines, functions, modules, and program blocks is optional. Comments,
labeled statements, and continuation lines are indented if the Fortran is in
free source form, whereas they are not indented if the Fortran is in fixed
source form because of the left margin requirements. Hence manual indent
corrections will be necessary for labelled statements and continuation lines
when fixed source form is being used. For further discussion of the method
used for the detection of source format see |ft-fortran-syntax|.
Block if, select case, select type, select rank, where, forall, type,
interface, associate, block, enum, critical, and change team constructs are
indented. The indenting of subroutines, functions, modules, and program blocks
is optional. Comments, labeled statements, and continuation lines are indented
if the Fortran is in free source form, whereas they are not indented if the
Fortran is in fixed source form because of the left margin requirements. Hence
manual indent corrections will be necessary for labeled statements and
continuation lines when fixed source form is being used. For further
discussion of the method used for the detection of source format see
|ft-fortran-syntax|.

Do loops ~
All do loops are left unindented by default. Do loops can be unstructured in
Expand Down Expand Up @@ -1040,8 +1041,8 @@ r_indent_comment_column, as in the example below:
let r_indent_comment_column = 30
<
Any code after a line that ends with "<-" is indented. Emacs/ESS does not
indent the code if it is a top level function. If you prefer that the
Vim-R-plugin behaves like Emacs/ESS in this regard, put in your |vimrc|:
indent the code if it is a top-level function. If you prefer a behavior like
Emacs/ESS one in this regard, put in your |vimrc|:
>
let r_indent_ess_compatible = 1
<
Expand Down