Hi Eric!

On Fr, 09 Nov 2012, Eric Smith wrote:

> How do I get the sender's name to whom I am replying in the vim
> statusline?

That is not easy. You must rely on parsing the attribution line.

Say your attribution line looks like mine:

#v+
~$ grep attribution ~/.mutt/muttrc
set  attribution='Hi %v!\n\nOn %{%a, %d %b %Y}, %n wrote:\n'
~$
#v-

Now create a ~/.vim/after/ftplugin/mail.vim (create directories that 
don't exist yet) and put into it:

let _a = winsaveview()
if exists("b:mutt_from_statusline")
     finish
endif
0

if &ft == 'mail'
    let &l:stl = (&l:stl ? &l:stl : &g:stl) . '[From: '. 
matchstr(getline(search('^On.*, \(.*\)wrote:$')), '.*, \zs.*\ze wrote:$'). ']'
    let b:mutt_from_statusline=1
endif
call winrestview(_a)


regards,
Christian
-- 
By failing to prepare, you are preparing to fail.

Reply via email to