Konfekt / mutt-query-complete.vim

Completion of e-mail addresses by mutt's query_command for Vim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When using Vim as editor for mutt (especially with $edit_headers set), this plug-in lets you complete names and email addresses using the mutt address_query tool defined by query_command (such as abook, notmuch-addrlookup, mutt_ldap.py, mutt-ldap.pl, ...).

Usage

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

    From: Lu Guanqun <guanqun.lu@gmail.com>
    To:   foo

and your query tool has an entry

    foo@bar.com Foo Bar

and your cursor is right after foo, then hit Ctrl+X Ctrl+O (which could be remapped, say to Ctrl-Space) to obtain:

    From: Lu Guanqun <guanqun.lu@gmail.com>
    To:   Foo Bar foo@bar.com

Setup

Completion is enabled in all mail buffers by default. Add additional file types to the list g:muttquery_filetypes which defaults to [ 'mail' ].

The mutt query command is automatically set to the value of the variable $query_command used by mutt. To explicitly set the path to a command $command, add to your .vimrc the line

  let g:muttquery_command = '$command

For example, $command could be mutt_ldap.py %s.

As a suggestion, if you use different mail accounts with different query commands, add in .muttrc a folder hook, say for the account mailo,

folder-hook '~/.local/share/mbsync/mailo/' 'source "$XDG_CONFIG_HOME/mutt/accounts/mailo"'

and in "$XDG_CONFIG_HOME/mutt/accounts/mailo" tell Vim about it by

set editor = 'vim +"let g:muttquery_command=\"mutt_ldap.py --config \"$XDG_CONFIG_HOME/mutt-ldap/mailo.cfg\" %%s'

Related:

  • 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. (Best run by a, say weekly, (ana)cronjob.)
  • The plugin vim-notmuch-addrlookup lets you complete e-mail addresses in Vim by those indexed by notmuch.

License

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

About

Completion of e-mail addresses by mutt's query_command for Vim


Languages

Language:Vim Script 100.0%