From dda6b7eb1c5a75dc31595376212d0e30c5fd61ed Mon Sep 17 00:00:00 2001 From: Bart Trojanowski Date: Sun, 22 Nov 2009 00:10:27 -0500 Subject: [PATCH 1/1] vim: added searching for word under cursor with ^] --- vim/README | 2 ++ vim/plugin/notmuch.vim | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/vim/README b/vim/README index 38df560d..91fc7a34 100644 --- a/vim/README +++ b/vim/README @@ -36,6 +36,7 @@ Buffer types: + - add tag(s) to selected message - - remove tag(s) from selected message = - refresh display + ^] - search using word under cursor [notmuch-show] This is the display of the message. @@ -48,4 +49,5 @@ Buffer types: h - toggle folding of extra header lines s - toggle folding of signatures q - return to search display + ^] - search using word under cursor diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim index 7ba7f9c1..3bb9d363 100644 --- a/vim/plugin/notmuch.vim +++ b/vim/plugin/notmuch.vim @@ -91,6 +91,7 @@ let g:notmuch_folders_maps = { " --- --- bindings for search screen {{{2 let g:notmuch_search_maps = { \ '': ':call NM_search_show_thread()', + \ '': ':call NM_search_expand('''')', \ 'a': ':call NM_search_archive_thread()', \ 'f': ':call NM_search_filter()', \ 'm': ':call NM_new_mail()', @@ -109,6 +110,7 @@ let g:notmuch_search_maps = { let g:notmuch_show_maps = { \ '': ':call NM_show_previous(1)', \ '': ':call NM_show_next(1)', + \ '': ':call NM_search_expand('''')', \ 'q': ':call NM_kill_this_buffer()', \ \ 'b': ':call NM_show_fold_toggle(''b'', ''bdy'', !g:notmuch_show_fold_bodies)', @@ -758,6 +760,15 @@ function! s:NM_kill_this_buffer() endif endfunction +function! s:NM_search_expand(arg) + let word = expand(a:arg) + let prev_bufnr = bufnr('%') + setlocal bufhidden=hide + call NM_cmd_search([word]) + setlocal bufhidden=delete + let b:nm_prev_bufnr = prev_bufnr +endfunction + function! s:NM_add_remove_tags(prefix, tags) let id = NM_search_find_thread_id() if id == '' -- 2.43.0