Skip to content
This repository was archived by the owner on Apr 6, 2024. It is now read-only.
/ vim-mailquery Public archive

complete e-mail addresses in Vim by those found in your Inbox or Sent (or any other mail) folder

Notifications You must be signed in to change notification settings

Konfekt/vim-mailquery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This plug-in lets you complete e-mail addresses in Vim by those found in your inbox (or any other mail folder) via mail-query. Useful, for example, when using Vim as editor for mutt (especially with $edit_headers set).

Usage

When you're editing a mail file in Vim that reads

    From: Fulano <[email protected]>
    To:   foo

and in your Inbox there is an e-mail from

    Mister Foo <[email protected]>

and your cursor is right after foo, then hit Ctrl+X Ctrl+O to obtain:

    From: Fulano <[email protected]>
    To:   Mister Foo <[email protected]>

Commands

To complete an e-mail address inside Vim press CTRL-X CTRL-O in insert mode. See :help i_CTRL-X_CTRL-O and :help compl-omni.

Setup

  1. Download and install (by sudo make install) mail-query. If you are missing superuser rights, then compile it (by make) add the path of the folder that contains the obtained executable mail-query (say ~/bin) to your environment variable $PATH: If you use bash or zsh, by adding to ~/.profile or ~/.zshenv the line

        PATH=$PATH:~/bin

    To decode 7-bit ASCII encoded MIME-headers (which start, for example, with =?UTF-8?Q? or =?ISO-8859-1?Q?), ensure that perl is executable and the Encode::MIME:Header module is installed. Please note that when completing non-ASCII characters, then only UTF-8 encoded non-ASCII characters in the mail folder can be found, but none encoded in ISO-8859-1(5) or any other encoding (common before the advent of UTF-8 in the nineties).

  2. Completion is enabled in all mail buffers by default. Add additional file types to the list g:mailquery_filetypes which defaults to [ 'mail' ]. To enable completion in other buffers, run :MailqueryCompletion.

  3. The mail folder is automatically set to the value of the variable $folder used by mutt. To explicitly set the path to a mail folder $folder, add to your .vimrc the line

    let g:mailquery_folder = '$folder'

    For example, if you use mbsync, then $folder could be

    $XDG_DATA_HOME/mbsync/INBOX/cur
  4. If you would like to filter out most probably impersonal e-mail addresses such as those that come from mailer daemons or accept no reply, then try adding

    let g:mailquery_filter = 1

    to your vimrc, which will discard all e-mail addresses that satisfy the regular expression given by the variable g:mailquery_filter_regex that defaults to

    let g:mailquery_filter_regex = '\v^[[:alnum:]._%+-]*%([0-9]{9,}|([0-9]+[a-z]+){3,}|\+|nicht-?antworten|ne-?pas-?repondre|not?([-_.])?reply|<(un)?subscribe>|<mailer\-daemon>)[[:alnum:]._%+-]*\@'

Related Plug-ins

  • The plugin vim-notmuch-addrlookup lets you complete e-mail addresses in Vim by those indexed by notmuch.
  • The vim-mutt-aliases plug-in lets you complete e-mail addresses in Vim by those in your mutt alias file and (when the alias file is periodically populated by the mutt-alias.sh shell script) gives a more static alternative to this plug-in.

Credits

License

Distributable under the same terms as Vim itself. See :help license.

About

complete e-mail addresses in Vim by those found in your Inbox or Sent (or any other mail) folder

Resources

Stars

Watchers

Forks

Packages

No packages published