--- /dev/null
+Return-Path: <imain@stemwinder.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 52576431FBC\r
+ for <notmuch@notmuchmail.org>; Mon, 6 Oct 2014 11:10:45 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id oawazNFRnSiG for <notmuch@notmuchmail.org>;\r
+ Mon, 6 Oct 2014 11:10:39 -0700 (PDT)\r
+Received: from cmta9.telus.net (cmta9.telus.net [209.171.16.82])\r
+ by olra.theworths.org (Postfix) with ESMTP id B7208431FAE\r
+ for <notmuch@notmuchmail.org>; Mon, 6 Oct 2014 11:10:39 -0700 (PDT)\r
+Received: from ovo.mains.priv ([207.102.88.62]) by cmta9.telus.net with TELUS\r
+ id zuAe1o05H1LiWEf01uAehs; Mon, 06 Oct 2014 12:10:39 -0600\r
+X-Authority-Analysis: v=2.0 cv=KNmE+i5o c=1 sm=2\r
+ a=EcQDfIwDZEqJA1f7rVUV8Q==:17 a=S-IsBHyFrF4A:10 a=tsa3CZZnAAAA:8\r
+ a=Z2xPzeXNZ0CE_Iho6mIA:9 a=EcQDfIwDZEqJA1f7rVUV8Q==:117\r
+X-Telus-Outbound-IP: 207.102.88.62\r
+From: Ian Main <imain@stemwinder.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] VIM: Make an option to save sent mail locally\r
+Date: Mon, 6 Oct 2014 11:10:36 -0700\r
+Message-Id: <1412619036-29203-1-git-send-email-imain@stemwinder.org>\r
+X-Mailer: git-send-email 1.9.3\r
+In-Reply-To: <1412617904-27252-1-git-send-email-imain@stemwinder.org>\r
+References: <1412617904-27252-1-git-send-email-imain@stemwinder.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 06 Oct 2014 18:10:45 -0000\r
+\r
+Add an option to use 'notmuch insert' to save your sent mail.\r
+---\r
+\r
+Add -inbox as well.\r
+\r
+ vim/notmuch.vim | 17 +++++++++++++++++\r
+ 1 file changed, 17 insertions(+)\r
+\r
+diff --git a/vim/notmuch.vim b/vim/notmuch.vim\r
+index 331e930..a9044c4 100644\r
+--- a/vim/notmuch.vim\r
++++ b/vim/notmuch.vim\r
+@@ -58,6 +58,7 @@ let s:notmuch_date_format_default = '%d.%m.%y'\r
+ let s:notmuch_datetime_format_default = '%d.%m.%y %H:%M:%S'\r
+ let s:notmuch_reader_default = 'mutt -f %s'\r
+ let s:notmuch_sendmail_default = 'sendmail'\r
++let s:notmuch_save_sent_locally_default = 1\r
+ let s:notmuch_folders_count_threads_default = 0\r
+ \r
+ function! s:new_file_buffer(type, fname)\r
+@@ -108,6 +109,18 @@ EOF\r
+ echohl None\r
+ return\r
+ endif\r
++\r
++ if g:notmuch_save_sent_locally\r
++ let out = system('cat ' . fname . ' | notmuch insert --create-folder --folder=Sent +sent -unread -inbox')\r
++ let err = v:shell_error\r
++ if err\r
++ echohl Error\r
++ echo 'Eeek! unable to save sent mail'\r
++ echo out\r
++ echohl None\r
++ return\r
++ endif\r
++ endif\r
+ call delete(fname)\r
+ echo 'Mail sent successfully.'\r
+ call s:kill_this_buffer()\r
+@@ -388,6 +401,10 @@ endfunction\r
+ "" root\r
+ \r
+ function! s:set_defaults()\r
++ if !exists('g:notmuch_save_sent_locally')\r
++ let g:notmuch_save_sent_locally = s:notmuch_save_sent_locally_default\r
++ endif\r
++\r
+ if !exists('g:notmuch_date_format')\r
+ if exists('g:notmuch_rb_date_format')\r
+ let g:notmuch_date_format = g:notmuch_rb_date_format\r
+-- \r
+1.9.3\r
+\r