From b0a00164169dba02f5cc9180a54f370d2c4d4b07 Mon Sep 17 00:00:00 2001 From: Bart Trojanowski Date: Fri, 20 Nov 2009 09:56:10 -0500 Subject: [PATCH] define keymap for show screen as a dictionary --- vim/plugin/notmuch.vim | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim index b2f46dde..27fa684d 100644 --- a/vim/plugin/notmuch.vim +++ b/vim/plugin/notmuch.vim @@ -57,9 +57,18 @@ let s:notmuch_show_headers_defaults = [ " --- keyboard mapping definitions {{{1 +" --- --- bindings for search screen {{{2 let g:notmuch_search_maps = { - \ '': ':call NM_search_display()', - \ 's': ':call NM_cmd_search(split(input(''NotMuch Search:'')))', + \ '': ':call NM_search_display()', + \ 's': ':call NM_cmd_search(split(input(''NotMuch Search:'')))', + \ } + +" --- --- bindings for show screen {{{2 +let g:notmuch_show_maps = { + \ 'q': ':call NM_cmd_show_quit()', + \ '': ':call NM_cmd_show_next()', + \ 'c': ':call NM_cmd_show_fold_toggle(''c'', ''cit'', !g:notmuch_show_fold_citations)', + \ 's': ':call NM_cmd_show_fold_toggle(''s'', ''sig'', !g:notmuch_show_fold_signatures)', \ } " --- implement search screen {{{1 @@ -112,14 +121,15 @@ function! s:NM_cmd_show(words) call s:NM_cmd_show_mkfolds() call s:NM_cmd_show_mksyntax() + call NM_set_map(g:notmuch_show_maps) setlocal foldtext=NM_cmd_show_foldtext() setlocal fillchars= setlocal foldcolumn=6 - exec printf("nnoremap q :b %d", b:nm_prev_bufnr) - nnoremap :call NM_cmd_show_next() - nnoremap c :call NM_cmd_show_fold_toggle('c', 'cit', !g:notmuch_show_fold_citations) - nnoremap s :call NM_cmd_show_fold_toggle('s', 'sig', !g:notmuch_show_fold_signatures) +endfunction + +function! s:NM_cmd_show_quit() + exec printf(":buffer %d", b:nm_prev_bufnr) endfunction function! s:NM_cmd_show_next() @@ -407,7 +417,6 @@ function! NM_set_defaults(force) \ a:force, key, string(dflt)) continue endif - echoe cmd exec cmd endfor endfunction -- 2.26.2