Skip to content

Commit

Permalink
Enable folding for Untracked/Unstaged/Staged sections
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Sep 26, 2019
1 parent 6eb5d8e commit 5582570
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion autoload/fugitive.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2208,7 +2208,7 @@ function! s:StatusCommand(line1, line2, range, count, bang, mods, reg, arg, args
try
let mods = s:Mods(a:mods, &splitbelow ? 'botright' : 'topleft')
let file = fugitive#Find(':', dir)
let arg = ' +setl\ foldmethod=syntax\ foldlevel=1\|let\ w:fugitive_status=FugitiveGitDir() ' .
let arg = ' +setl\ foldmethod=syntax\ foldlevel=2\|let\ w:fugitive_status=FugitiveGitDir() ' .
\ s:fnameescape(file)
for winnr in range(1, winnr('$'))
if s:cpath(file, fnamemodify(bufname(winbufnr(winnr)), ':p'))
Expand Down
2 changes: 1 addition & 1 deletion syntax/fugitive.vim
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ syn match fugitiveHash /\<\x\{4,\}\>/ contained
syn region fugitiveHunk start=/^\%(@@\+ -\)\@=/ end=/^\%([A-Za-z?@]\|$\)\@=/ contains=@fugitiveDiff containedin=@fugitiveSection fold

for s:section in ['Untracked', 'Unstaged', 'Staged']
exe 'syn region fugitive' . s:section . 'Section start=/^\%(' . s:section . ' .*(\d\+)$\)\@=/ contains=fugitive' . s:section . 'Heading end=/^$/'
exe 'syn region fugitive' . s:section . 'Section start=/^\%(' . s:section . ' .*(\d\+)$\)\@=/ contains=fugitive' . s:section . 'Heading end=/^$/ fold'
exe 'syn match fugitive' . s:section . 'Modifier /^[MADRCU?] / contained containedin=fugitive' . s:section . 'Section'
exe 'syn cluster fugitiveSection add=fugitive' . s:section . 'Section'
exe 'syn match fugitive' . s:section . 'Heading /^[A-Z][a-z][^:]*\ze (\d\+)$/ contains=fugitivePreposition contained nextgroup=fugitiveCount skipwhite'
Expand Down

0 comments on commit 5582570

Please sign in to comment.