Skip to content

Commit

Permalink
Close #50 PR: Add a snippet for EditorConfig file content.
Browse files Browse the repository at this point in the history
  • Loading branch information
kipit authored and sindresorhus committed Jan 16, 2016
1 parent 07b8896 commit 8dd0bf7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
15 changes: 15 additions & 0 deletions editorconfig.sublime-snippet
Original file line number Diff line number Diff line change
@@ -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>
8 changes: 8 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 8dd0bf7

Please sign in to comment.