feat(folding): open every heading fold by default on file open
Heading-block folds were computed but all collapsed on file open, so users had to `zR` after every `:edit`. Set `foldlevel=99` once at ftplugin attach so the fold structure is still there (closeable with `zc`/`zM`) but the buffer renders fully expanded. `foldlevel` is window-local; we set it on initial attach only — not in the Lua BufWinEnter re-apply — so closing folds with `zc` in a window survives navigating away and back to that buffer. Split windows still get the same value because Vim copies window-local options to the new window when splitting. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -300,6 +300,12 @@ call s:record(
|
||||
\ foldlevel(2) > 0 ? 1 : 0,
|
||||
\ 'folding.body_inherits_fold',
|
||||
\ 'foldlevel(2)=' . foldlevel(2))
|
||||
" ftplugin sets `foldlevel=99` so every heading-block fold starts open
|
||||
" rather than collapsed on file open.
|
||||
call s:record(
|
||||
\ &l:foldlevel == 99 ? 1 : 0,
|
||||
\ 'folding.starts_with_all_folds_open',
|
||||
\ '&l:foldlevel=' . &l:foldlevel)
|
||||
|
||||
" ===== Wrap up =====
|
||||
|
||||
|
||||
Reference in New Issue
Block a user