From: Felipe Contreras Date: Sat, 2 Nov 2013 13:55:41 +0000 (+1800) Subject: [PATCH 08/21] vim: allow calling with arguments X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=530af175bcd8312ecf11b6aa11f97e390ba332fc;p=notmuch-archives.git [PATCH 08/21] vim: allow calling with arguments --- diff --git a/86/7b143f079643fb183cc105fb52362f52d63288 b/86/7b143f079643fb183cc105fb52362f52d63288 new file mode 100644 index 000000000..289514793 --- /dev/null +++ b/86/7b143f079643fb183cc105fb52362f52d63288 @@ -0,0 +1,123 @@ +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 27EB3429E3A + for ; Sat, 2 Nov 2013 07:03:41 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.799 +X-Spam-Level: +X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 9AYNo2pR5rd7 for ; + Sat, 2 Nov 2013 07:03:36 -0700 (PDT) +Received: from mail-oa0-f53.google.com (mail-oa0-f53.google.com + [209.85.219.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id ABC7A429E42 + for ; Sat, 2 Nov 2013 07:02:57 -0700 (PDT) +Received: by mail-oa0-f53.google.com with SMTP id n12so5608288oag.40 + for ; Sat, 02 Nov 2013 07:02:57 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:in-reply-to:references; + bh=QYBn6TMY4w2fUbM01XcsddSs2LoB2WyWQUp98+z3tG8=; + b=gSrDlLwpEIQ5I4zALwdX1nlhaAlmEIUN418Rip55Wvgp/XRTR/cdk4hlmtgdondDGK + ipBOapD4Md7HsdWrCrLNx8xFIzfpbIOAQYzTsrjS8bimR0iCo8tJ8Pnyun70Dfh8BBcE + EnmLiwOtoZ3cgsGYMDj1RqY95cEJ9eOuOHRsSShOaz/crPG2JY71Yzmv8eF+HAjz0YYd + Eb1DDWfoX65JP59AEBkVrTfjGHED5JK18IyZ1gflbYhAnOi8bjUsGKSPw12UGGP2DTlR + FLyBzk4RJc7JhhkvwdactdIWSR+toX9zrmZ72qCPTy59KNjTWWmACu+/UPqHVeQp1X12 + 6uPA== +X-Received: by 10.60.133.233 with SMTP id pf9mr1410442oeb.46.1383400977183; + Sat, 02 Nov 2013 07:02:57 -0700 (PDT) +Received: from localhost (187-162-140-241.static.axtel.net. [187.162.140.241]) + by mx.google.com with ESMTPSA id + ee7sm24743429oeb.5.2013.11.02.07.02.55 for + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Sat, 02 Nov 2013 07:02:56 -0700 (PDT) +From: Felipe Contreras +To: notmuch@notmuchmail.org +Subject: [PATCH 08/21] vim: allow calling with arguments +Date: Sat, 2 Nov 2013 07:55:41 -0600 +Message-Id: <1383400554-1832-9-git-send-email-felipe.contreras@gmail.com> +X-Mailer: git-send-email 1.8.4.2+fc1 +In-Reply-To: <1383400554-1832-1-git-send-email-felipe.contreras@gmail.com> +References: <1383400554-1832-1-git-send-email-felipe.contreras@gmail.com> +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: Sat, 02 Nov 2013 14:03:41 -0000 + +For example: + + :NotMuch date:today + +Signed-off-by: Felipe Contreras +--- + vim/notmuch.vim | 22 ++++++++++++++-------- + 1 file changed, 14 insertions(+), 8 deletions(-) + +diff --git a/vim/notmuch.vim b/vim/notmuch.vim +index 9cfa795..aa1b7ef 100644 +--- a/vim/notmuch.vim ++++ b/vim/notmuch.vim +@@ -273,12 +273,14 @@ function! s:show_next_thread() + endfunction + + function! s:kill_this_buffer() +- ruby $curbuf.close +- bdelete! + ruby << EOF +- $buf_queue.pop +- b = $buf_queue.last +- VIM::command("buffer #{b}") if b ++ if $buf_queue.size > 1 ++ $curbuf.close ++ VIM::command("bdelete!") ++ $buf_queue.pop ++ b = $buf_queue.last ++ VIM::command("buffer #{b}") if b ++ end + EOF + endfunction + +@@ -412,7 +414,7 @@ function! s:set_defaults() + endif + endfunction + +-function! s:NotMuch() ++function! s:NotMuch(...) + call s:set_defaults() + + ruby << EOF +@@ -863,9 +865,13 @@ ruby << EOF + + get_config + EOF +- call s:folders() ++ if a:0 ++ call s:search(join(a:000)) ++ else ++ call s:folders() ++ endif + endfunction + +-command NotMuch :call s:NotMuch() ++command -nargs=* NotMuch call s:NotMuch() + + " vim: set noexpandtab: +-- +1.8.4.2+fc1 +