Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable folding for Untracked/Unstaged/Staged sections #1356

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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