Is it possible to jump to closed folds in Vim?
In Vim, I frequently find myself wanting to do a quick z k or z j to jump to the previous or next fold in a file. The problem is, I frequently want to skip all the open folds, and just jump to the nearest closed fold. Is there a way to do this? I see no built-in keymap in the manual. Let me propose the following mappings implementing the described behavior. nnoremap <silent> <leader>zj :call NextClosedFold('j')<cr> nnoremap <silent> <leader>zk :call NextClosedFold('k')<cr> function! NextClosedFold(dir) let cmd = 'norm!z' . a:dir let view = winsaveview() let [l0, l, open] = [0, view.lnum, 1]