Skip to content
Snippets Groups Projects
Commit d25ee907 authored by Jerome Reybert's avatar Jerome Reybert
Browse files

syntax/magit.vim: add some color in Info section

parent b971b18f
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,12 @@ let g:magit_sections = {
\ 'stash': 'Stash list'
\ }
let g:magit_section_info = {
\ 'cur_repo': 'Current repository',
\ 'cur_branch': 'Current branch',
\ 'cur_commit': 'Last commit',
\ }
let g:magit_git_status_code = {
\ 'M': 'modified',
\ 'A': 'added',
......
......@@ -119,9 +119,9 @@ function! s:mg_get_info()
silent put =''
let branch=magit#utils#system("git rev-parse --abbrev-ref HEAD")
let commit=magit#utils#system("git show -s --oneline")
silent put ='Current repository: ' . magit#git#top_dir()
silent put ='Current branch: ' . branch
silent put ='Last commit: ' . commit
silent put =g:magit_section_info.cur_repo . ': ' . magit#git#top_dir()
silent put =g:magit_section_info.cur_branch . ': ' . branch
silent put =g:magit_section_info.cur_commit . ': ' . commit
silent put =''
silent put ='Press h to display help'
endfunction
......
......@@ -36,4 +36,20 @@ execute 'syn region gitHunk start=/' .
\ g:magit_hunk_re . '/ end=/\%(' . g:magit_end_diff_re . '\|' . g:magit_hunk_re
\ '\)\@=/ contains=@diff fold'
execute 'syn region gitInfo start=/^' . g:magit_sections.info . '$/ end=/' .
\ g:magit_section_re . '/'
execute 'syn region gitInfoRepo start=/^' . g:magit_section_info.cur_repo .
\ ':\s*.*/hs=s+20 end=/$/ oneline'
highlight default link gitInfoRepo Directory
execute 'syn region gitInfoBranch start=/^' . g:magit_section_info.cur_branch .
\ ':\s*.*/hs=s+20 end=/$/ oneline'
highlight default link gitInfoBranch Identifier
execute 'syn region gitInfoCommit start=/^' . g:magit_section_info.cur_commit .
\ ':\s*\(.*\)/ end=/$/ contains=infoSha1 oneline'
syntax match infoSha1 containedin=gitInfoCommit "\x\{7}"
highlight default link infoSha1 Identifier
let b:current_syntax = "magit"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment