aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim
diff options
context:
space:
mode:
authorGravatar Bart Trojanowski <bart@jukie.net>2009-11-25 14:17:34 -0500
committerGravatar Bart Trojanowski <bart@jukie.net>2009-11-25 14:17:34 -0500
commit0f39d2c4deef6f774e63d78a226857039d0cd978 (patch)
tree40e5b9d5c0d7476574f9769864b52e7a5bb732df /vim
parentb440aeb23e8ddc3c88c697718aedab0ab9ca3245 (diff)
vim: allow show_next/previous to skip non-matching messages
Diffstat (limited to 'vim')
-rw-r--r--vim/plugin/notmuch.vim14
1 files changed, 10 insertions, 4 deletions
diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim
index f0106604..c95e6b0e 100644
--- a/vim/plugin/notmuch.vim
+++ b/vim/plugin/notmuch.vim
@@ -110,8 +110,8 @@ let g:notmuch_search_maps = {
" --- --- bindings for show screen {{{2
let g:notmuch_show_maps = {
- \ '<C-P>': ':call <SID>NM_show_previous(1)<CR>',
- \ '<C-N>': ':call <SID>NM_show_next(1)<CR>',
+ \ '<C-P>': ':call <SID>NM_show_previous(1, 0)<CR>',
+ \ '<C-N>': ':call <SID>NM_show_next(1, 0)<CR>',
\ '<C-]>': ':call <SID>NM_search_expand(''<cword>'')<CR>',
\ 'q': ':call <SID>NM_kill_this_buffer()<CR>',
\
@@ -399,10 +399,13 @@ function! s:NM_cmd_show(words)
endfunction
-function! s:NM_show_previous(can_change_thread)
+function! s:NM_show_previous(can_change_thread, find_matching)
let info = b:nm_raw_info
let lnum = line('.')
for msg in reverse(copy(info['msgs']))
+ if a:find_matching && msg['match'] == '0'
+ continue
+ endif
if lnum <= msg['start']
continue
endif
@@ -426,10 +429,13 @@ function! s:NM_show_previous(can_change_thread)
endif
endfunction
-function! s:NM_show_next(can_change_thread)
+function! s:NM_show_next(can_change_thread, find_matching)
let info = b:nm_raw_info
let lnum = line('.')
for msg in info['msgs']
+ if a:find_matching && msg['match'] == '0'
+ continue
+ endif
if lnum >= msg['start']
continue
endif