Reformated, let vim wrap lines to make the file easier to edit
This commit is contained in:
parent
85dfeee300
commit
691cb64615
47
README.md
47
README.md
@ -3,25 +3,42 @@
|
|||||||
A vim plugin for mail files to select email addresses from the mutt aliases file, and Google Contacts (using goobook).
|
A vim plugin for mail files to select email addresses from the mutt aliases file, and Google Contacts (using goobook).
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
* This has been tested with the [vim-plug](https://github.com/junegunn/vim-plug) minimalist Vim plugin manager. Other plugin managers may work.
|
* This has been tested with the
|
||||||
* This is designed to work with the [asyncomplete](https://github.com/prabirshrestha/asyncomplete.vim) code completion subsystem, which is writtin in pure Vim (v8) script.
|
[vim-plug](https://github.com/junegunn/vim-plug) minimalist Vim plugin
|
||||||
* [goobook](http://gitlab.com/goobook/goobook) for interacting with your Google Contacts from the command line. This has been tested with Goobook 3.5.2, but 1.x may work if your distribution still uses Python 2.7+.
|
manager. Other plugin managers may work.
|
||||||
* This is designed to work in mutt, but is not mutt-specific (except for reading _${HOME}/.mutt/aliases_). Using vim to edit the file type `mail` should be enough to get it working.
|
* This is designed to work with the
|
||||||
|
[asyncomplete](https://github.com/prabirshrestha/asyncomplete.vim) code
|
||||||
|
completion subsystem, which is writtin in pure Vim (v8) script.
|
||||||
|
* [goobook](http://gitlab.com/goobook/goobook) for interacting with your Google
|
||||||
|
Contacts from the command line. This has been tested with Goobook 3.5.2, but
|
||||||
|
1.x may work if your distribution still uses Python 2.7+.
|
||||||
|
* This is designed to work in mutt, but is not mutt-specific (except for
|
||||||
|
reading _${HOME}/.mutt/aliases_). Using vim to edit the file type `mail`
|
||||||
|
should be enough to get it working.
|
||||||
|
|
||||||
As of this writing (2023-04-30), this has only been tested in Vim v9, but is also writtin in Vim v8 script so should work in older versions.
|
As of this writing (2023-04-30), this has only been tested in Vim v9, but is
|
||||||
|
also writtin in Vim v8 script so should work in older versions.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
1. Clone this repository into your Vim plugin directory. For vim-plug in Vim on Linux, this is usually _${HOME}/.vim/plugged_, but vim-plug will place it here automatically if you merely configure $MYVIMRC properly. Place the following line between `call plug#begin(..)` and `call plug#end()`:
|
1. Clone this repository into your Vim plugin directory. For vim-plug in Vim
|
||||||
|
on Linux, this is usually _${HOME}/.vim/plugged_, but vim-plug will place
|
||||||
|
it here automatically if you merely configure $MYVIMRC properly. Place the
|
||||||
|
following line between `call plug#begin(..)` and `call plug#end()`:
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
call plug#begin('...')
|
call plug#begin('...')
|
||||||
" ...
|
" ...
|
||||||
Plug 'https://git.eldon.me/trey/asyncomplete-muttgoobook.vim'
|
Plug 'https://git.eldon.me/trey/asyncomplete-muttgoobook.vim'
|
||||||
|
|
||||||
" ...
|
" ...
|
||||||
call plug#end()
|
call plug#end()
|
||||||
```
|
```
|
||||||
Then, inside Vim, run `:PlugInstall`. You can check that the muttgoobook plugin is installed successfully with `:PlugStatus`.
|
|
||||||
1. Configure Vim in $MYVIMRC to load the `muttgoobook` source using the following:
|
Then, inside Vim, run `:PlugInstall`. You can check that the muttgoobook
|
||||||
|
plugin is installed successfully with `:PlugStatus`.
|
||||||
|
|
||||||
|
1. Configure Vim in $MYVIMRC to load the `muttgoobook` source using the
|
||||||
|
following:
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
autocmd User asyncomplete_setup call asyncomplete#register_source({
|
autocmd User asyncomplete_setup call asyncomplete#register_source({
|
||||||
\ 'name': 'muttgoobook',
|
\ 'name': 'muttgoobook',
|
||||||
@ -29,7 +46,9 @@ As of this writing (2023-04-30), this has only been tested in Vim v9, but is als
|
|||||||
\ 'completor': function('asyncomplete#sources#muttgoobook#completor'),
|
\ 'completor': function('asyncomplete#sources#muttgoobook#completor'),
|
||||||
\ })
|
\ })
|
||||||
```
|
```
|
||||||
If you want to have other file types to use this plugin, you may add them to the `allowlist` above.
|
|
||||||
|
If you want to have other file types to use this plugin, you may add them
|
||||||
|
to the `allowlist` above.
|
||||||
|
|
||||||
1. By default, this plugin tries to determine if the cursor is in an email
|
1. By default, this plugin tries to determine if the cursor is in an email
|
||||||
address field ('From:', 'To:', 'Cc:', 'Bcc:', in English). The matching is
|
address field ('From:', 'To:', 'Cc:', 'Bcc:', in English). The matching is
|
||||||
@ -37,14 +56,20 @@ As of this writing (2023-04-30), this has only been tested in Vim v9, but is als
|
|||||||
differently, you can modify this in $MYVIMRC by adding the
|
differently, you can modify this in $MYVIMRC by adding the
|
||||||
`g:muttgoobook_address_fields` global variable. This is designed to be a
|
`g:muttgoobook_address_fields` global variable. This is designed to be a
|
||||||
Vim regular expression, replace `['from', 'to', 'b\?cc']` accordingly:
|
Vim regular expression, replace `['from', 'to', 'b\?cc']` accordingly:
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
let g:muttgoobook_address_fields = '^\s*\(from\|to\|b\?cc\):\s*'
|
let g:muttgoobook_address_fields = '^\s*\(from\|to\|b\?cc\):\s*'
|
||||||
```
|
```
|
||||||
|
|
||||||
The above pattern is the default if this variable isn't specified.
|
The above pattern is the default if this variable isn't specified.
|
||||||
1. Also, if your mutt aliases file is in a different path than
|
1. Also, if your mutt aliases file is in a different path than
|
||||||
_${HOME}/.mutt/aliases_, you can override it in $MYVIMRC with the global
|
_${HOME}/.mutt/aliases_, you can override it in $MYVIMRC with the global
|
||||||
variable `g:mutt_aliases`: ```vim let g:mutt_aliases = '~/.mutt/aliases'
|
variable `g:mutt_aliases`:
|
||||||
|
|
||||||
|
```vim
|
||||||
|
let g:mutt_aliases = '~/.mutt/aliases'
|
||||||
```
|
```
|
||||||
|
|
||||||
Again, what appears above is the default if not set explicitly to
|
Again, what appears above is the default if not set explicitly to
|
||||||
something else. Any double-quotes (`"`) and backslashes (`\`) in the mutt
|
something else. Any double-quotes (`"`) and backslashes (`\`) in the mutt
|
||||||
aliases file will be removed before pasting the results of the completion
|
aliases file will be removed before pasting the results of the completion
|
||||||
|
Loading…
Reference in New Issue
Block a user