diff options
author | Felipe Contreras <felipe.contreras@gmail.com> | 2011-02-06 14:53:58 +0200 |
---|---|---|
committer | Felipe Contreras <felipe.contreras@gmail.com> | 2011-05-04 23:38:38 +0300 |
commit | 81347e289f0e74f7c0d6df98ff90e02aca37a842 (patch) | |
tree | 95c2de0ef262daec13c3c03ec23f8065809c795e | |
parent | e7899b00d0948f5d8e75b22b9ce82037593ebcdd (diff) |
vim: parse 'from' address
In order to pass it to sendmail.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
-rw-r--r-- | vim/plugin/notmuch.vim | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim index 6b82abe..98ddb00 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 |