diff --git a/common/magit_common.vim b/common/magit_common.vim index 47d488b44a3022a645b1e94a0d8e57995cd6c29b..7773b0dc3ff9206a1a2ceaf388cada8388aaa04c 100644 --- a/common/magit_common.vim +++ b/common/magit_common.vim @@ -39,6 +39,7 @@ endfor let g:magit_section_re .= 'unknown section\)$' let g:magit_diff_re = '^diff --git' +let g:magit_end_diff_re = '^$' let g:magit_stash_re = '^stash@{\d\+}:' let g:magit_hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@' let g:magit_bin_re = '^Binary files ' diff --git a/plugin/magit.vim b/plugin/magit.vim index 4b5ee3880379bcb8dfbc385c22498348253caa11..4f951cb29c90b6d3e158363baf8cc1ff71e9b7d8 100644 --- a/plugin/magit.vim +++ b/plugin/magit.vim @@ -367,7 +367,8 @@ endfunction function! s:mg_select_file_block() return <SID>mg_search_block( \ [g:magit_file_re, 1], - \ [ [g:magit_file_re, -1], + \ [ [g:magit_end_diff_re, 0], + \ [g:magit_file_re, -1], \ [g:magit_stash_re, -1], \ [g:magit_section_re, -2], \ [g:magit_bin_re, 0], @@ -386,6 +387,7 @@ function! s:mg_select_hunk_block() return <SID>mg_search_block( \ [g:magit_hunk_re, 0], \ [ [g:magit_hunk_re, -1], + \ [g:magit_end_diff_re, 0], \ [g:magit_file_re, -1], \ [g:magit_stash_re, -1], \ [g:magit_section_re, -2], diff --git a/syntax/magit.vim b/syntax/magit.vim index 5d2c8c5ef1e7337527ef05c149998130c4deb332..e33e3227aa0addea1c33e453768e2327de84f873 100644 --- a/syntax/magit.vim +++ b/syntax/magit.vim @@ -30,11 +30,10 @@ execute 'syn region gitStash start=/' . g:magit_stash_re . '/ end=/\%(' . \ g:magit_stash_re . '\)\@=/ contains=stashEntry fold' execute 'syn region gitFile start=/' . g:magit_file_re . '/ end=/\%(' . - \ g:magit_file_re . '\|' . g:magit_section_re '\)\@=/ contains=gitHunk,fileEntry fold' + \ g:magit_end_diff_re . '\)\@=/ contains=gitHunk,fileEntry fold' execute 'syn region gitHunk start=/' . - \ g:magit_hunk_re . '/ end=/\%(' . - \ g:magit_diff_re . '\|' . g:magit_hunk_re . '\|' . g:magit_section_re. '\|' . g:magit_stash_re . '\|' . g:magit_file_re . + \ g:magit_hunk_re . '/ end=/\%(' . g:magit_end_diff_re . '\|' . g:magit_hunk_re \ '\)\@=/ contains=@diff fold' let b:current_syntax = "magit"