unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH 08/21] vim: allow calling with arguments
Date: Sat,  2 Nov 2013 07:55:41 -0600	[thread overview]
Message-ID: <1383400554-1832-9-git-send-email-felipe.contreras@gmail.com> (raw)
In-Reply-To: <1383400554-1832-1-git-send-email-felipe.contreras@gmail.com>

For example:

  :NotMuch date:today

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 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(<f-args>)
 
 " vim: set noexpandtab:
-- 
1.8.4.2+fc1

  parent reply	other threads:[~2013-11-02 14:03 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-02 13:55 [PATCH 00/21] vim: general updates Felipe Contreras
2013-11-02 13:55 ` [PATCH 01/21] vim: run mutt in default term Felipe Contreras
2013-11-02 13:55 ` [PATCH 02/21] vim: don't automatically refresh after tagging Felipe Contreras
2013-11-02 13:55 ` [PATCH 03/21] vim: use notmuch fields Felipe Contreras
2013-11-02 13:55 ` [PATCH 04/21] vim: refactor database handling Felipe Contreras
2013-11-02 13:55 ` [PATCH 05/21] vim: show first message of the thread Felipe Contreras
2013-11-02 13:55 ` [PATCH 06/21] vim: use much clearer sort constant Felipe Contreras
2013-11-02 13:55 ` [PATCH 07/21] vim: add option to save the patches of a patch series Felipe Contreras
2013-11-02 13:55 ` Felipe Contreras [this message]
2013-11-02 13:55 ` [PATCH 09/21] vim: split $email_address Felipe Contreras
2013-11-02 13:55 ` [PATCH 10/21] vim: generate custom message-id Felipe Contreras
2013-11-02 13:55 ` [PATCH 11/21] vim: don't execute search if it's cancelled Felipe Contreras
2013-11-02 13:55 ` [PATCH 12/21] vim: trivial cleanup Felipe Contreras
2013-11-02 13:55 ` [PATCH 13/21] vim: refactor open_reply() Felipe Contreras
2013-11-02 13:55 ` [PATCH 14/21] vim: add option to compose new messages Felipe Contreras
2013-11-02 13:55 ` [PATCH 15/21] vim: rename internal notmuch_rb variables Felipe Contreras
2013-11-02 13:55 ` [PATCH 16/21] vim: rename public " Felipe Contreras
2013-11-02 13:55 ` [PATCH 17/21] vim: move default sets to set_defaults() Felipe Contreras
2013-11-02 13:55 ` [PATCH 18/21] vim: add wrapper for old variable names Felipe Contreras
2013-11-02 13:55 ` [PATCH 19/21] vim: remove unnecessary buffer queue Felipe Contreras
2013-11-02 13:55 ` [PATCH 20/21] vim: check compose is done on delete Felipe Contreras
2013-11-02 13:55 ` [PATCH 21/21] vim: add help file Felipe Contreras
2013-11-08 12:43   ` David Bremner
2013-11-08 13:10     ` Felipe Contreras
2013-11-08 18:03       ` David Bremner
2013-11-08 18:05         ` Felipe Contreras
2013-11-09  0:08           ` David Bremner
2013-11-11 18:11 ` [PATCH 00/21] vim: general updates Felipe Contreras
2013-11-20 12:21   ` David Bremner
2013-11-20 13:31     ` Felipe Contreras
2013-11-20 22:13       ` David Bremner
2013-11-27  6:35         ` Felipe Contreras
2013-11-28 10:26           ` [PATCH] vim: NEWS for vim interface David Bremner
2013-11-29  7:54             ` Tomi Ollila
2013-11-29 11:58             ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1383400554-1832-9-git-send-email-felipe.contreras@gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).