-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
335 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,50 @@ | ||
# Sublime Text git Commit Message Syntax | ||
# Git Syntaxes | ||
Syntax Highlighting for SublimeText | ||
|
||
Syntax Highlighting for SublimeText / Text Mate | ||
 | ||
|
||
## How to make commits with Sublime Text | ||
For the following options, you'll need to use the appropriate command from below: | ||
**Note** for Windows, you must have `Build 3065` or lated to have command line support | ||
# Features | ||
* Highlight all Git files (gitconfig, gitattributes, commit message, interactive rebase todo) | ||
* Toggle comments in all files above with default keystroke whatever it is (usually <kbd>ctrl+/</kbd>) | ||
* Many scopes, e.g. you can set separate colour for every command in rebase file (i.e. `pick`, `fixup`, etc.) | ||
|
||
- Mac / Linux: `subl -w` | ||
- Windows: `subl.exe -w` | ||
## How to use ST as editor for Git | ||
**Note** for Windows, you must have `Build 3065` or lated to have command line support, Or just add folder into `PATH` and call `sublime_text` instead of `subl` | ||
|
||
- Mac / Linux: `subl -n -w` | ||
- Windows: `subl.exe -n -w` | ||
|
||
### Preferred Method: Edit `.bashrc` | ||
This will allow for more editing options than just the git commit, like editing diffs. This also leaves flexibility as it can be easily overridden, by the `.gitconfig` for example. | ||
Add the following to your `.bashrc`: | ||
On Mac and Linux: | ||
|
||
``` | ||
export EDITOR="subl -w" | ||
export EDITOR="subl -n -w" | ||
``` | ||
|
||
### Alternate Method: Ammend your `.gitconfig` | ||
You can run the following command to let git update your `.gitconfig` | ||
|
||
``` | ||
git config --global core.editor 'subl -w' | ||
git config --global core.editor 'subl -n -w' | ||
``` | ||
|
||
Or add the following line manually to your `.gitconfig` | ||
``` | ||
[core] | ||
editor = 'subl -w' | ||
editor = 'subl -n -w' | ||
``` | ||
|
||
You also can hide menu (as on screenshot above) and tabs: | ||
|
||
editor = "sublime_text -n -w --command toggle_menu --command toggle_tabs" | ||
|
||
|
||
## Credits | ||
* Base for Config definitions is borrowed from <https://github.com/textmate/git.tmbundle> | ||
* Commit definitions are borrowed from <https://github.com/adambullmer/sublime_git_commit_syntax> | ||
|
||
<hr> | ||
|
||
All sources under [MIT](LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# [PackageDev] target_format: plist, ext: tmLanguage | ||
--- | ||
name: Git Config | ||
scopeName: text.git.config | ||
fileTypes: [.git/config, git/config, .gitconfig, etc/gitconfig, .gitmodules, .gitattributes] | ||
uuid: 8c0801ac-9327-4672-b410-323e690f84a5 | ||
|
||
patterns: | ||
- include: '#section' | ||
|
||
- include: '#comment' | ||
|
||
- include: '#attributes' | ||
|
||
repository: | ||
comment: | ||
match: ((#).*$\n?)|((;).*$\n?) | ||
captures: | ||
'1': {name: comment.line.number-sign.git-config} | ||
'2': {name: punctuation.definition.comment.git-config} | ||
'3': {name: comment.line.semi-colon.git-config} | ||
'4': {name: punctuation.definition.comment.git-config} | ||
|
||
boolean: | ||
name: constant.language.boolean.git-config | ||
match: \b(?i:yes|no|0|1|true|false)\b | ||
|
||
section: | ||
name: meta.section.git-config | ||
begin: \[\s*([\w_-]+)(?:\s+((")(?:[^"\\]|\\["\\])*("))|\.([\w_-]+))?\s*\] | ||
end: (?=\[) | ||
captures: | ||
'1': {name: entity.name.section.git-config} | ||
'2': {name: string.name.section.subsection.git-config} | ||
'3': {name: punctuation.definition.section.subsection.begin.git-config} | ||
'4': {name: punctuation.definition.section.subsection.end.git-config} | ||
'5': {name: entity.name.section.subsection.git-config} | ||
patterns: | ||
- include: '#value_pair' | ||
- include: '#comment' | ||
|
||
string: | ||
name: string.quoted.double.git-config | ||
begin: '"' | ||
beginCaptures: | ||
'0': {name: punctuation.definition.string.begin.git-config} | ||
end: '"' | ||
endCaptures: | ||
'0': {name: punctuation.definition.string.end.git-config} | ||
patterns: | ||
- name: constant.character.escape.git-config | ||
match: \\[ntb"\\] | ||
- name: invalid.illegal.unknown-escape.git-config | ||
match: \\. | ||
|
||
value_pair: | ||
name: meta.value-pair.section-item.git-config | ||
begin: ([-\w]+)\s*(=)\s*(?!$) | ||
end: $|(?=[#;]) | ||
captures: | ||
'1': {name: key.support.constant.git-config} | ||
'2': {name: keyword.operator.assignment.git-config} | ||
patterns: | ||
- name: constant.character.escape.git-config | ||
match: \\[ntb"\\] | ||
- include: '#boolean' | ||
- include: '#string' | ||
- include: '#comment' | ||
- name: string.value.git-config | ||
match: '[^\n]+' | ||
|
||
attributes: | ||
name: meta.attributes.git-config | ||
begin: ^([\*\S]+)(?=(?!=)\s*(?!=)(\S+)($|(?=[#;]))) | ||
end: $|(?=[#;]) | ||
captures: | ||
'1': {name: keyword.attributes-pattern.git-config} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,228 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>fileTypes</key> | ||
<array> | ||
<string>.git/config</string> | ||
<string>git/config</string> | ||
<string>.gitconfig</string> | ||
<string>etc/gitconfig</string> | ||
<string>.gitmodules</string> | ||
<string>.gitattributes</string> | ||
</array> | ||
<key>name</key> | ||
<string>Git Config</string> | ||
<key>patterns</key> | ||
<array> | ||
<dict> | ||
<key>include</key> | ||
<string>#section</string> | ||
</dict> | ||
<dict> | ||
<key>include</key> | ||
<string>#comment</string> | ||
</dict> | ||
<dict> | ||
<key>include</key> | ||
<string>#attributes</string> | ||
</dict> | ||
</array> | ||
<key>repository</key> | ||
<dict> | ||
<key>attributes</key> | ||
<dict> | ||
<key>begin</key> | ||
<string>^([\*\S]+)(?=(?!=)\s*(?!=)(\S+)($|(?=[#;])))</string> | ||
<key>captures</key> | ||
<dict> | ||
<key>1</key> | ||
<dict> | ||
<key>name</key> | ||
<string>keyword.attributes-pattern.git-config</string> | ||
</dict> | ||
</dict> | ||
<key>end</key> | ||
<string>$|(?=[#;])</string> | ||
<key>name</key> | ||
<string>meta.attributes.git-config</string> | ||
</dict> | ||
<key>boolean</key> | ||
<dict> | ||
<key>match</key> | ||
<string>\b(?i:yes|no|0|1|true|false)\b</string> | ||
<key>name</key> | ||
<string>constant.language.boolean.git-config</string> | ||
</dict> | ||
<key>comment</key> | ||
<dict> | ||
<key>captures</key> | ||
<dict> | ||
<key>1</key> | ||
<dict> | ||
<key>name</key> | ||
<string>comment.line.number-sign.git-config</string> | ||
</dict> | ||
<key>2</key> | ||
<dict> | ||
<key>name</key> | ||
<string>punctuation.definition.comment.git-config</string> | ||
</dict> | ||
<key>3</key> | ||
<dict> | ||
<key>name</key> | ||
<string>comment.line.semi-colon.git-config</string> | ||
</dict> | ||
<key>4</key> | ||
<dict> | ||
<key>name</key> | ||
<string>punctuation.definition.comment.git-config</string> | ||
</dict> | ||
</dict> | ||
<key>match</key> | ||
<string>((#).*$\n?)|((;).*$\n?)</string> | ||
</dict> | ||
<key>section</key> | ||
<dict> | ||
<key>begin</key> | ||
<string>\[\s*([\w_-]+)(?:\s+((")(?:[^"\\]|\\["\\])*("))|\.([\w_-]+))?\s*\]</string> | ||
<key>captures</key> | ||
<dict> | ||
<key>1</key> | ||
<dict> | ||
<key>name</key> | ||
<string>entity.name.section.git-config</string> | ||
</dict> | ||
<key>2</key> | ||
<dict> | ||
<key>name</key> | ||
<string>string.name.section.subsection.git-config</string> | ||
</dict> | ||
<key>3</key> | ||
<dict> | ||
<key>name</key> | ||
<string>punctuation.definition.section.subsection.begin.git-config</string> | ||
</dict> | ||
<key>4</key> | ||
<dict> | ||
<key>name</key> | ||
<string>punctuation.definition.section.subsection.end.git-config</string> | ||
</dict> | ||
<key>5</key> | ||
<dict> | ||
<key>name</key> | ||
<string>entity.name.section.subsection.git-config</string> | ||
</dict> | ||
</dict> | ||
<key>end</key> | ||
<string>(?=\[)</string> | ||
<key>name</key> | ||
<string>meta.section.git-config</string> | ||
<key>patterns</key> | ||
<array> | ||
<dict> | ||
<key>include</key> | ||
<string>#value_pair</string> | ||
</dict> | ||
<dict> | ||
<key>include</key> | ||
<string>#comment</string> | ||
</dict> | ||
</array> | ||
</dict> | ||
<key>string</key> | ||
<dict> | ||
<key>begin</key> | ||
<string>"</string> | ||
<key>beginCaptures</key> | ||
<dict> | ||
<key>0</key> | ||
<dict> | ||
<key>name</key> | ||
<string>punctuation.definition.string.begin.git-config</string> | ||
</dict> | ||
</dict> | ||
<key>end</key> | ||
<string>"</string> | ||
<key>endCaptures</key> | ||
<dict> | ||
<key>0</key> | ||
<dict> | ||
<key>name</key> | ||
<string>punctuation.definition.string.end.git-config</string> | ||
</dict> | ||
</dict> | ||
<key>name</key> | ||
<string>string.quoted.double.git-config</string> | ||
<key>patterns</key> | ||
<array> | ||
<dict> | ||
<key>match</key> | ||
<string>\\[ntb"\\]</string> | ||
<key>name</key> | ||
<string>constant.character.escape.git-config</string> | ||
</dict> | ||
<dict> | ||
<key>match</key> | ||
<string>\\.</string> | ||
<key>name</key> | ||
<string>invalid.illegal.unknown-escape.git-config</string> | ||
</dict> | ||
</array> | ||
</dict> | ||
<key>value_pair</key> | ||
<dict> | ||
<key>begin</key> | ||
<string>([-\w]+)\s*(=)\s*(?!$)</string> | ||
<key>captures</key> | ||
<dict> | ||
<key>1</key> | ||
<dict> | ||
<key>name</key> | ||
<string>key.support.constant.git-config</string> | ||
</dict> | ||
<key>2</key> | ||
<dict> | ||
<key>name</key> | ||
<string>keyword.operator.assignment.git-config</string> | ||
</dict> | ||
</dict> | ||
<key>end</key> | ||
<string>$|(?=[#;])</string> | ||
<key>name</key> | ||
<string>meta.value-pair.section-item.git-config</string> | ||
<key>patterns</key> | ||
<array> | ||
<dict> | ||
<key>match</key> | ||
<string>\\[ntb"\\]</string> | ||
<key>name</key> | ||
<string>constant.character.escape.git-config</string> | ||
</dict> | ||
<dict> | ||
<key>include</key> | ||
<string>#boolean</string> | ||
</dict> | ||
<dict> | ||
<key>include</key> | ||
<string>#string</string> | ||
</dict> | ||
<dict> | ||
<key>include</key> | ||
<string>#comment</string> | ||
</dict> | ||
<dict> | ||
<key>match</key> | ||
<string>[^\n]+</string> | ||
<key>name</key> | ||
<string>string.value.git-config</string> | ||
</dict> | ||
</array> | ||
</dict> | ||
</dict> | ||
<key>scopeName</key> | ||
<string>text.git.config</string> | ||
<key>uuid</key> | ||
<string>8c0801ac-9327-4672-b410-323e690f84a5</string> | ||
</dict> | ||
</plist> |