---
 vim/notmuch.vim | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 34d4f92..4f90d79 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -39,7 +39,8 @@ let g:notmuch_show_maps = {
        \ 'p':          'show_save_patches()',
        \ 'r':          'show_reply()',
        \ '?':          'show_info()',
-       \ '<Tab>':      'show_next_msg()',
+       \ '<Tab>':      'show_next_msg(1)',
+       \ '<S-Tab>':    'show_next_msg(-1)',
        \ 'c':          'compose()',
        \ }

@@ -114,15 +115,18 @@ EOF
        call s:kill_this_buffer()
 endfunction

-function! s:show_next_msg()
+function! s:show_next_msg(inc)
 ruby << EOF
+       inc = VIM::evaluate('a:inc')
        r, c = $curwin.cursor
        n = $curbuf.line_number
        i = $messages.index { |m| n >= m.start && n <= m.end }
-       m = $messages[i + 1]
-       if m
+       m = $messages[i + inc]
+       if m and !((i + inc)<0) 
                r = m.body_start + 1
+               VIM::command("normal zM")
                VIM::command("normal #{m.start}zt")
+               VIM::command("normal zo")
                $curwin.cursor = r, c
        end
 EOF
-- 
1.9.3 (Apple Git-50)

Reply via email to