From: Ian Main Date: Mon, 6 Oct 2014 07:12:17 +0000 (+1700) Subject: [PATCH] Improve moving between messages in a thread X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8d113cf38519a43633252128b227b39e4642795c;p=notmuch-archives.git [PATCH] Improve moving between messages in a thread --- diff --git a/d0/1fb0929149c019aa239dd73da0ac1dac6f2803 b/d0/1fb0929149c019aa239dd73da0ac1dac6f2803 new file mode 100644 index 000000000..0207beceb --- /dev/null +++ b/d0/1fb0929149c019aa239dd73da0ac1dac6f2803 @@ -0,0 +1,110 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 1845B431FB6 + for ; Mon, 6 Oct 2014 00:12:31 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id RoBf3Vig8n3G for ; + Mon, 6 Oct 2014 00:12:27 -0700 (PDT) +Received: from cmta2.telus.net (cmta2.telus.net [209.171.16.75]) + by olra.theworths.org (Postfix) with ESMTP id 5E7CF431FAE + for ; Mon, 6 Oct 2014 00:12:27 -0700 (PDT) +Received: from ovo.mains.priv ([207.102.88.62]) by cmta2.telus.net with TELUS + id zjCR1o00G1LiWEf01jCRqh; Mon, 06 Oct 2014 01:12:26 -0600 +X-Authority-Analysis: v=2.0 cv=ErcMW1gA c=1 sm=2 + a=EcQDfIwDZEqJA1f7rVUV8Q==:17 a=S-IsBHyFrF4A:10 a=tsa3CZZnAAAA:8 + a=luRVYIaq7LDw4LXNCHgA:9 a=EcQDfIwDZEqJA1f7rVUV8Q==:117 +X-Telus-Outbound-IP: 207.102.88.62 +From: Ian Main +To: notmuch@notmuchmail.org +Subject: [PATCH] Improve moving between messages in a thread +Date: Mon, 6 Oct 2014 00:12:17 -0700 +Message-Id: <1412579537-7921-1-git-send-email-imain@stemwinder.org> +X-Mailer: git-send-email 1.9.3 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 06 Oct 2014 07:12:31 -0000 + +This patch adds a few changes to moving between threads: + +- It supports 'scrolloff' so that if you have this set it will move the + buffer and cursor so the next/prev email starts at the top of the + screen. +- It adds the ability to use shift-tab to go to the previous msg in + the thread. + + Ian +--- + vim/notmuch.vim | 24 ++++++++++++++++++++++-- + 1 file changed, 22 insertions(+), 2 deletions(-) + +diff --git a/vim/notmuch.vim b/vim/notmuch.vim +index 331e930..95e5c4b 100644 +--- a/vim/notmuch.vim ++++ b/vim/notmuch.vim +@@ -39,6 +39,7 @@ let g:notmuch_show_maps = { + \ 'p': 'show_save_patches()', + \ 'r': 'show_reply()', + \ '?': 'show_info()', ++ \ '': 'show_prev_msg()', + \ '': 'show_next_msg()', + \ 'c': 'compose()', + \ } +@@ -113,6 +114,23 @@ EOF + call s:kill_this_buffer() + 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 i > 0 ++ vim_puts ("messages index is #{i} and m is #{m}") ++ if m ++ r = m.body_start + 1 ++ scrolloff = VIM::evaluate("&scrolloff") ++ VIM::command("normal #{m.start + scrolloff}zt") ++ $curwin.cursor = r + scrolloff, c ++ vim_puts("moving to #{m.start + scrolloff}") ++ end ++EOF ++endfunction ++ + function! s:show_next_msg() + ruby << EOF + r, c = $curwin.cursor +@@ -121,8 +139,10 @@ ruby << EOF + m = $messages[i + 1] + if m + r = m.body_start + 1 +- VIM::command("normal #{m.start}zt") +- $curwin.cursor = r, c ++ scrolloff = VIM::evaluate("&scrolloff") ++ VIM::command("normal #{m.start + scrolloff}zt") ++ $curwin.cursor = r + scrolloff, c ++ vim_puts("moving to #{m.start + scrolloff}") + end + EOF + endfunction +-- +1.9.3 +