From: Felipe Contreras Date: Sun, 6 Feb 2011 12:53:58 +0000 (+0200) Subject: vim: parse 'from' address X-Git-Tag: debian/0.6_254~162 X-Git-Url: https://git.cworth.org/git?p=notmuch;a=commitdiff_plain;h=81347e289f0e74f7c0d6df98ff90e02aca37a842 vim: parse 'from' address In order to pass it to sendmail. Signed-off-by: Felipe Contreras --- 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