X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=vim%2Fplugin%2Fnotmuch.vim;h=cb7f34f5e2e14985ecea8403e9c574f40d9245ce;hp=9932e3f16095e65931280701cda284b7b21ea233;hb=dffee11a40dd85b174b726b602a3f53112229aff;hpb=e5a25c769240a91b1b5bc5e4349e85ec368b5cfb;ds=sidebyside 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