-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Gstatus: use folds for sections ("Untracked") #1317
Comments
Fugitive respects |
Given that it uses diff --git i/syntax/fugitive.vim w/syntax/fugitive.vim
index afc0c0b..9f7322d 100644
--- i/syntax/fugitive.vim
+++ w/syntax/fugitive.vim
@@ -26,7 +26,12 @@ 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=/^$/'
+ if s:section ==# 'Untracked'
+ let fold = ' fold'
+ else
+ let fold = ''
+ endif
+ 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' (only used it for Untracked to not mess with inline diffs (with would need to be opened then otherwise automatically (with As for my use case: I want to be aware of untracked files in vim-fugitive (rules out Since I have a huge number of them in some repos, this is rather distracting then in vim-fugitive. Being able to JFI: I am not a heavy user of |
So the section you want folded gets a |
It's because other sections use inline diffs:
|
It might work better in general if |
@blueyed you still using this solution locally? I'm also interested in folding away I see the PR open (#1356) but it doesn't look like it's had activity in a bit, wondering if it still works well for you |
I just removed automatically enabled folding in the status window. Assuming that doesn't ruffle too many feathers then I am fine to add the extra level section of folding since it will only affect those who opt in. But we should probably make all sections foldable, including |
In a "ft=fugitive" Gstatus buffer folding could be used to fold "Untracked" files by default.
This could also be used for the inline diffs then maybe (currently done via
=
,<
, and>
).Or
=
could be supported to show/hide untracked files also.But I think folds are a more natural choice here.
The text was updated successfully, but these errors were encountered: