From: Bart Trojanowski Date: Fri, 27 Nov 2009 22:18:41 +0000 (-0500) Subject: vim: don't toggle folds that are inside closed folds in show mode X-Git-Tag: 0.1~313^2~3 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=dffee11a40dd85b174b726b602a3f53112229aff vim: don't toggle folds that are inside closed folds in show mode --- diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim index 9932e3f1..cb7f34f5 100644 --- a/vim/plugin/notmuch.vim +++ b/vim/plugin/notmuch.vim @@ -639,9 +639,19 @@ function! s:NM_show_fold_toggle(key, type, fold) let act = 'close' endif for fld in info['folds'] - if fld[0] == a:type - exec printf('%dfold%s', fld[1], act) + if fld[0] != a:type + continue + endif + "let idx = fld[3] + "let msg = info['msgs'][idx] + "if has_key(msg,'match') && msg['match'] == '0' + " continue + "endif + let cls = foldclosed(fld[1]) + if cls != -1 && cls != fld[1] + continue endif + exec printf('%dfold%s', fld[1], act) endfor exec printf('nnoremap %s :call NM_show_fold_toggle(''%s'', ''%s'', %d)', a:key, a:key, a:type, !a:fold) endfunction