From dffee11a40dd85b174b726b602a3f53112229aff Mon Sep 17 00:00:00 2001 From: Bart Trojanowski Date: Fri, 27 Nov 2009 17:18:41 -0500 Subject: [PATCH 1/1] vim: don't toggle folds that are inside closed folds in show mode --- vim/plugin/notmuch.vim | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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 -- 2.43.0