Re: Keep Forgetting Attachments!
Hi there,
On Sat, Jun 19, 2004 at 06:06:03 +0200, Jens Paulus wrote:
> > 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.
another solution are the following mappings.
map <F9> :if exists("attm")<Bar>let attm=attm+1<Bar>else<Bar>let
attm=1<Bar>endif<Bar>call append(attm-1,"Attach:
".getline(line(".")))<Bar>d _<Bar>echo "Added. ".attm." attachment(s)
now."<CR>
map <F10> :if exists("attm")<Bar>1sp<Bar>exe attm."d _"<Bar>clo<Bar>let
attm=attm-1<Bar>echo "Deleted. ".attm." attachment(s) now."<Bar>if
!attm<Bar>unlet attm<Bar>endif<Bar>else<Bar>echo<Bar>endif<CR>
To use them in your ~/.vimrc file press VipJ to join lines first. A
variable is used to keep the right order and when adding or deleting an
attachment display how many attachments you currently have. To add an
attachment write the filename and description in a separate line and
press the F9 key like this.
letter.pdf Please read this carefully
This line is then deleted and becomes an Attach:-line in the header. To
delete an attachment press F10 and the latest entry will be gone.
Let me know if you find this useful.
Best regards
Jens