X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=vim%2Fplugin%2Fnotmuch.vim;h=fee3ed57a5bd58035d783109f95256052e05c3dc;hb=8344c439bf84aa5ead9245108334a99713c384ab;hp=6726a5e79f9bcac2ffbeea34f998ff29a07e032b;hpb=5cdf424657e2fd19a4563f750b0be02cc46b8920;p=notmuch diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim index 6726a5e7..fee3ed57 100644 --- a/vim/plugin/notmuch.vim +++ b/vim/plugin/notmuch.vim @@ -25,6 +25,7 @@ let s:notmuch_defaults = { \ 'g:notmuch_cmd': 'notmuch' , + \ 'g:notmuch_sendmail': 'sendmail' , \ 'g:notmuch_debug': 0 , \ \ 'g:notmuch_search_newest_first': 1 , @@ -119,8 +120,10 @@ let g:notmuch_search_maps = { \ '': ':call NM_search_show_thread(0)', \ '': ':call NM_search_show_thread(1)', \ '': ':call NM_search_expand('''')', + \ 'I': ':call NM_search_mark_read_thread()', \ 'a': ':call NM_search_archive_thread()', \ 'A': ':call NM_search_mark_read_then_archive_thread()', + \ 'D': ':call NM_search_delete_thread()', \ 'f': ':call NM_search_filter()', \ 'm': ':call NM_new_mail()', \ 'o': ':call NM_search_toggle_order()', @@ -148,6 +151,7 @@ let g:notmuch_show_maps = { \ 'h': ':call NM_show_fold_toggle(''h'', ''hdr'', !g:notmuch_show_fold_headers)', \ 'i': ':call NM_show_fold_toggle(''s'', ''sig'', !g:notmuch_show_fold_signatures)', \ + \ 'I': ':call NM_show_mark_read_thread()', \ 'a': ':call NM_show_archive_thread()', \ 'A': ':call NM_show_mark_read_then_archive_thread()', \ 'N': ':call NM_show_mark_read_then_next_open_message()', @@ -308,6 +312,11 @@ function! s:NM_search_edit() endif endfunction +function! s:NM_search_mark_read_thread() + call NM_tag([], ['-unread']) + norm j +endfunction + function! s:NM_search_archive_thread() call NM_tag([], ['-inbox']) norm j @@ -318,6 +327,11 @@ function! s:NM_search_mark_read_then_archive_thread() norm j endfunction +function! s:NM_search_delete_thread() + call NM_tag([], ['+delete','-inbox','-unread']) + norm j +endfunction + function! s:NM_search_filter() call NM_search_filter_helper('Filter: ', '', '') endfunction @@ -495,6 +509,11 @@ function! s:NM_show_next_thread() endif endfunction +function! s:NM_show_mark_read_thread() + call NM_tag(b:nm_search_words, ['-unread']) + call NM_show_next_thread() +endfunction + function! s:NM_show_archive_thread() call NM_tag(b:nm_search_words, ['-inbox']) call NM_show_next_thread() @@ -949,18 +968,28 @@ function! s:NM_compose_send() let line = getline(lnum) let lst_hdr = '' while match(line, '^$') == -1 - if match(line, '^Notmuch-Help:') == -1 + if !exists("hdr_starts") && match(line, '^Notmuch-Help:') == -1 let hdr_starts = lnum - 1 - break endif let lnum = lnum + 1 let line = getline(lnum) endwhile + let body_starts = lnum - 1 + call append(body_starts, 'Date: ' . strftime('%a, %d %b %Y %H:%M:%S %z')) exec printf(':0,%dd', hdr_starts) write - let cmdtxt = 'mailx -t < ' . fname + let line = getline(1) + let m = matchlist(line, '^From:\s*\(.*\)\s*<\(.*\)>$') + if (len(m) >= 2) + let from = m[2] + else + let m = matchlist(line, '^From:\s*\(.*\)$') + let from = m[1] + endif + + let cmdtxt = g:notmuch_sendmail . ' -t -f ' . from . ' < ' . fname let out = system(cmdtxt) let err = v:shell_error if err