{"id":2535,"date":"2018-12-14T08:29:50","date_gmt":"2018-12-14T00:29:50","guid":{"rendered":"https:\/\/damogame.cn:15443\/wordpress\/?p=2535"},"modified":"2018-12-14T13:50:42","modified_gmt":"2018-12-14T05:50:42","slug":"%e7%bb%9f%e4%b8%80%e4%bb%a3%e7%a0%81%e9%a3%8e%e6%a0%bc%e5%b7%a5%e5%85%b7-editorconfig","status":"publish","type":"post","link":"https:\/\/i007.cc\/wordpress\/archives\/2535","title":{"rendered":"\u7edf\u4e00\u4ee3\u7801\u98ce\u683c\u5de5\u5177\u2014\u2014editorConfig \uff08\u6b63\u5728\u4f7f\u7528\uff09"},"content":{"rendered":"<div class=\"clear\">\u524d\u9762\u7684\u8bdd<\/div>\n<div class=\"postBody\">\n<div id=\"cnblogs_post_body\" class=\"blogpost-body\">\n<p>\u3000\u3000\u5728\u56e2\u961f\u5f00\u53d1\u4e2d\uff0c\u7edf\u4e00\u7684\u4ee3\u7801\u683c\u5f0f\u662f\u5fc5\u8981\u7684\u3002\u4f46\u662f\u4e0d\u540c\u5f00\u53d1\u4eba\u5458\u7684\u4ee3\u7801\u98ce\u683c\u4e0d\u540c\uff0c\u4ee3\u7801\u7f16\u8f91\u5de5\u5177\u7684\u9ed8\u8ba4\u683c\u5f0f\u4e5f\u4e0d\u76f8\u540c\uff0c\u8fd9\u6837\u5c31\u9020\u6210\u4ee3\u7801\u7684differ\u3002\u800ceditorConfig\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u4eba\u5458\u5728\u4e0d\u540c\u7684\u7f16\u8f91\u5668\u548cIDE\u4e2d\u5b9a\u4e49\u548c\u7ef4\u62a4\u4e00\u81f4\u7684\u7f16\u7801\u98ce\u683c\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u7edf\u4e00\u4ee3\u7801\u98ce\u683c\u5de5\u5177editorConfig<\/p>\n<p>&nbsp;<\/p>\n<h3 id=\"anchor1\">\u6982\u8ff0<\/h3>\n<p>editorConfig\u4e0d\u662f\u4ec0\u4e48\u8f6f\u4ef6\uff0c\u800c\u662f\u4e00\u4e2a\u540d\u79f0\u4e3a.editorconfig\u7684\u81ea\u5b9a\u4e49\u6587\u4ef6\u3002\u8be5\u6587\u4ef6\u7528\u6765\u5b9a\u4e49\u9879\u76ee\u7684\u7f16\u7801\u89c4\u8303\uff0c\u7f16\u8f91\u5668\u7684\u884c\u4e3a\u4f1a\u4e0e.editorconfig \u6587\u4ef6\u4e2d\u5b9a\u4e49\u7684\u4e00\u81f4\uff0c\u5e76\u4e14\u5176\u4f18\u5148\u7ea7\u6bd4\u7f16\u8f91\u5668\u81ea\u8eab\u7684\u8bbe\u7f6e\u8981\u9ad8\uff0c\u8fd9\u5728\u591a\u4eba\u5408\u4f5c\u5f00\u53d1\u9879\u76ee\u65f6\u5341\u5206\u6709\u7528\u800c\u4e14\u5fc5\u8981<\/p>\n<p>\u6709\u4e9b\u7f16\u8f91\u5668\u9ed8\u8ba4\u652f\u6301editorConfig\uff0c\u5982webstorm\uff1b\u800c\u6709\u4e9b\u7f16\u8f91\u5668\u5219\u9700\u8981\u5b89\u88c5editorConfig\u63d2\u4ef6\uff0c\u5982ATOM\u3001Sublime\u3001VS Code\u7b49<\/p>\n<p>\u5f53\u6253\u5f00\u4e00\u4e2a\u6587\u4ef6\u65f6\uff0cEditorConfig\u63d2\u4ef6\u4f1a\u5728\u6253\u5f00\u6587\u4ef6\u7684\u76ee\u5f55\u548c\u5176\u6bcf\u4e00\u7ea7\u7236\u76ee\u5f55\u67e5\u627e.editorconfig\u6587\u4ef6\uff0c\u76f4\u5230\u6709\u4e00\u4e2a\u914d\u7f6e\u6587\u4ef6root=true<\/p>\n<p>EditorConfig\u7684\u914d\u7f6e\u6587\u4ef6\u662f\u4ece\u4e0a\u5f80\u4e0b\u8bfb\u53d6\u7684\u5e76\u4e14\u6700\u8fd1\u7684EditorConfig\u914d\u7f6e\u6587\u4ef6\u4f1a\u88ab\u6700\u5148\u8bfb\u53d6. \u5339\u914dEditorConfig\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u914d\u7f6e\u9879\u4f1a\u6309\u7167\u8bfb\u53d6\u987a\u5e8f\u88ab\u5e94\u7528, \u6240\u4ee5\u6700\u8fd1\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u914d\u7f6e\u9879\u62e5\u6709\u4f18\u5148\u6743<\/p>\n<p>\u5982\u679c.editorconfig\u6587\u4ef6\u6ca1\u6709\u8fdb\u884c\u67d0\u4e9b\u914d\u7f6e\uff0c\u5219\u4f7f\u7528\u7f16\u8f91\u5668\u9ed8\u8ba4\u7684\u8bbe\u7f6e<\/p>\n<p>&nbsp;<\/p>\n<h3 id=\"anchor2\">\u6587\u4ef6\u8bed\u6cd5<\/h3>\n<p>editorConfig\u914d\u7f6e\u6587\u4ef6\u9700\u8981\u662fUTF-8\u5b57\u7b26\u96c6\u7f16\u7801\u7684, \u4ee5\u56de\u8f66\u6362\u884c\u6216\u6362\u884c\u4f5c\u4e3a\u4e00\u884c\u7684\u5206\u9694\u7b26<\/p>\n<p>\u659c\u7ebf(\/)\u88ab\u7528\u4f5c\u4e3a\u4e00\u4e2a\u8def\u5f84\u5206\u9694\u7b26\uff0c\u4e95\u53f7(#)\u6216\u5206\u53f7(;)\u88ab\u7528\u4f5c\u4e8e\u6ce8\u91ca. \u6ce8\u91ca\u9700\u8981\u4e0e\u6ce8\u91ca\u7b26\u53f7\u5199\u5728\u540c\u4e00\u884c<\/p>\n<p>\u3010\u901a\u914d\u7b26\u3011<\/p>\n<div class=\"cnblogs_code\">\n<div class=\"cnblogs_code_toolbar\"><span class=\"cnblogs_code_copy\"><a title=\"\u590d\u5236\u4ee3\u7801\"><img decoding=\"async\" src=\"https:\/\/common.cnblogs.com\/images\/copycode.gif\" alt=\"\u590d\u5236\u4ee3\u7801\" \/><\/a><\/span><\/div>\n<pre>*                \u5339\u914d\u9664\/\u4e4b\u5916\u7684\u4efb\u610f\u5b57\u7b26\u4e32\r\n**               \u5339\u914d\u4efb\u610f\u5b57\u7b26\u4e32\r\n?                \u5339\u914d\u4efb\u610f\u5355\u4e2a\u5b57\u7b26\r\n[name]           \u5339\u914dname\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\u5355\u4e00\u5b57\u7b26\r\n[!name]          \u5339\u914d\u4e0d\u5b58\u5728name\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\u5355\u4e00\u5b57\u7b26\r\n{s1,s2,s3}       \u5339\u914d\u7ed9\u5b9a\u7684\u5b57\u7b26\u4e32\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a(\u7528\u9017\u53f7\u5206\u9694) \r\n{num1..num2}   \u3000\u5339\u914dnum1\u5230num2\u4e4b\u95f4\u7684\u4efb\u610f\u4e00\u4e2a\u6574\u6570, \u8fd9\u91cc\u7684num1\u548cnum2\u53ef\u4ee5\u4e3a\u6b63\u6574\u6570\u4e5f\u53ef\u4ee5\u4e3a\u8d1f\u6574\u6570<\/pre>\n<div class=\"cnblogs_code_toolbar\"><span class=\"cnblogs_code_copy\"><a title=\"\u590d\u5236\u4ee3\u7801\"><img decoding=\"async\" src=\"https:\/\/common.cnblogs.com\/images\/copycode.gif\" alt=\"\u590d\u5236\u4ee3\u7801\" \/><\/a><\/span><\/div>\n<\/div>\n<p>\u3010\u5c5e\u6027\u3011<\/p>\n<p>\u6240\u6709\u7684\u5c5e\u6027\u548c\u503c\u90fd\u662f\u5ffd\u7565\u5927\u5c0f\u5199\u7684. \u89e3\u6790\u65f6\u5b83\u4eec\u90fd\u662f\u5c0f\u5199\u7684<\/p>\n<div class=\"cnblogs_code\">\n<div class=\"cnblogs_code_toolbar\"><span class=\"cnblogs_code_copy\"><a title=\"\u590d\u5236\u4ee3\u7801\"><img decoding=\"async\" src=\"https:\/\/common.cnblogs.com\/images\/copycode.gif\" alt=\"\u590d\u5236\u4ee3\u7801\" \/><\/a><\/span><\/div>\n<pre>indent_style    \u8bbe\u7f6e\u7f29\u8fdb\u98ce\u683c(tab\u662f\u786c\u7f29\u8fdb\uff0cspace\u4e3a\u8f6f\u7f29\u8fdb)\r\nindent_size     \u7528\u4e00\u4e2a\u6574\u6570\u5b9a\u4e49\u7684\u5217\u6570\u6765\u8bbe\u7f6e\u7f29\u8fdb\u7684\u5bbd\u5ea6\uff0c\u5982\u679cindent_style\u4e3atab\uff0c\u5219\u6b64\u5c5e\u6027\u9ed8\u8ba4\u4e3atab_width\r\ntab_width       \u7528\u4e00\u4e2a\u6574\u6570\u6765\u8bbe\u7f6etab\u7f29\u8fdb\u7684\u5217\u6570\u3002\u9ed8\u8ba4\u662findent_size\r\nend_of_line     \u8bbe\u7f6e\u6362\u884c\u7b26\uff0c\u503c\u4e3alf\u3001cr\u548ccrlf\r\ncharset         \u8bbe\u7f6e\u7f16\u7801\uff0c\u503c\u4e3alatin1\u3001utf-8\u3001utf-8-bom\u3001utf-16be\u548cutf-16le\uff0c\u4e0d\u5efa\u8bae\u4f7f\u7528utf-8-bom\r\ntrim_trailing_whitespace  \u8bbe\u4e3atrue\u8868\u793a\u4f1a\u53bb\u9664\u6362\u884c\u884c\u9996\u7684\u4efb\u610f\u7a7a\u767d\u5b57\u7b26\u3002\r\ninsert_final_newline      \u8bbe\u4e3atrue\u8868\u793a\u4f7f\u6587\u4ef6\u4ee5\u4e00\u4e2a\u7a7a\u767d\u884c\u7ed3\u5c3e\r\nroot        \u3000\u3000\u3000\u8868\u793a\u662f\u6700\u9876\u5c42\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u53d1\u73b0\u8bbe\u4e3atrue\u65f6\uff0c\u624d\u4f1a\u505c\u6b62\u67e5\u627e.editorconfig\u6587\u4ef6<\/pre>\n<div class=\"cnblogs_code_toolbar\"><span class=\"cnblogs_code_copy\"><a title=\"\u590d\u5236\u4ee3\u7801\"><img decoding=\"async\" src=\"https:\/\/common.cnblogs.com\/images\/copycode.gif\" alt=\"\u590d\u5236\u4ee3\u7801\" \/><\/a><\/span><\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<h3 id=\"anchor3\">\u5b9e\u4f8b<\/h3>\n<p>\u4e0b\u9762\u7684\u5b9e\u4f8b\u4e2d\u4f7f\u7528 4 \u4e2a\u7a7a\u683c\u6765\u7f29\u8fdb\uff0c\u5e76\u4e0d\u662f\u8bf4\u6309\u4e00\u4e0b\u7a7a\u683c\u4f1a\u81ea\u52a8\u6253\u51fa 4 \u4e2a\u7a7a\u683c\u6765\uff0c\u4e5f\u4e0d\u662f\u8bf4\u8981\u8fde\u6309 4 \u4e0b\u7a7a\u683c\uff1b\u800c\u662f\u6309 tab \u952e\u65f6\uff0c\u7f16\u8f91\u5668\u4f1a\u81ea\u52a8\u8f93\u51fa 4 \u4e2a\u7a7a\u683c\u7684\u5bbd\u5ea6\uff0c\u800c\u4e0d\u662f\u4e4b\u524d\u9ed8\u8ba4\u7684\u5236\u8868\u7b26 (\\t)<\/p>\n<div class=\"cnblogs_code\">\n<div class=\"cnblogs_code_toolbar\"><span class=\"cnblogs_code_copy\"><a title=\"\u590d\u5236\u4ee3\u7801\"><img decoding=\"async\" src=\"https:\/\/common.cnblogs.com\/images\/copycode.gif\" alt=\"\u590d\u5236\u4ee3\u7801\" \/><\/a><\/span><\/div>\n<pre># editorconfig.org\r\n\r\nroot = true\r\n\r\n[*]\r\ncharset = utf-8\r\nindent_size = 4\r\nindent_style = space\r\ninsert_final_newline = true\r\ntrim_trailing_whitespace = true\r\n\r\n\r\n[*.md]\r\ntrim_trailing_whitespace = false<\/pre>\n<div class=\"cnblogs_code_toolbar\"><span class=\"cnblogs_code_copy\"><a title=\"\u590d\u5236\u4ee3\u7801\"><img decoding=\"async\" src=\"https:\/\/common.cnblogs.com\/images\/copycode.gif\" alt=\"\u590d\u5236\u4ee3\u7801\" \/><\/a><\/span><\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<p>\u6211\u6b63\u5728\u4f7f\u7528\u7684editorconfig<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"># editorconfig.org\r\n\r\nroot = true\r\n\r\n[*]\r\ncharset = utf-8\r\nindent_size = 4\r\nindent_style = tab\r\ninsert_final_newline = true\r\ntrim_trailing_whitespace = true\r\n\r\n[*.md]\r\ntrim_trailing_whitespace = false\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u9762\u7684\u8bdd \u3000\u3000\u5728\u56e2\u961f\u5f00\u53d1\u4e2d\uff0c\u7edf\u4e00\u7684\u4ee3\u7801\u683c<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[],"tags":[119],"class_list":["post-2535","post","type-post","status-publish","format-standard","hentry","tag-03-"],"_links":{"self":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/2535","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/comments?post=2535"}],"version-history":[{"count":0,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/2535\/revisions"}],"wp:attachment":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/media?parent=2535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/categories?post=2535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/tags?post=2535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}