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>
Jeff King committed
Sep 11, 2006 at 19:22 UTC
cdad8bbe92a447233133be8f9f3015c1bd7e10eb
2 files changed
+26
contrib/vim/README
new
+8
@@ -0,0 +1,8 @@
1
+To syntax highlight git's commit messages, you need to:
2
+ 1. Copy syntax/gitcommit.vim to vim's syntax directory:
3
+ $ mkdir -p $HOME/.vim/syntax
4
+ $ cp syntax/gitcommit.vim $HOME/.vim/syntax
5
+ 2. Auto-detect the editing of git commit files:
6
+ $ cat >>$HOME/.vimrc <<'EOF'
7
+ autocmd BufNewFile,BufRead COMMIT_EDITMSG set filetype=gitcommit
8
+ EOF
contrib/vim/syntax/gitcommit.vim
new
+18
@@ -0,0 +1,18 @@
1
+syn region gitLine start=/^#/ end=/$/
2
+syn region gitCommit start=/^# Updated but not checked in:$/ end=/^#$/ contains=gitHead,gitCommitFile
3
+syn region gitHead contained start=/^# (.*)/ end=/^#$/
4
+syn region gitChanged start=/^# Changed but not updated:/ end=/^#$/ contains=gitHead,gitChangedFile
5
+syn region gitUntracked start=/^# Untracked files:/ end=/^#$/ contains=gitHead,gitUntrackedFile
6
+
7
+syn match gitCommitFile contained /^#\t.*/hs=s+2
8
+syn match gitChangedFile contained /^#\t.*/hs=s+2
9
+syn match gitUntrackedFile contained /^#\t.*/hs=s+2
10
+
11
+hi def link gitLine Comment
12
+hi def link gitCommit Comment
13
+hi def link gitChanged Comment
14
+hi def link gitHead Comment
15
+hi def link gitUntracked Comment
16
+hi def link gitCommitFile Type
17
+hi def link gitChangedFile Constant
18
+hi def link gitUntrackedFile Constant