0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

EditorConfigの設定方法

Posted at

はじめに

EditorConfigを利用することで複数のテキストエディタやIDEでインデントや改行コードなどの設定を共有することができます。
設定は.editorconfigに記述します。
この.editorconfigの記述方法について記載します。

なおVSCodeの場合には、以下の拡張機能をインストールすることで使用可能です。

スクリーンショット 2022-05-11 午前4.04.12.png

.editorconfigの記述方法

以下のように記述します。

.editorconfig
root = true

[*]
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

設定できる主な項目は以下のとおりです。

設定名 説明
[...] 対象ファイルを指定。
root trueにすることで.editorconfig以下のディレクトリに設定を適用する。
end_of_line 改行コードを指定する。lf,cr,crlfから選択。
indent_style ハードタブかソフトタブかを指定。tab , spaceから選択。
indent_size インデントのサイズを指定。2 , 4から選択。
charset 文字コードを指定。latin1 , utf-8 , utf-8-bom , utf-16be , utf-16leから選択。
tab_width タブの幅を指定する。省略するとindent_sizeが適用される。
trim_trailing_whitespace 行末の空白を削除。
insert_final_newline ファイルの末尾が改行ではない場合に補完。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?