X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=vim%2Fplugin%2Fnotmuch.vim;fp=vim%2Fplugin%2Fnotmuch.vim;h=98ddb00ec46aa6b676c9254c958eb9394fc09f57;hp=6b82abedbfe2b9a655021bd6e7d99735f25356fa;hb=81347e289f0e74f7c0d6df98ff90e02aca37a842;hpb=e7899b00d0948f5d8e75b22b9ce82037593ebcdd diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim index 6b82abed..98ddb00e 100644 --- a/vim/plugin/notmuch.vim +++ b/vim/plugin/notmuch.vim @@ -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