If you close a fold from within it with zc
, and then (without moving) open it again with zo
, the cursor position will remain within the fold. That's because the current line number remains as it was before closing the fold, even if that line now is hidden within the fold.
However, once you move, Vim needs to update the cursor position to something that's visible. For vertical moves, that means making the first folded line the current line; all other lines are hidden within the fold, and you would have to to open the fold to go there.
If you want to change that, your suggested approach with using a mark sounds reasonable. However, that would only cover revisiting the last fold (or a maximum of 26 folds, limited by the number of available buffer-local marks). The good thing about marks is that they automatically adapt to changes in line numbers; i.e. edits above the fold would not invalidate the position information. If you wanted to store any number of folds (exceeding the number of marks), you'd have the problem that a fold can only be identified by the current range of lines, and those are bound to change during edits.
TL;DR: Go ahead and try out your idea, but be aware that it's limited to the last fold, and cannot be generalized to cover all folds.
Bonus answer: File (uppercase) marks are stored in the viminfo file, controlled by :help viminfo-f
and :help viminfo-'
. :mkview
does not consider marks.