[PATCH] vim: Add shift-tab key binding to go to the previous message.
Nicolas Lesser
blitzrakete at gmail.com
Fri Mar 22 10:17:23 PDT 2019
---
vim/notmuch.txt | 1 +
vim/notmuch.vim | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/vim/notmuch.txt b/vim/notmuch.txt
index 43741022..5c5d758e 100644
--- a/vim/notmuch.txt
+++ b/vim/notmuch.txt
@@ -77,6 +77,7 @@ p Save patches
r Reply
? Show thread information
<tab> Show next message
+<s-tab> Show previous message
c Compose a new mail
------------------------------------------------------------------------------
diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index ad8b7c80..ef40b9ad 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -40,6 +40,7 @@ let g:notmuch_show_maps = {
\ 'r': 'show_reply()',
\ '?': 'show_info()',
\ '<Tab>': 'show_next_msg()',
+ \ '<S-Tab>': 'show_prev_msg()',
\ 'c': 'compose()',
\ }
@@ -128,6 +129,20 @@ ruby << EOF
EOF
endfunction
+function! s:show_prev_msg()
+ruby << EOF
+ r, c = $curwin.cursor
+ n = $curbuf.line_number
+ i = $messages.index { |m| n >= m.start && n <= m.end }
+ m = $messages[i - 1]
+ if m
+ r = m.body_start + 1
+ VIM::command("normal #{m.start}zt")
+ $curwin.cursor = r, c
+ end
+EOF
+endfunction
+
function! s:show_reply()
ruby open_reply get_message.mail
let b:compose_done = 0
--
2.21.0
More information about the notmuch
mailing list