Permalink
Browse files

Close #50 PR: Add a snippet for EditorConfig file content.

  • Loading branch information...
1 parent 07b8896 commit 8dd0bf7dc403068acd3b95e36beba554f2bb1e4a @kipit kipit committed with Jan 16, 2016
Showing with 23 additions and 0 deletions.
  1. +15 −0 editorconfig.sublime-snippet
  2. +8 −0 readme.md
@@ -0,0 +1,15 @@
+<snippet>
+ <content><![CDATA[
+root = true
+
+[*]
+${1/(^$)|.*/?1:# tab | space\n/i}indent_style = ${1:tab}${1/(t$)|(s$)|(ta$)|(sp$)|.*/?1:ab:?2:pace:?3:b:?4:ace/i}
+${2/(^$)|.*/?1:# /}indent_size = ${2:}
+${3/(^$)|.*/?1:# lf | crlf\n/i}end_of_line = ${3:lf}${3/(l$)|(c$)|.*/?1:f:?2:rlf/i}
+${4/(^$)|.*/?1:# latin1 | utf-8 | utf-8-bom | utf-16be | utf-16le\n/i}charset = ${4:utf-8}${4/(l$)|(u$)|(la$)|(ut$)|.*/(?1:atin1:)(?2:tf-8:)(?3:tin1:)(?4:f-8)/i}
+${5/(^$)|.*/?1:# true | false\n/i}trim_trailing_whitespace = ${5:true}${5/(t$)|(f$)|(tr$)|(fa$)|.*/?1:rue:?2:alse:?3:ue:?4:lse/i}
+${6/(^$)|.*/?1:# true | false\n/i}insert_final_newline = ${6:true}${6/(t$)|(f$)|(tr$)|(fa$)|.*/?1:rue:?2:alse:?3:ue:?4:lse/i}
+]]></content>
+ <tabTrigger>editorconfig</tabTrigger>
+ <scope>source.ini.editorconfig,text.plain</scope>
+</snippet>
View
@@ -48,6 +48,14 @@ trim_trailing_whitespace = false
## Tips
+### EditorConfig snippet
+
+If you can't remember all settings managed by the EditorConfig file, you'll love the `editorconfig` snippet.
+
+Just type `editorconfig` + <kbd>tab</kbd>, and your editor will focus on the first setting's value (indent_style = *lf*). You can change the value, if you want, and jump to the next setting's value by hitting <kbd>tab</kbd> and so on. Settings are somewhat autocompleted, and if you don't remember all possible values, simply remove the setting value to see them all as a comment.
+
+You can be in a context where `editorconfig` + <kbd>tab</kbd> trigger another snippet. In that case, simply use `Goto anywhere` (<kbd>Ctrl</kbd> + <kbd>P</kbd> on Linux/Windows or <kbd>⌘</kbd> + <kbd>P</kbd> on OSX), type `editorconfig`, select `Snippet: editorconfig` and hit <kbd>Enter</kbd>.
+
### View active config
The active config is printed in the Sublime console.

0 comments on commit 8dd0bf7

Please sign in to comment.