himalaya/vim/README.md

174 lines
4.6 KiB
Markdown
Raw Normal View History

2021-04-18 21:14:53 +00:00
# Vim plugin
2021-04-03 10:12:26 +00:00
## Installation
First you need to install and configure the [himalaya
CLI](https://github.com/soywod/himalaya#installation). Then you can install
2021-04-03 10:23:09 +00:00
this plugin with your favorite plugin manager. For example with
[vim-plug](https://github.com/junegunn/vim-plug), add to your `.vimrc`:
2021-04-03 10:12:26 +00:00
```viml
2021-04-03 10:23:09 +00:00
Plug 'soywod/himalaya', {'rtp': 'vim'}
2021-04-03 10:12:26 +00:00
```
Then:
```viml
:PlugInstall
```
2021-04-23 13:00:34 +00:00
It is highly recommanded to have this option on:
```viml
set hidden
```
## Configuration
### Mailbox picker provider
```vim
let g:himalaya_mailbox_picker = 'native' | 'fzf' | 'telescope'
```
Defines the provider used for picking mailboxes:
- `native`: a vim native input
- `fzf`: https://github.com/junegunn/fzf.vim
- `telescope`: https://github.com/nvim-telescope/telescope.nvim
If no value given, the first loaded (and available) provider will be used (fzf
> telescope > native).
### Telescope preview
```vim
let g:himalaya_telescope_preview_enabled = 0
```
Should enable telescope preview when picking a mailbox with the telescope
provider.
release v0.5.2 (#282) * doc: fix blur in list msg screenshots (#181) * fix a typo in mbox arg (#245) `targetted` to `targeted` 👌🏻 * make inbox, sent and drafts folder customizable (#246) * mbox: make inbox, sent and drafts folder customizable * msg: update send handler parameters order * vim: fix extracting message ids from list (#247) The current method doesn't work because the list uses a fancy line character (`│`) as the separator, not a regular pipe character (`|`). Matching for the first number in the line instead solves the problem and will continue to work regardless of what separator is used. * add new line after printing strings (#251) * init cargo workspace (#252) * init cargo workspaces * nix: fix assets path * doc: update rtp vim plugin * vim: add error message if loading vim plugin from vim/ * init sub crates (#253) * init sub crates * doc: update readme * doc: improve main readme * doc: add links, add missing crate task * doc: update emojis * update cargo lock * implement contact completion with completefunc (#250) This allows users to define a command for contact completion with `g:himalaya_complete_contact_cmd` and trigger it with `<C-x><C-u>` when writing an email. * fix clippy lints (#255) * revert cargo workspace feature * fix nix run (#274) * replace cargo2nix by naersk * add rust-analyzer and rustfmt to nix build inputs * remove wiki from git submodules, update changelog * fix missing range when fetch fails, add more logs (#276) * add missing fix in changelog * remove blank lines and spaces from plain parts (#280) * fix watch command (#271) * remove also tabs from text parts (#280) * pin native-tls minor version (#278) * improve msg sanitization (#280) * fix mbox vim plugin telescope preview (#249) * bump version v0.5.2 * update changelog Co-authored-by: Austin Traver <austintraver@gmail.com> Co-authored-by: Jason Cox <dev@jasoncarloscox.com> Co-authored-by: Gökmen Görgen <gkmngrgn@gmail.com> Co-authored-by: Ethiraric <ethiraric@gmail.com>
2022-02-02 01:21:35 +00:00
### Contact completion
```vim
let g:himalaya_complete_contact_cmd = '<your completion command>'
```
Define the command to use for contact completion. When this is set,
`completefunc` will be set when composing messages so that contacts can be
completed with `<C-x><C-u>`.
The command must print each possible result on its own line. Each line must
contain tab-separated fields; the first must be the email address, and the
second, if present, must be the name. `%s` in the command will be replaced
with the search query.
For example, to complete contacts with khard, you could use
`khard email --remove-first-line --parsable '%s'` as the completion command.
2021-04-03 10:12:26 +00:00
## Usage
### List messages view
```vim
:Himalaya
```
![gif](https://user-images.githubusercontent.com/10437171/110707014-f9ef1580-81f8-11eb-93ad-233010733ca3.gif)
| Function | Default binding |
| --- | --- |
| Change the current mbox | `gm` |
| Show previous page | `gp` |
| Show next page | `gn` |
| Read focused msg | `<Enter>` |
| Write a new msg | `gw` |
| Reply to the focused msg | `gr` |
| Reply all to the focused msg | `gR` |
| Forward the focused message | `gf` |
| Download attachments from focused message | `ga` |
| Copy the focused message | `gC` |
| Move the focused message | `gM` |
| Delete the focused message(s) | `gD` |
2021-04-03 10:12:26 +00:00
They can be customized:
```vim
nmap gm <plug>(himalaya-mbox-input)
nmap gp <plug>(himalaya-mbox-prev-page)
nmap gn <plug>(himalaya-mbox-next-page)
nmap <cr> <plug>(himalaya-msg-read)
nmap gw <plug>(himalaya-msg-write)
nmap gr <plug>(himalaya-msg-reply)
nmap gR <plug>(himalaya-msg-reply-all)
nmap gf <plug>(himalaya-msg-forward)
nmap ga <plug>(himalaya-msg-attachments)
nmap gC <plug>(himalaya-msg-copy)
nmap gM <plug>(himalaya-msg-move)
nmap gD <plug>(himalaya-msg-delete)
2021-04-03 10:12:26 +00:00
```
2021-04-05 21:57:01 +00:00
### List mailboxes
Default behaviour (basic prompt):
![screenshot](https://user-images.githubusercontent.com/10437171/113631817-51eb3180-966a-11eb-8b13-cd1f1f2539ab.jpeg)
With [telescope](https://github.com/nvim-telescope/telescope.nvim) support:
![screenshot](https://user-images.githubusercontent.com/10437171/113631294-86122280-9669-11eb-8074-1c43c36b65a9.jpeg)
With [fzf](https://github.com/junegunn/fzf) support:
![screenshot](https://user-images.githubusercontent.com/10437171/113631382-acd05900-9669-11eb-817d-c28fd5d9574c.jpeg)
2021-04-03 10:12:26 +00:00
### Read message view
![gif](https://user-images.githubusercontent.com/10437171/110708073-7b937300-81fa-11eb-9f4c-5472cea22e21.gif)
| Function | Default binding |
| --- | --- |
| Write a new msg | `gw` |
| Reply to the msg | `gr` |
| Reply all to the msg | `gR` |
| Forward the message | `gf` |
| Download all msg attachments | `ga` |
| Copy the message | `gC` |
| Move the message | `gM` |
| Delete the message | `gD` |
2021-04-03 10:12:26 +00:00
They can be customized:
```vim
nmap gw <plug>(himalaya-msg-write)
nmap gr <plug>(himalaya-msg-reply)
nmap gR <plug>(himalaya-msg-reply-all)
nmap gf <plug>(himalaya-msg-forward)
nmap ga <plug>(himalaya-msg-attachments)
nmap gC <plug>(himalaya-msg-copy)
nmap gM <plug>(himalaya-msg-move)
nmap gD <plug>(himalaya-msg-delete)
2021-04-03 10:12:26 +00:00
```
### Write message view
![gif](https://user-images.githubusercontent.com/10437171/110708795-84387900-81fb-11eb-8f8a-f7e7862e816d.gif)
| Function | Default binding |
| --- | --- |
| Add attachment | `ga` |
They can be customized:
```vim
nmap ga <plug>(himalaya-msg-add-attachment)
```
2021-04-03 10:12:26 +00:00
When you exit this special buffer, you will be prompted 4 choices:
- `Send`: sends the message
- `Draft`: saves the message into the `Drafts` mailbox
- `Quit`: quits the buffer without saving
- `Cancel`: goes back to the message edition