* [PATCH] vim: Add shift-tab key binding to go to the previous message.
@ 2019-03-22 17:17 Nicolas Lesser
0 siblings, 0 replies; only message in thread
From: Nicolas Lesser @ 2019-03-22 17:17 UTC (permalink / raw)
To: notmuch
---
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-03-22 17:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22 17:17 [PATCH] vim: Add shift-tab key binding to go to the previous message Nicolas Lesser
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).