--- /dev/null
+Return-Path: <imain@stemwinder.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id A7666431FB6\r
+ for <notmuch@notmuchmail.org>; Mon, 6 Oct 2014 10:55:29 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id RpeyiyoK+nQI for <notmuch@notmuchmail.org>;\r
+ Mon, 6 Oct 2014 10:55:24 -0700 (PDT)\r
+Received: from cmta13.telus.net (cmta13.telus.net [209.171.16.86])\r
+ by olra.theworths.org (Postfix) with ESMTP id 17959431FAE\r
+ for <notmuch@notmuchmail.org>; Mon, 6 Oct 2014 10:55:24 -0700 (PDT)\r
+Received: from ovo.mains.priv ([207.102.88.62]) by cmta13.telus.net with TELUS\r
+ id ztvP1o0071LiWEf01tvP9v; Mon, 06 Oct 2014 11:55:23 -0600\r
+X-Authority-Analysis: v=2.0 cv=OrmRPVDt c=1 sm=2\r
+ a=EcQDfIwDZEqJA1f7rVUV8Q==:17 a=S-IsBHyFrF4A:10 a=tsa3CZZnAAAA:8\r
+ a=S3gQTLpqa8hfpVGigeQA:9 a=EcQDfIwDZEqJA1f7rVUV8Q==:117\r
+X-Telus-Outbound-IP: 207.102.88.62\r
+From: Ian Main <imain@stemwinder.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] VIM: Improve moving between messages in a thread\r
+Date: Mon, 6 Oct 2014 10:55:16 -0700\r
+Message-Id: <1412618116-27586-1-git-send-email-imain@stemwinder.org>\r
+X-Mailer: git-send-email 1.9.3\r
+In-Reply-To: <1412579537-7921-1-git-send-email-imain@stemwinder.org>\r
+References: <1412579537-7921-1-git-send-email-imain@stemwinder.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 06 Oct 2014 17:55:29 -0000\r
+\r
+Add a few changes to moving between threads:\r
+\r
+- It supports 'scrolloff' so that if you have this set it will move the\r
+ buffer and cursor so the next/prev email starts at the top of the\r
+ screen.\r
+- It adds the ability to use shift-tab to go to the previous msg in\r
+ the thread.\r
+\r
+ Ian\r
+---\r
+\r
+This update fixes the commit message and removes vim_puts debugging.\r
+\r
+ vim/notmuch.vim | 22 ++++++++++++++++++++--\r
+ 1 file changed, 20 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/vim/notmuch.vim b/vim/notmuch.vim\r
+index 331e930..2124a8e 100644\r
+--- a/vim/notmuch.vim\r
++++ b/vim/notmuch.vim\r
+@@ -39,6 +39,7 @@ let g:notmuch_show_maps = {\r
+ \ 'p': 'show_save_patches()',\r
+ \ 'r': 'show_reply()',\r
+ \ '?': 'show_info()',\r
++ \ '<S-Tab>': 'show_prev_msg()',\r
+ \ '<Tab>': 'show_next_msg()',\r
+ \ 'c': 'compose()',\r
+ \ }\r
+@@ -113,6 +114,22 @@ EOF\r
+ call s:kill_this_buffer()\r
+ endfunction\r
+ \r
++function! s:show_prev_msg()\r
++ruby << EOF\r
++ r, c = $curwin.cursor\r
++ n = $curbuf.line_number\r
++ i = $messages.index { |m| n >= m.start && n <= m.end }\r
++ m = $messages[i - 1] if i > 0\r
++ vim_puts ("messages index is #{i} and m is #{m}")\r
++ if m\r
++ r = m.body_start + 1\r
++ scrolloff = VIM::evaluate("&scrolloff")\r
++ VIM::command("normal #{m.start + scrolloff}zt")\r
++ $curwin.cursor = r + scrolloff, c\r
++ end\r
++EOF\r
++endfunction\r
++\r
+ function! s:show_next_msg()\r
+ ruby << EOF\r
+ r, c = $curwin.cursor\r
+@@ -121,8 +138,9 @@ ruby << EOF\r
+ m = $messages[i + 1]\r
+ if m\r
+ r = m.body_start + 1\r
+- VIM::command("normal #{m.start}zt")\r
+- $curwin.cursor = r, c\r
++ scrolloff = VIM::evaluate("&scrolloff")\r
++ VIM::command("normal #{m.start + scrolloff}zt")\r
++ $curwin.cursor = r + scrolloff, c\r
+ end\r
+ EOF\r
+ endfunction\r
+-- \r
+1.9.3\r
+\r