I'm writing some folding functions and I am at a point where I need to check if the current line is actually a fold.
The reason for this is because it is a custom fold method that depends on searching/matching certain lines.
For example, if the current line is folded and looks like:
-FOO------------------------
If you do something like:
getline('.')
You would basically get FOO
so there is no way (that I know of) to know if I am at a fold or not.
Is there a helper function for this?
I would think it would have to be something like:
is_folded('.')
I could probably mess with the foldtext
to assign a special title for the fold but I want to avoid this.
From
:help eval.txt
You can check for a given line if it returns -1 or a line number, you can probably implement your
isfolded()
function this way.If you are looking for Vim script function or feature , it is a good idea to start by searching in
eval.txt
which contains lots of relevant information.