I have a custom foldexpr to fold comments in markdown. Is there a way to make this fold operation work on just one line? Even if it is just 1 line, I like the color change that folding applies so I can concentrate on non-comments.
1 Answer
'foldminlines' 'fml' number (default: 1)
local to window
{not available when compiled without the +folding
feature}
Sets the number of screen lines above which a fold can be displayed
closed. Also for manually closed folds. With the default value of
one a fold can only be closed if it takes up two or more screen lines.
Set to zero to be able to close folds of just one screen line.
Note that this only has an effect on what is displayed. After using
"zc" to close a fold, which is displayed open because it's smaller
than 'foldminlines', a following "zc" may close a containing fold.
So do set foldminlines=0
:
To test I did select a single line and pressed zf
:
-
Awesome! Thank you for the solution. Unfortunately, as a new member I cannot mark this as an answer. If someone could mark it as an answer I would appreciate it. (Would you also enlighten me with your process as to how you found this setting?)– yh devCommented Jan 20, 2022 at 7:47
-
@yhdev upvoted your question to bring some points to you. Welcome to Vi and Vim SE! Commented Jan 20, 2022 at 7:48
-
As for process -- it is just
:h fold<C-d>
to list every help topic that match fold-something... And then maybe tune it with:h fold*line<C-d>
to narrow it down a bit Commented Jan 20, 2022 at 7:50 -
1You will be able to accept the answer after some delay, I believe, @yhdev. No one besides the asker has the ability to mark an answer accepted.– D. Ben Knoble ♦Commented Jan 20, 2022 at 14:37