Skip to content

Commit 2ea6e2d

Browse files
committed
Highlight commit message
Added rules to hightlight commit message the same way like original git command with enabled colors does. First 50 characters on first line are marked as title, whole second line should be empty.
1 parent 03e4103 commit 2ea6e2d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

syntax/git-status.vim

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
runtime syntax/diff.vim
22
setlocal filetype=
33

4+
" match first 50 characters on first line, unless it starts with #
5+
syntax match gitCommitHeader +^[^#]\%1l.\{1,50}+
6+
" match everything on line 2 if first character is not #
7+
syntax match gitCommitEmptyLine +^[^#]\%2l.*+
8+
49
syntax match gitStatusComment +^#.*+ contains=ALL
510

611
syntax match gitStatusBranch +On branch .\++
@@ -9,6 +14,9 @@ syntax match gitStatusUndracked +\t\zs.\++
914
syntax match gitStatusNewFile +\t\zsnew file: .\++
1015
syntax match gitStatusModified +\t\zsmodified: .\++
1116

17+
highlight link gitCommitHeader Title
18+
highlight link gitCommitEmptyLine Error
19+
1220
highlight link gitStatusComment Comment
1321

1422
highlight link gitStatusBranch Title

0 commit comments

Comments
 (0)