-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] git range-diff
syntax support
#89
Comments
Like this? if exists("b:current_syntax")
finish
endif
syn case match
syn match gitrangediffIDL '\v^\s*\zs(\d+|-+):' skipwhite nextgroup=gitrangediffCommitL
syn match gitrangediffCommitL '\v<\x{7,}>|-{7,}' skipwhite contained contains=gitrangediffIDL nextgroup=gitrangediffComp
syn match gitrangediffComp '\m[<=>!] skipwhite contained contains=gitrangediffCommitL nextgroup=gitrangediffIDR
syn match gitrangediffIDR '\v(\d+|-+):' skipwhite contained contains=gitrangediffComp nextgroup=gitrangediffCommitR
syn match gitrangediffCommitR '\v<\x{7,}>|-{7,}' skipwhite contained contains=gitrangediffIDR nextgroup=gitrangediffSummary
syn match gitrangediffSummary '\m.*' contained contains=gitrangediffCommitR
hi def link gitrangediffID Label
hi def link gitrangediffIDL gitrangediffID
hi def link gitrangediffIDR gitrangediffID
hi def link gitrangediffCommit Identifier
hi def link gitrangediffCommitL gitrangediffCommit
hi def link gitrangediffCommitR gitrangediffCommit
hi def link gitrangediffComp Boolean
hi def link gitrangediffSummary Comment
syn match gitrangediffMainNorm '\m^ \zs \ze .*'
syn match gitrangediffMainNorm '\m^ \zs \ze[+-]' nextgroup=gitrangediffSubAdd,gitrangediffSubDel
syn match gitrangediffMainAdd '\m^ \zs+\ze[ +-]' nextgroup=gitrangediffSubAdd,gitrangediffSubDel
syn match gitrangediffMainDel '\m^ \zs-\ze[ +-]' nextgroup=gitrangediffSubAdd,gitrangediffSubDel
syn match gitrangediffMainAdd '\m^ \zs+ .*'
syn match gitrangediffMainDel '\m^ \zs- .*'
syn match gitrangediffSubAdd '\m+.*' contains=gitrangediffMainNorm,gitrangediffMainAdd,gitrangediffMainDel contained
syn match gitrangediffSubDel '\m-.*' contains=gitrangediffMainNorm,gitrangediffMainAdd,gitrangediffMainDel contained
hi def link gitrangediffMainAdd DiffAdd
hi def link gitrangediffMainDel DiffDelete
hi def link gitrangediffSubAdd diffAdded
hi def link gitrangediffSubDel diffRemoved
let b:current_syntax = "gitrangediff" Perhaps it should create another syntax besides |
And more. " Highlight the commit hashes in the range-diff head.
let g:match_rangeDiff += [ { 'group' : 'diffAdded' , 'pattern' : '^\v\s*[0-9-]+:\s+[0-9a-fA-F-]+\s+[!>]\s+\zs[0-9-]+:\s+[0-9a-fA-F-]+\ze\s+' , 'priority' : 10 , 'id' : 104 } ]
let g:match_rangeDiff += [ { 'group' : 'diffRemoved' , 'pattern' : '^\v\s*\zs[0-9-]+:\s+[0-9a-fA-F-]+\ze\s+[!<]\s+[0-9-]+:\s+[0-9a-fA-F-]+\s+' , 'priority' : 10 , 'id' : 105 } ]
" Diff separator
let g:match_rangeDiff += [ { 'group' : 'Label' , 'pattern' : '^ \([ +-]\?\zs@@ .*\| \zs## .* ##\)$' , 'priority' : 10 , 'id' : 106 } ] |
I would be very interested in seeing syntax highlighting in range-diff output as well. I currently have a custom mapping that runs a @tpope do you have any concerns with this request conceptually? It seems non-controversial enough; if you agree I'd be happy to tackle this. |
Could you support syntax highlighting for
git range-diff
output?It's useful in rebasing...
Sample output of the command is below:
Now I sets some
:match
highlighting by self as below.I was wondering if such highlighting was supported natively...
The text was updated successfully, but these errors were encountered: