Xinqi Bao's Git

style(nvim): render compact indented fold summaries
authorXinqi Bao <[email protected]>
Mon, 5 Oct 2026 12:45:10 +0000 (20:45 +0800)
committerXinqi Bao <[email protected]>
Mon, 5 Oct 2026 12:45:10 +0000 (20:45 +0800)
Show the hidden line count on a distinct Folded summary row. Align it one shiftwidth beyond the retained first line so continuation alignment does not affect its position, and leave the remainder blank.

.config/nvim/init.vim

index 4b7fb6c..32c39ac 100644 (file)
@@ -38,6 +38,9 @@ set foldmethod=expr
 set foldexpr=0
 set foldlevelstart=99
 set foldlevel=99
 set foldexpr=0
 set foldlevelstart=99
 set foldlevel=99
+" Indent summaries one level past the retained first line, not a continuation.
+let &foldtext = 'repeat(" ", indent(v:foldstart - 1) + shiftwidth()) . printf("… %d lines …", v:foldend - v:foldstart + 1)'
+set fillchars+=fold:\  " Leave the rest of the summary line blank.
 
 " Interaction and persistence
 set mouse=a
 
 " Interaction and persistence
 set mouse=a