From 81347e289f0e74f7c0d6df98ff90e02aca37a842 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Sun, 6 Feb 2011 14:53:58 +0200 Subject: [PATCH] vim: parse 'from' address In order to pass it to sendmail. Signed-off-by: Felipe Contreras --- vim/plugin/notmuch.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 -- 2.43.0