-" --- 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 s:notmuch_show_fold_signatures = 1
-let s:notmuch_show_fold_citations = 1
-
-" --- implement search screen
+" --- configuration defaults {{{1
+
+let s:notmuch_defaults = {
+ \ 'g:notmuch_cmd': 'notmuch' ,
+ \
+ \ 'g:notmuch_search_newest_first': 1 ,
+ \ 'g:notmuch_search_from_column_width': 20 ,
+ \
+ \ 'g:notmuch_show_fold_signatures': 1 ,
+ \ 'g:notmuch_show_fold_citations': 1 ,
+ \ 'g:notmuch_show_fold_bodies': 0 ,
+ \ 'g:notmuch_show_fold_headers': 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 and tag:unread',
+ \ ]
+
+" defaults for g:notmuch_show_headers
+" override with: let g:notmuch_show_headers = [ ... ]
+let s:notmuch_show_headers_defaults = [
+ \ 'Subject',
+ \ 'To',
+ \ 'Cc',
+ \ 'Bcc',
+ \ 'Date',
+ \ ]
+
+" --- 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>',
+ \ 'S': ':call <SID>NM_search_edit()<CR>',
+ \ 't': ':call <SID>NM_search_filter_by_tag()<CR>',
+ \ 'q': ':call <SID>NM_kill_this_buffer()<CR>',
+ \ '+': ':call <SID>NM_search_add_tags([])<CR>',
+ \ '-': ':call <SID>NM_search_remove_tags([])<CR>',
+ \ '=': ':call <SID>NM_search_refresh_view()<CR>',
+ \ }
+
+" --- --- bindings for show screen {{{2
+let g:notmuch_show_maps = {
+ \ '<C-P>': ':call <SID>NM_show_previous(1)<CR>',
+ \ '<C-N>': ':call <SID>NM_show_next(1)<CR>',
+ \ 'q': ':call <SID>NM_kill_this_buffer()<CR>',
+ \
+ \ 'b': ':call <SID>NM_show_fold_toggle(''b'', ''bdy'', !g:notmuch_show_fold_bodies)<CR>',
+ \ 'c': ':call <SID>NM_show_fold_toggle(''c'', ''cit'', !g:notmuch_show_fold_citations)<CR>',
+ \ 'h': ':call <SID>NM_show_fold_toggle(''h'', ''hdr'', !g:notmuch_show_fold_headers)<CR>',
+ \ 's': ':call <SID>NM_show_fold_toggle(''s'', ''sig'', !g:notmuch_show_fold_signatures)<CR>',
+ \
+ \ 'a': ':call <SID>NM_show_archive_thread()<CR>',
+ \ 'A': ':call <SID>NM_show_mark_read_then_archive_thread()<CR>',
+ \ 'N': ':call <SID>NM_show_mark_read_then_next_open_message()<CR>',
+ \ 'v': ':call <SID>NM_show_view_all_mime_parts()<CR>',
+ \ '+': ':call <SID>NM_show_add_tag()<CR>',
+ \ '-': ':call <SID>NM_show_remove_tag()<CR>',
+ \ '<Space>': ':call <SID>NM_show_advance_marking_read_and_archiving()<CR>',
+ \ '\|': ':call <SID>NM_show_pipe_message()<CR>',
+ \
+ \ 'r': ':call <SID>NM_show_reply()<CR>',
+ \ 'm': ':call <SID>NM_new_mail()<CR>',
+ \ }
+
+
+" --- implement search screen {{{1