From fdbcad062461a002c604cf3313986e3f98997231 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 18 Aug 2019 04:01:59 -0400 Subject: [PATCH] Allow expanding merge conflict in :Gstatus Closes https://github.com/tpope/vim-fugitive/issues/1242 --- autoload/fugitive.vim | 8 +++++--- syntax/fugitive.vim | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index b484ce1..fd8034c 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -2869,7 +2869,7 @@ function! s:StageInline(mode, ...) abort endif continue endif - if !has_key(b:fugitive_diff, info.section) || info.status !~# '^[ADMR]$' || a:mode ==# 'hide' + if !has_key(b:fugitive_diff, info.section) || info.status !~# '^[ADMRU]$' || a:mode ==# 'hide' continue endif let mode = '' @@ -2980,8 +2980,10 @@ function! s:StageApply(info, reverse, extra) abort call insert(lines, getline(start)) endif endwhile - if start == 0 || getline(start) !~# '^@@ ' - call s:throw("could not find hunk") + if start == 0 + throw 'fugitive: cold not find hunk' + elseif getline(start) !~# '^@@ ' + throw 'fugitive: cannot apply conflict hunk' endif let i = b:fugitive_expanded[info.section][info.filename][0] let head = [] diff --git a/syntax/fugitive.vim b/syntax/fugitive.vim index e2389b5..f3c497b 100644 --- a/syntax/fugitive.vim +++ b/syntax/fugitive.vim @@ -22,7 +22,7 @@ syn match FugitiveSymbolicRef /\.\@!\%(\.\.\@!\|[^[:space:][:cntrl:]\:.]\)\+\.\@ syn match fugitiveHash /^\x\{4,\}\>/ contained containedin=fugitiveSection syn match fugitiveHash /\<\x\{4,\}\>/ contained -syn region fugitiveHunk start=/^\%(@@ -\)\@=/ end=/^\%([A-Za-z?@]\|$\)\@=/ contains=@fugitiveDiff containedin=fugitiveSection fold +syn region fugitiveHunk start=/^\%(@@\+ -\)\@=/ end=/^\%([A-Za-z?@]\|$\)\@=/ contains=@fugitiveDiff containedin=fugitiveSection fold hi def link fugitiveHeader Label hi def link fugitiveHeading PreProc