diff options
author | Felipe Contreras <felipe.contreras@gmail.com> | 2013-10-13 23:25:44 -0500 |
---|---|---|
committer | Felipe Contreras <felipe.contreras@gmail.com> | 2013-11-20 07:23:29 -0600 |
commit | a760e4ab47e152a9d3b4fa9b733f82723ebaaefe (patch) | |
tree | 942beb3f9034d1277e55efe4c98897ae48afbf1c /vim | |
parent | 77c2c3143be1f69f10f04f9e5e885a30248c2fd0 (diff) |
vim: allow calling with arguments
For example:
:NotMuch date:today
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Diffstat (limited to 'vim')
-rw-r--r-- | vim/notmuch.vim | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/vim/notmuch.vim b/vim/notmuch.vim index 9cfa795d..aa1b7ef6 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: |