X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=vim%2Fplugin%2Fnotmuch.vim;h=255df071a707d5d0e86c0964d6bbd986bf29c8b3;hb=f5c20b8b08c35b5026538b14c45e115a991b3bdd;hp=05c21d3cead8af05305b4e01aed52f25ba13fcfe;hpb=e236142f039c1a77ec2a40853cec102681b33adb;p=notmuch diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim index 05c21d3c..255df071 100644 --- a/vim/plugin/notmuch.vim +++ b/vim/plugin/notmuch.vim @@ -25,7 +25,7 @@ let s:notmuch_defaults = { \ 'g:notmuch_cmd': 'notmuch' , - \ 'g:notmuch_sendmail': 'sendmail' , + \ 'g:notmuch_sendmail': '/usr/sbin/sendmail' , \ 'g:notmuch_debug': 0 , \ \ 'g:notmuch_search_newest_first': 1 , @@ -58,7 +58,7 @@ let s:notmuch_defaults = { \ \ 'g:notmuch_compose_insert_mode_start': 1 , \ 'g:notmuch_compose_header_help': 1 , - \ 'g:notmuch_compose_temp_file_dir': '~/.notmuch/compose/' , + \ 'g:notmuch_compose_temp_file_dir': '~/.notmuch/compose' , \ } " defaults for g:notmuch_initial_search_words @@ -120,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()', @@ -152,6 +154,8 @@ let g:notmuch_show_maps = { \ 'I': ':call NM_show_mark_read_thread()', \ 'a': ':call NM_show_archive_thread()', \ 'A': ':call NM_show_mark_read_then_archive_thread()', + \ 'D': ':call NM_show_delete_thread()', + \ 'd': ':call NM_show_delete_message()', \ 'N': ':call NM_show_mark_read_then_next_open_message()', \ 'v': ':call NM_show_view_all_mime_parts()', \ '+': ':call NM_show_add_tag()', @@ -258,12 +262,12 @@ function! s:NM_cmd_search_fmtline(line) return 'ERROR PARSING: ' . a:line endif let max = g:notmuch_search_from_column_width - let flist = [] - for at in split(m[4], ", ") - let p = min([stridx(at, "."), stridx(at, "@")]) - call insert(flist, tolower(at[0:p - 1])) + let flist = {} + for at in split(m[4], '[|,] ') + let p = split(at, '[@.]') + let flist[p[0]] = 1 endfor - let from = join(flist, ", ") + let from = join(keys(flist), ", ") return printf("%-12s %3s %-20.20s | %s (%s)", m[2], m[3], from, m[5], m[6]) endfunction @@ -310,6 +314,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 @@ -320,6 +329,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 @@ -512,6 +526,16 @@ function! s:NM_show_mark_read_then_archive_thread() call NM_show_next_thread() endfunction +function! s:NM_show_delete_thread() + call NM_tag(b:nm_search_words, ['+delete', '-inbox', '-unread']) + call NM_show_next_thread() +endfunction + +function! s:NM_show_delete_message() + let msg = NM_show_get_message_for_line(line('.')) + call NM_tag([msg['id']], ['+delete', '-inbox', '-unread']) +endfunction + function! s:NM_show_mark_read_then_next_open_message() echo 'not implemented' endfunction @@ -572,7 +596,7 @@ function! s:NM_show_advance_marking_read_and_archiving() let filter = NM_combine_tags('tag:', advance_tags, 'OR', '()') \ + ['AND'] \ + NM_combine_tags('', ids, 'OR', '()') - call map(advance_tags, '"+" . v:val') + call map(advance_tags, '"-" . v:val') call NM_tag(filter, advance_tags) call NM_show_next(1, 1) return @@ -741,7 +765,7 @@ function! s:NM_cmd_show_parse(inlines) if part_end " FIXME: this is a hack for handling two folds being added for one line - " we should handle addinga fold in a function + " we should handle adding a fold in a function if len(foldinfo) && foldinfo[1] < foldinfo[2] call add(info['folds'], foldinfo[0:3]) let info['foldtext'][foldinfo[1]] = foldinfo[4] @@ -1290,7 +1314,7 @@ endfunction function! s:NM_tag(filter, tags) let filter = len(a:filter) ? a:filter : [NM_search_thread_id()] if !len(filter) - throw 'Eeek! I couldn''t find the thead id!' + throw 'Eeek! I couldn''t find the thread id!' endif let args = ['tag'] call extend(args, a:tags)