sponsor Vim development Vim logo Vim Book Ad

mail.tgz : mail plugin for vim

 script karma  Rating 43/22, Downloaded by 2526  Comments, bugs, improvements  Vim wiki

created by
brian medley
 
script type
ftplugin
 
description
This plugin's purpose is helping with mail editing.  It has two major roles.
The first is email address retrievel and the second is added functionality
while editing.

Below is a description of the user callable functions in this plugin.

Email address retrieval
=================

MailAliasList
------------------

This routine is designed to run an external program, allow the user to select
a bunch of emails, and then these emails are returned in a comma seperated
list.  For example, suppose the following line exists (the cursor is at the
caret):

    To:
          ^

If the user hits '\al' then the currently configured program launches and the
plugin will wait for the email list to be retrieved.  At present, only Abook
is supported in this manner.  Patches are welcome.
        
MailAliasQuery
---------------------

This routine is designed to take the <cword> under the cursor and do a lookup
on it.  This lookup should return a mutt email query, for example, given the
following:

    To: john
          ^

If the user hits \aq, then the plugin will go out and attempt to lookup "john"
in the current alias source.  Currently, all sources work with this mode.

Formatting
========

MailFormatQuote
-------------------------

Format a quote segment using QuoteMotion1.

MailFormatLine
----------------------

Formats the current line.

MailFormatMerge
-------------------------

Conjoins the current line with the previous line.

MailFormatParagraph
-------------------------------

Formats the current paragraph.

Quote Manipulation
==============

MailQuoteEraseSig
----------------------------

This routine will remove quoted signatures.  It always operates over the
entire email.

% | No, I don't agree with you.
%
% Nonsense.  You are wrong.  Grow up.
%
% | I can't believe I'm even replying to this.
% | --
% | Some power user
%
% Yeah, believe it, brother.
% --
% Some other user

will become:

% | No, I don't agree with you.
%
% Nonsense.  You are wrong.  Grow up.
%
% | I can't believe I'm even replying to this.
%
% Yeah, believe it, brother.

MailQuoteFixupSpaces
---------------------------------

This will take a quote segment and try to put spaces in quote blocks where
they don't currently exist.  For example,
    
    >>% hello
    >> bob

would turn into:

    > > % hello
    > > bob

In normal mode the ranger to operate over comes from mail_quote_motion1.

MailQuoteMangledMerge
------------------------------------

This routine will try and make sense out of 'Mangled' quoted paragraph.
For example, it will try and turn

> > starting to look like a distro problem... Anyone
> else
> > having this problem running a different distro
> besides
> > LinuxBlast 8? Anyone tried 8.1 yet?

into:

> > starting to look like a distro problem... Anyone else
> > having this problem running a different distro besides
> > LinuxBlast 8? Anyone tried 8.1 yet?

In normal mode this routine will operate over the current and next line.

MailQuoteDelEmpty
-----------------------------

This will search through the given range and attempt to delete all
lines consisting of a quote block and optional white space.

For example,

% > yellow
% > blue
% >
% yes

will become:

% > yellow
% > blue

% yes

In normal mode this routine will operate over the entire email.

MailQuoteRemoveDpth
----------------------------------

This routine will try and decrease the quote depth of a quote segment by one.
However, it will remove the last layer of quoting.  This is because it is
assumed that the user wants the oldest quote to be gone.

For example,

ab> % > I really
ab> % > like
ab> % > apples

will become:

ab> % I really
ab> % like
ab> % apples

In normal mode the ranger to operate over comes from mail_quote_motion1.

Quote Motions
===========

A quote motion is a vim linewise motion that operates over quotes.  The
default motion character is 'q'.  These motions are analogous to '$', 'E', and
others.  They allow the user to use operator commands over a quote range.  For
example, dq would allow the user to delete the current quote.  This means that

given:

> % Hi                                  <<< cursor on this line,
> % How are you doing?
> % How are things?
> Fine.

And the user hits dq, the text will be transformed into:

> Yeah, It only took a few months.

Or if the user were to hit, dqq, the text would be transformed into:

> % Hi How are you doing?  How are things?
> Yeah, fine.

To re-define the first or define the other two, use something like this:

    omap <silent> <unique> q <Plug>MailQuoteMotion1
    omap <silent> <unique> Q <Plug>MailQuoteMotion2
    omap <silent> <unique> x <Plug>MailQuoteMotion3
 
install details
cd ~/.vim
gzip -dc ~/dl/mail.tgz | tar -xf -
vim -c ":helptags ~/.vim/doc" -c :q
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
mail.tgz 1.9 2003-11-05 6.0 brian medley No longer map the first four function keys by default.

Couple other bugfixes.
ip used for rating: 18.190.156.155

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github