diff --git a/common/magit_common.vim b/common/magit_common.vim index 7773b0dc3ff9206a1a2ceaf388cada8388aaa04c..7232aa73b3e46cbc0a1e1ace10e5eb10372c1e33 100644 --- a/common/magit_common.vim +++ b/common/magit_common.vim @@ -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', diff --git a/plugin/magit.vim b/plugin/magit.vim index 0cd91303448055ea1ba06b0f318fe16a1915c41b..96595beab97b024cc00726627eda0612a97e2812 100644 --- a/plugin/magit.vim +++ b/plugin/magit.vim @@ -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 diff --git a/syntax/magit.vim b/syntax/magit.vim index e33e3227aa0addea1c33e453768e2327de84f873..108810bb644af408edb690202e5b84ecae0f875e 100644 --- a/syntax/magit.vim +++ b/syntax/magit.vim @@ -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"