search
尋找貓咪~QQ 地點 桃園市桃園區 Taoyuan , Taoyuan

EditorConfig – 佛祖球球

EditorConfig

當一個團隊進行一個專案開發時,Coding Style 是最頭痛的一件事,常常依靠許多工具及流程才有辦法防治。與其透過外部防治,不如先從自己做起。

EditorConfig 就是專門解決這種問題的,只要在專案加上 .editorconfig 設定檔就可以協助解決 Coding Style 的問題。

Installation

Notice:EditorConfig 在一些編輯器是預設就有的,本篇是以 Vim 為例,因此需要另外安裝。

EditorConfig 可以透過 Vundle 安裝在 Vim 裡。

.vimrc

Plugin 'editorconfig/editorconfig-vim'

Install

:PluginInstall

Config

.editorconfig 是一個 INI 格式檔 的設定檔,可以定義針對被套用的路徑或副檔名格式的需求。

基本範例

; 專案最上層的設定檔
root = true

[*]
; 縮排類型
indent_style = space
; 縮排長度
indent_size = 4

; 副檔名為 .php 的設定
[*.php]
indent_style = space
indent_size = 4

[*.css]
indent_style = space
indent_size = 2

[*.scss]
indent_style = space
indent_size = 2

[*.sass]
indent_style = space
indent_size = 2

[*.js]
indent_style = space
indent_size = 2
Categories: Vim
Tags: EditorVim



熱門推薦

本文由 blogjohnsonluorg 提供 原文連結

寵物協尋 相信 終究能找到回家的路
寫了7763篇文章,獲得2次喜歡
留言回覆
回覆
精彩推薦