-" --- defaults
-
-if !exists('g:notmuch_cmd')
- let g:notmuch_cmd = 'notmuch'
-endif
-
-if !exists('g:notmuch_search_reverse')
- let g:notmuch_search_reverse = 1
-endif
-
-" --- used to match output of notmuch
-
-let s:notmuch_show_message_begin_regexp = '^\fmessage{'
-let s:notmuch_show_message_end_regexp = '^\fmessage}'
-let s:notmuch_show_header_begin_regexp = '^\fheader{'
-let s:notmuch_show_header_end_regexp = '^\fheader}'
-let s:notmuch_show_body_begin_regexp = '^\fbody{'
-let s:notmuch_show_body_end_regexp = '^\fbody}'
-let s:notmuch_show_attachment_begin_regexp = '^\fattachment{'
-let s:notmuch_show_attachment_end_regexp = '^\fattachment}'
-let s:notmuch_show_part_begin_regexp = '^\fpart{'
-let s:notmuch_show_part_end_regexp = '^\fpart}'
-let s:notmuch_show_marker_regexp = '^\f\\(message\\|header\\|body\\|attachment\\|part\\)[{}].*$'
-
-let s:notmuch_show_message_parse_regexp = '\(id:[^ ]*\) depth:\([0-9]*\) filename:\(.*\)$'
-let s:notmuch_show_tags_regexp = '(\([^)]*\))$'
-
-let s:notmuch_show_signature_regexp = '^\(-- \?\|_\+\)$'
-let s:notmuch_show_signature_lines_max = 12
-
-let s:notmuch_show_citation_regexp = '^\s*>'
-
-let s:notmuch_show_headers = [ 'Subject', 'From' ]
-
-let g:notmuch_show_fold_signatures = 1
-let g:notmuch_show_fold_citations = 1
-
-" --- implement search screen
+" --- configuration defaults {{{1
+
+let s:notmuch_defaults = {
+ \ 'g:notmuch_cmd': 'notmuch' ,
+ \ 'g:notmuch_search_reverse': 1 ,
+ \ 'g:notmuch_show_fold_signatures': 1 ,
+ \ 'g:notmuch_show_fold_citations': 1 ,
+ \
+ \ 'g:notmuch_show_message_begin_regexp': '^\fmessage{' ,
+ \ 'g:notmuch_show_message_end_regexp': '^\fmessage}' ,
+ \ 'g:notmuch_show_header_begin_regexp': '^\fheader{' ,
+ \ 'g:notmuch_show_header_end_regexp': '^\fheader}' ,
+ \ 'g:notmuch_show_body_begin_regexp': '^\fbody{' ,
+ \ 'g:notmuch_show_body_end_regexp': '^\fbody}' ,
+ \ 'g:notmuch_show_attachment_begin_regexp': '^\fattachment{' ,
+ \ 'g:notmuch_show_attachment_end_regexp': '^\fattachment}' ,
+ \ 'g:notmuch_show_part_begin_regexp': '^\fpart{' ,
+ \ 'g:notmuch_show_part_end_regexp': '^\fpart}' ,
+ \ 'g:notmuch_show_marker_regexp': '^\f\\(message\\|header\\|body\\|attachment\\|part\\)[{}].*$',
+ \
+ \ 'g:notmuch_show_message_parse_regexp': '\(id:[^ ]*\) depth:\([0-9]*\) filename:\(.*\)$',
+ \ 'g:notmuch_show_tags_regexp': '(\([^)]*\))$' ,
+ \
+ \ 'g:notmuch_show_signature_regexp': '^\(-- \?\|_\+\)$' ,
+ \ 'g:notmuch_show_signature_lines_max': 12 ,
+ \
+ \ 'g:notmuch_show_citation_regexp': '^\s*>' ,
+ \ }
+
+" defaults for g:notmuch_initial_search_words
+" override with: let g:notmuch_initial_search_words = [ ... ]
+let s:notmuch_initial_search_words_defaults = [
+ \ 'tag:inbox'
+ \ ]
+
+" defaults for g:notmuch_show_headers
+" override with: let g:notmuch_show_headers = [ ... ]
+let s:notmuch_show_headers_defaults = [
+ \ 'Subject',
+ \ 'From'
+ \ ]
+
+" --- keyboard mapping definitions {{{1
+
+" --- --- bindings for search screen {{{2
+let g:notmuch_search_maps = {
+ \ '<Enter>': ':call <SID>NM_search_show_thread()<CR>',
+ \ 'a': ':call <SID>NM_search_archive_thread()<CR>',
+ \ 'f': ':call <SID>NM_search_filter()<CR>',
+ \ 'm': ':call <SID>NM_new_mail()<CR>',
+ \ 'o': ':call <SID>NM_search_toggle_order()<CR>',
+ \ 'r': ':call <SID>NM_search_reply_to_thread()<CR>',
+ \ 's': ':call <SID>NM_search_prompt()<CR>',
+ \ 't': ':call <SID>NM_search_filter_by_tag()<CR>',
+ \ '+': ':call <SID>NM_search_add_tag()<CR>',
+ \ '-': ':call <SID>NM_search_remove_tag()<CR>',
+ \ '=': ':call <SID>NM_search_refresh_view()<CR>',
+ \ }
+
+" --- --- bindings for show screen {{{2
+let g:notmuch_show_maps = {
+ \ 'q': ':call <SID>NM_cmd_show_quit()<CR>',
+ \ '<C-N>': ':call <SID>NM_cmd_show_next()<CR>',
+ \ 'c': ':call <SID>NM_cmd_show_fold_toggle(''c'', ''cit'', !g:notmuch_show_fold_citations)<CR>',
+ \ 's': ':call <SID>NM_cmd_show_fold_toggle(''s'', ''sig'', !g:notmuch_show_fold_signatures)<CR>',
+ \ }
+
+" --- implement search screen {{{1