-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
contrib/vim: add syntax highlighting file for commits
Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
- Loading branch information
Jeff King
authored and
Junio C Hamano
committed
Sep 13, 2006
1 parent
6d24892
commit cdad8bb
Showing
2 changed files
with
26 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
To syntax highlight git's commit messages, you need to: | ||
1. Copy syntax/gitcommit.vim to vim's syntax directory: | ||
$ mkdir -p $HOME/.vim/syntax | ||
$ cp syntax/gitcommit.vim $HOME/.vim/syntax | ||
2. Auto-detect the editing of git commit files: | ||
$ cat >>$HOME/.vimrc <<'EOF' | ||
autocmd BufNewFile,BufRead COMMIT_EDITMSG set filetype=gitcommit | ||
EOF |
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,18 @@ | ||
syn region gitLine start=/^#/ end=/$/ | ||
syn region gitCommit start=/^# Updated but not checked in:$/ end=/^#$/ contains=gitHead,gitCommitFile | ||
syn region gitHead contained start=/^# (.*)/ end=/^#$/ | ||
syn region gitChanged start=/^# Changed but not updated:/ end=/^#$/ contains=gitHead,gitChangedFile | ||
syn region gitUntracked start=/^# Untracked files:/ end=/^#$/ contains=gitHead,gitUntrackedFile | ||
|
||
syn match gitCommitFile contained /^#\t.*/hs=s+2 | ||
syn match gitChangedFile contained /^#\t.*/hs=s+2 | ||
syn match gitUntrackedFile contained /^#\t.*/hs=s+2 | ||
|
||
hi def link gitLine Comment | ||
hi def link gitCommit Comment | ||
hi def link gitChanged Comment | ||
hi def link gitHead Comment | ||
hi def link gitUntracked Comment | ||
hi def link gitCommitFile Type | ||
hi def link gitChangedFile Constant | ||
hi def link gitUntrackedFile Constant |