]> git.notmuchmail.org Git - notmuch/blobdiff - vim/notmuch.vim
vim: split $email_address
[notmuch] / vim / notmuch.vim
index 9cfa795d3d36e2d1652709b057d4f6aa802f38ca..4bd5f131aa564a9f4176d2f527ef511a03c32443 100644 (file)
@@ -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
@@ -425,7 +427,7 @@ ruby << EOF
        end
 
        $db_name = nil
-       $email_address = nil
+       $email = $email_name = $email_address = nil
        $searches = []
        $buf_queue = []
        $threads = []
@@ -450,7 +452,9 @@ ruby << EOF
                end
 
                $db_name = $config['database.path']
-               $email_address = "%s <%s>" % [$config['user.name'], $config['user.primary_email']]
+               $email_name = $config['user.name']
+               $email_address = $config['user.primary_email']
+               $email = "%s <%s>" % [$email_name, $email_address]
        end
 
        def vim_puts(s)
@@ -500,7 +504,7 @@ ruby << EOF
                                m.to = [orig[:from].to_s, orig[:to].to_s]
                        end
                        m.cc = orig[:cc]
-                       m.from = $email_address
+                       m.from = $email
                        m.charset = 'utf-8'
                        m.content_transfer_encoding = '7bit'
                end
@@ -863,9 +867,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: