aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim
diff options
context:
space:
mode:
authorGravatar Felipe Contreras <felipe.contreras@gmail.com>2011-02-06 14:53:58 +0200
committerGravatar Felipe Contreras <felipe.contreras@gmail.com>2011-05-04 23:38:38 +0300
commit81347e289f0e74f7c0d6df98ff90e02aca37a842 (patch)
tree95c2de0ef262daec13c3c03ec23f8065809c795e /vim
parente7899b00d0948f5d8e75b22b9ce82037593ebcdd (diff)
vim: parse 'from' address
In order to pass it to sendmail. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Diffstat (limited to 'vim')
-rw-r--r--vim/plugin/notmuch.vim11
1 files changed, 10 insertions, 1 deletions
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