X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=vim%2Fplugin%2Fnotmuch.vim;h=e13ea9f7fd1c3cc5e61ba52d4fe408c7dc4938d3;hp=15252d2d8af95dda2c6e5b32f4a93818c45075f8;hb=0210f960f10db27ea2556d61340bca24302baf56;hpb=251ec73587e92f386c9d24bc781bad38a70e3afb diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim index 15252d2d..e13ea9f7 100644 --- a/vim/plugin/notmuch.vim +++ b/vim/plugin/notmuch.vim @@ -104,6 +104,7 @@ let g:notmuch_search_maps = { \ '+': ':call NM_search_add_tags([])', \ '-': ':call NM_search_remove_tags([])', \ '=': ':call NM_search_refresh_view()', + \ '?': ':echo NM_search_thread_id()', \ } " --- --- bindings for show screen {{{2 @@ -129,6 +130,7 @@ let g:notmuch_show_maps = { \ \ 'r': ':call NM_show_reply()', \ 'm': ':call NM_new_mail()', + \ '?': ':echo NM_show_thread_id() . '' '' . NM_show_message_id()', \ } @@ -226,7 +228,7 @@ endfunction " --- --- search screen action functions {{{2 function! s:NM_search_show_thread() - let id = NM_search_find_thread_id() + let id = NM_search_thread_id() if id != '' call NM_cmd_show([id]) endif @@ -324,7 +326,7 @@ endfunction " --- --- search screen helper functions {{{2 -function! s:NM_search_find_thread_id() +function! s:NM_search_thread_id() if !exists('b:nm_raw_lines') echoe 'no b:nm_raw_lines' return '' @@ -363,6 +365,7 @@ function! s:NM_cmd_show(words) setlocal bufhidden=hide call NM_newBuffer('show', join(info['disp'], "\n")) setlocal bufhidden=delete + let b:nm_words = a:words let b:nm_raw_info = info let b:nm_prev_bufnr = prev_bufnr @@ -475,7 +478,32 @@ function! s:NM_show_pipe_message() echo 'not implemented' endfunction -" --- --- search screen helper functions {{{2 +" --- --- show screen helper functions {{{2 + +function! s:NM_show_thread_id() + if !exists('b:nm_words') + echoe 'no b:nm_words' + return '' + endif + return b:nm_words[0] +endfunction + +function! s:NM_show_message_id() + if !exists('b:nm_raw_info') + echoe 'no b:nm_raw_info' + return '' + endif + let info = b:nm_raw_info + let lnum = line('.') + for msg in info['msgs'] + if lnum < msg['start'] + continue + endif + + return msg['id'] + endfor + return '' +endfunction function! s:NM_show_fold_toggle(key, type, fold) let info = b:nm_raw_info @@ -766,7 +794,7 @@ function! s:NM_search_expand(arg) endfunction function! s:NM_add_remove_tags(prefix, tags) - let id = NM_search_find_thread_id() + let id = NM_search_thread_id() if id == '' echoe 'Eeek! I couldn''t find the thead id!' endif