Hi Ben!

On Tue, Feb 24, 2009 at 19:48, Ben Fritz dixit:
> On Feb 24, 12:06 pm, Raúl Núñez de Arenas Coronado <[email protected]>
> wrote:
>>
>> I want to automatically modify the format of the attribution line and
>> some details of the signature when replying to emails. This can be done
>> using a couple of simple "s" commands. My problem is on the
>> "automatically" part...
>>
>> For doing the "automatic edition" I've set an autocommand:
>>
>> autocmd BufRead *.eml /pattern/s/something/otherthing/
>
> You mean g/pattern/s/... or %s/..., right?

No, I mean /pattern/s/... That is, perform the substitution only on the
first line that matches that pattern. This is for tweaking the
attribution line (to get rid of email addresses, for example and not
including them in the reply) and I want to change only the first
attribution line, which will be the one inserted by the email client.

>> What am I doing wrong? Is BufRead the problem and then I should use
>> another event? Is the placement the problema and I should put the
>> autocommand in another file? Given that I only want to do the
>> substitution once at the beginning: should I get rid of autocommands and
>> do the job directly in "~/.vim/after/ftplugin/mail.vim" (which is what
>> I'm doing right now)?
>
> One method would be as you suggest: ditch the autocmd.

I'll do that by now.

> If you want to use an autocmd, the following events might work:
>
> BufWinEnter

Yep, I forgot this one, probably due to the name. It sounds like "this
autocommand will be run everytime you enter the window the buffer is
in".

> Filetype

I didn't notice this one in the documentation...

> BufWritePre

This won't work for me, because I want to see the result of the
substitution, just in case it wasn't done right. I don't want to build a
very complex regex to match the attribution line and right now I'm using
a very simple one.

Thanks a lot for the advice :)

Raúl "DervishD" Núñez de Arenas Coronado

Linux Registered User 88736 | http://www.dervishd.net
It's my PC and I'll cry if I want to... RAmen!

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to