X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=vim%2Fplugin%2Fnotmuch.vim;h=b9fc8d220288d7968bd2385c39fb32942a200e00;hp=0151160268a3bdf2015d0835710853ced9cf5a1a;hb=fe2a905110a9527e77e9c40ba8dd9aab369af6b9;hpb=5c7ebe31d58d649bfb68627d642dde1cc6cf6493 diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim index 01511602..b9fc8d22 100644 --- a/vim/plugin/notmuch.vim +++ b/vim/plugin/notmuch.vim @@ -53,6 +53,13 @@ if !exists('g:notmuch_show_headers') let g:notmuch_show_headers = [ 'Subject', 'From' ] endif +" --- keyboard mapping definitions {{{1 + +let g:notmuch_search_maps = { + \ '': ':call NM_search_display()', + \ 's': ':call NM_cmd_search(split(input(''NotMuch Search:'')))', + \ } + " --- process and set the defaults {{{1 function! NM_set_defaults(force) @@ -77,6 +84,15 @@ function! NM_set_defaults(force) endfunction call NM_set_defaults(0) +" --- assign keymaps {{{1 + +function! s:NM_set_map(maps) + for [key, code] in items(a:maps) + exec printf('nnoremap %s %s', key, code) + endfor +endfunction + + " --- implement search screen {{{1 function! s:NM_cmd_search(words) @@ -94,8 +110,7 @@ function! s:NM_cmd_search(words) call s:NM_newBuffer('search', join(disp, "\n")) let b:nm_raw_lines = lines - nnoremap :call NM_search_display() - nnoremap s :call NM_cmd_search(split(input('NotMuch Search:'))) + call NM_set_map(g:notmuch_search_maps) setlocal cursorline setlocal nowrap endfunction