I thought that
:folddoc execute v:foldstart."p"
would work, but it only repeatedly returns the first line of just one of the folds.
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The first line of a closed fold can be detected using the
foldclosed()function. For a given line number inside of a closed fold, it returns
the number of the line that fold starts on; otherwise, it returns -1.
Obviously, if a line’s number equals to the value of
foldclosed()for that number, then the line is the first one in a fold. In
Vimscript this test can be written as
Therefore, to print the first lines of all closed folds, one can use
the following command:
(Use the
:pcommand instead of the:#one when displaying linenumbers is not necessary.)