vim: added searching for word under cursor with ^]

This commit is contained in:
Bart Trojanowski 2009-11-22 00:10:27 -05:00
parent e67ad108c8
commit dda6b7eb1c
2 changed files with 13 additions and 0 deletions

View file

@ -36,6 +36,7 @@ Buffer types:
+ - add tag(s) to selected message + - add tag(s) to selected message
- - remove tag(s) from selected message - - remove tag(s) from selected message
= - refresh display = - refresh display
^] - search using word under cursor
[notmuch-show] [notmuch-show]
This is the display of the message. This is the display of the message.
@ -48,4 +49,5 @@ Buffer types:
h - toggle folding of extra header lines h - toggle folding of extra header lines
s - toggle folding of signatures s - toggle folding of signatures
q - return to search display q - return to search display
^] - search using word under cursor

View file

@ -91,6 +91,7 @@ let g:notmuch_folders_maps = {
" --- --- bindings for search screen {{{2 " --- --- bindings for search screen {{{2
let g:notmuch_search_maps = { let g:notmuch_search_maps = {
\ '<Enter>': ':call <SID>NM_search_show_thread()<CR>', \ '<Enter>': ':call <SID>NM_search_show_thread()<CR>',
\ '<C-]>': ':call <SID>NM_search_expand(''<cword>'')<CR>',
\ 'a': ':call <SID>NM_search_archive_thread()<CR>', \ 'a': ':call <SID>NM_search_archive_thread()<CR>',
\ 'f': ':call <SID>NM_search_filter()<CR>', \ 'f': ':call <SID>NM_search_filter()<CR>',
\ 'm': ':call <SID>NM_new_mail()<CR>', \ 'm': ':call <SID>NM_new_mail()<CR>',
@ -109,6 +110,7 @@ let g:notmuch_search_maps = {
let g:notmuch_show_maps = { let g:notmuch_show_maps = {
\ '<C-P>': ':call <SID>NM_show_previous(1)<CR>', \ '<C-P>': ':call <SID>NM_show_previous(1)<CR>',
\ '<C-N>': ':call <SID>NM_show_next(1)<CR>', \ '<C-N>': ':call <SID>NM_show_next(1)<CR>',
\ '<C-]>': ':call <SID>NM_search_expand(''<cword>'')<CR>',
\ 'q': ':call <SID>NM_kill_this_buffer()<CR>', \ 'q': ':call <SID>NM_kill_this_buffer()<CR>',
\ \
\ 'b': ':call <SID>NM_show_fold_toggle(''b'', ''bdy'', !g:notmuch_show_fold_bodies)<CR>', \ 'b': ':call <SID>NM_show_fold_toggle(''b'', ''bdy'', !g:notmuch_show_fold_bodies)<CR>',
@ -758,6 +760,15 @@ function! s:NM_kill_this_buffer()
endif endif
endfunction endfunction
function! s:NM_search_expand(arg)
let word = expand(a:arg)
let prev_bufnr = bufnr('%')
setlocal bufhidden=hide
call <SID>NM_cmd_search([word])
setlocal bufhidden=delete
let b:nm_prev_bufnr = prev_bufnr
endfunction
function! s:NM_add_remove_tags(prefix, tags) function! s:NM_add_remove_tags(prefix, tags)
let id = <SID>NM_search_find_thread_id() let id = <SID>NM_search_find_thread_id()
if id == '' if id == ''