]> git.notmuchmail.org Git - notmuch/blobdiff - vim/plugin/notmuch.vim
vim: parse 'from' address
[notmuch] / vim / plugin / notmuch.vim
index 6b82abedbfe2b9a655021bd6e7d99735f25356fa..98ddb00ec46aa6b676c9254c958eb9394fc09f57 100644 (file)
@@ -962,7 +962,16 @@ function! s:NM_compose_send()
         exec printf(':0,%dd', hdr_starts)
         write
 
-        let cmdtxt = g:notmuch_sendmail . ' -t < ' . fname
+        let line = getline(1)
+        let m = matchlist(line, '^From:\s*\(.*\)\s*<\(.*\)>$')
+        if (len(m) >= 2)
+                let from = m[2]
+        else
+                let m = matchlist(line, '^From:\s*\(.*\)$')
+                let from = m[1]
+        endif
+
+        let cmdtxt = g:notmuch_sendmail . ' -t -f ' . from . ' < ' . fname
         let out = system(cmdtxt)
         let err = v:shell_error
         if err