让我提出实施描述的行为的以下映射。
原文链接:https://www.f2er.com/bash/388171.htmlnnoremap <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] while l != l0 && open exe cmd let [l0,l] = [l,line('.')] let open = foldclosed(l) < 0 endwhile if open call winrestview(view) endif endfunction