<<< Date Index >>>     <<< Thread Index >>>

Re: Keep Forgetting Attachments!



Hi there,

On Thu, Jun 17, 2004 at 17:33:41 -0500, The Doctor What wrote:
> > >   2.4.1.  Editing the message header
> > > 
> > >   When editing the header of your outgoing message, there are a couple
> > >   of special features available.
> > > 
> > > [...]
> > > 
> > >   You can also attach files to your message by specifying
> > >   Attach: filename  [ description ]
> > >   where filename is the file to attach and description is an optional
> > >   string to use as the description of the attached file.
> > > 
> > > [...]
> > > 
> > >   Also see `edit_headers''.
> > 
> > Genius! I had no idea!  Cool!
> 
> Well, I have one problem.  Without mutt doing it, then I have to
> remember the path to the file.  Also, is the filename relative to my
> home directory, current directory, or what.  Will it accept ~
> notation?
> 
> I would ask two things:
> 1) Maybe mutt could catch the header "Attach: ask" and then go
> through a screen to ask for the attachment (as if I had pressed 'a'
> after exiting the browser).
> 
> 2) Anyone have a macro for vim to generate this header?

well, there many possibilities for such a mapping.

Put the filename and description in braces like {letter.pdf Please read
this carefully} in your message body and hit <F9> with the cursor on it
with this mapping.

map <F9> m'viBJ``diB"_daw1<C-W>sgg}OAttach: <C-R>-<Esc><C-W>c<C-Y>

If you want to have the attachments listed in reverse order then you can
use this mapping.

map <F9> m'viBJ``diB"_daw:call append(0,"Attach: ".@-)<CR>

Both mappings delete the block in braces when they are executed and
create the Attach:-line in the header when edit_headers is set.

The block in braces can have line breaks in it. If you put the mapping
in your ~/.vimrc file it is loaded automatically. If you prefer brackets
or parenthesis instead of braces to make the block then replace the B
characters with the [ or the b character.

Let me know if you find this useful.

Best regards

Jens