I started by looking at the feasibility and wound up with a proof of concept, though I intended to get feedback earlier.
Feature Proposal
Enable fold text lines to be hidden, allowing more unfolded lines to be displayed.
Use Case
This feature pairs well with foldmethod=expr. With foldexpr that matches, for example, a variable name, only lines with that variable are displayed allowing rapid scanning. In this use case, the fold text tends to get in the way. If desired, the gaps can be made apparent by turning on line numbers, ":set nu".
Precedent
Xedit, Kedit, and THE editors implement the ALL command that shows only lines that match a target. By default. a "shadow line" is displayed to represent excluded lines. The shadow line can be disabled by "SET SHADOW OFF". I've seen other editors support this but I can't name them.
While searching for an existing workaround or prior attempt at implementing this feature, I easily found occasional requests for this functionality going back at least 20 years.
Status
I have a proof of concept that I think could be improved with feedback.
Implementation details:
I've implemented a boolean option with window scope provisionally named "foldline" (abbr. "fdln"). This defaults to TRUE, which enables current behavior. Setting foline to FALSE (:set nofoldline) suppresses the display of fold text lines. I also considered naming the option "showfoldline", but I think starting a fold related command with "fold" is expected. I'm not convinced "foldlin" is the best name, but ":set nofoldline" or ":set nofdln" has felt okay in use.
Documentation (could use improvement)
doc/quickref.txt:
'foldline' 'fdln' set to display fold text line for a closed line
doc/options.txt
*'foldline'* *'fdln'* *'nofoldline'* *'nov'*
'foldline' 'fdln' boolean (default on)
local to window
{not available when compiled without the |+folding|
feature}
When off, fold line is not displayed.
See |folding|.
Code
Tests
Have not been implemented. If this feature is accepted I can write the tests. These would be a big help:
- Pointer to your testing documentation and recommended resources
- Example test code:
- For a window scope boolean option.
- For a feature that changes the way the screen is drawn.
I look forward to feedback and an opportunity to get this feature accepted.
Thanks,
Jim