aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim
diff options
context:
space:
mode:
authorGravatar Bart Trojanowski <bart@jukie.net>2009-11-27 17:18:41 -0500
committerGravatar Bart Trojanowski <bart@jukie.net>2009-11-27 17:18:41 -0500
commitdffee11a40dd85b174b726b602a3f53112229aff (patch)
tree537e31f2b2e5bcc2d87cca8e9cb17d0128bb604f /vim
parente5a25c769240a91b1b5bc5e4349e85ec368b5cfb (diff)
vim: don't toggle folds that are inside closed folds in show mode
Diffstat (limited to 'vim')
-rw-r--r--vim/plugin/notmuch.vim14
1 files 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 <buffer> %s :call <SID>NM_show_fold_toggle(''%s'', ''%s'', %d)<CR>', a:key, a:key, a:type, !a:fold)
endfunction