mirror of
https://github.com/soywod/himalaya.git
synced 2024-11-22 11:00:19 +00:00
update vim readme with new mappings and options
This commit is contained in:
parent
fada081115
commit
ccfc3b0d6e
7 changed files with 80 additions and 24 deletions
|
@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
- Mailbox attributes [#134]
|
- Mailbox attributes [#134]
|
||||||
- Wiki entry about new messages counter [#121]
|
- Wiki entry about new messages counter [#121]
|
||||||
|
- Copy/move/delete a message in vim [#95]
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
@ -241,6 +242,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
[#86]: https://github.com/soywod/himalaya/issues/86
|
[#86]: https://github.com/soywod/himalaya/issues/86
|
||||||
[#87]: https://github.com/soywod/himalaya/issues/87
|
[#87]: https://github.com/soywod/himalaya/issues/87
|
||||||
[#89]: https://github.com/soywod/himalaya/issues/89
|
[#89]: https://github.com/soywod/himalaya/issues/89
|
||||||
|
[#95]: https://github.com/soywod/himalaya/issues/95
|
||||||
[#96]: https://github.com/soywod/himalaya/issues/96
|
[#96]: https://github.com/soywod/himalaya/issues/96
|
||||||
[#100]: https://github.com/soywod/himalaya/issues/100
|
[#100]: https://github.com/soywod/himalaya/issues/100
|
||||||
[#121]: https://github.com/soywod/himalaya/issues/121
|
[#121]: https://github.com/soywod/himalaya/issues/121
|
||||||
|
|
|
@ -23,6 +23,32 @@ It is highly recommanded to have this option on:
|
||||||
set hidden
|
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.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### List messages view
|
### List messages view
|
||||||
|
@ -43,7 +69,10 @@ set hidden
|
||||||
| Reply to the focused msg | `gr` |
|
| Reply to the focused msg | `gr` |
|
||||||
| Reply all to the focused msg | `gR` |
|
| Reply all to the focused msg | `gR` |
|
||||||
| Forward the focused message | `gf` |
|
| Forward the focused message | `gf` |
|
||||||
| Download all focused msg attachments | `ga` |
|
| Download attachments from focused message | `ga` |
|
||||||
|
| Copy the focused message | `gC` |
|
||||||
|
| Move the focused message | `gM` |
|
||||||
|
| Delete the focused message(s) | `gD` |
|
||||||
|
|
||||||
They can be customized:
|
They can be customized:
|
||||||
|
|
||||||
|
@ -57,6 +86,9 @@ nmap gr <plug>(himalaya-msg-reply)
|
||||||
nmap gR <plug>(himalaya-msg-reply-all)
|
nmap gR <plug>(himalaya-msg-reply-all)
|
||||||
nmap gf <plug>(himalaya-msg-forward)
|
nmap gf <plug>(himalaya-msg-forward)
|
||||||
nmap ga <plug>(himalaya-msg-attachments)
|
nmap ga <plug>(himalaya-msg-attachments)
|
||||||
|
nmap gC <plug>(himalaya-msg-copy)
|
||||||
|
nmap gM <plug>(himalaya-msg-move)
|
||||||
|
nmap gD <plug>(himalaya-msg-delete)
|
||||||
```
|
```
|
||||||
|
|
||||||
### List mailboxes
|
### List mailboxes
|
||||||
|
@ -84,6 +116,9 @@ With [fzf](https://github.com/junegunn/fzf) support:
|
||||||
| Reply all to the msg | `gR` |
|
| Reply all to the msg | `gR` |
|
||||||
| Forward the message | `gf` |
|
| Forward the message | `gf` |
|
||||||
| Download all msg attachments | `ga` |
|
| Download all msg attachments | `ga` |
|
||||||
|
| Copy the message | `gC` |
|
||||||
|
| Move the message | `gM` |
|
||||||
|
| Delete the message | `gD` |
|
||||||
|
|
||||||
They can be customized:
|
They can be customized:
|
||||||
|
|
||||||
|
@ -93,6 +128,9 @@ nmap gr <plug>(himalaya-msg-reply)
|
||||||
nmap gR <plug>(himalaya-msg-reply-all)
|
nmap gR <plug>(himalaya-msg-reply-all)
|
||||||
nmap gf <plug>(himalaya-msg-forward)
|
nmap gf <plug>(himalaya-msg-forward)
|
||||||
nmap ga <plug>(himalaya-msg-attachments)
|
nmap ga <plug>(himalaya-msg-attachments)
|
||||||
|
nmap gC <plug>(himalaya-msg-copy)
|
||||||
|
nmap gM <plug>(himalaya-msg-move)
|
||||||
|
nmap gD <plug>(himalaya-msg-delete)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Write message view
|
### Write message view
|
||||||
|
|
|
@ -70,7 +70,11 @@ function! himalaya#mbox#pick(cb)
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! himalaya#mbox#set(mbox)
|
function! himalaya#mbox#change()
|
||||||
|
call himalaya#mbox#pick("himalaya#mbox#_change")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! himalaya#mbox#_change(mbox)
|
||||||
let s:curr_mbox = a:mbox
|
let s:curr_mbox = a:mbox
|
||||||
let s:curr_page = 0
|
let s:curr_page = 0
|
||||||
call himalaya#msg#list()
|
call himalaya#msg#list()
|
||||||
|
|
|
@ -147,7 +147,11 @@ function! himalaya#msg#forward()
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! himalaya#msg#copy(target_mbox)
|
function! himalaya#msg#copy()
|
||||||
|
call himalaya#mbox#pick("himalaya#msg#_copy")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! himalaya#msg#_copy(target_mbox)
|
||||||
try
|
try
|
||||||
let pos = getpos(".")
|
let pos = getpos(".")
|
||||||
let msg_id = stridx(bufname("%"), "Himalaya messages") == 0 ? s:get_focused_msg_id() : s:msg_id
|
let msg_id = stridx(bufname("%"), "Himalaya messages") == 0 ? s:get_focused_msg_id() : s:msg_id
|
||||||
|
@ -162,7 +166,11 @@ function! himalaya#msg#copy(target_mbox)
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! himalaya#msg#move(target_mbox)
|
function! himalaya#msg#move()
|
||||||
|
call himalaya#mbox#pick("himalaya#msg#_move")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! himalaya#msg#_move(target_mbox)
|
||||||
try
|
try
|
||||||
let msg_id = stridx(bufname("%"), "Himalaya messages") == 0 ? s:get_focused_msg_id() : s:msg_id
|
let msg_id = stridx(bufname("%"), "Himalaya messages") == 0 ? s:get_focused_msg_id() : s:msg_id
|
||||||
let choice = input(printf("Are you sure you want to move the message %d? (y/N) ", msg_id))
|
let choice = input(printf("Are you sure you want to move the message %d? (y/N) ", msg_id))
|
||||||
|
|
|
@ -2,7 +2,7 @@ function! himalaya#shared#bindings#define(bindings)
|
||||||
for [mode, key, name] in a:bindings
|
for [mode, key, name] in a:bindings
|
||||||
let plug = substitute(name, "[#_]", "-", "g")
|
let plug = substitute(name, "[#_]", "-", "g")
|
||||||
let plug = printf("<plug>(himalaya-%s)", plug)
|
let plug = printf("<plug>(himalaya-%s)", plug)
|
||||||
execute printf("%snoremap <silent>%s :call himalaya#%s<cr>", mode, plug, name)
|
execute printf("%snoremap <silent>%s :call himalaya#%s()<cr>", mode, plug, name)
|
||||||
|
|
||||||
if !hasmapto(plug, mode)
|
if !hasmapto(plug, mode)
|
||||||
execute printf("%smap <nowait><buffer>%s %s", mode, key, plug)
|
execute printf("%smap <nowait><buffer>%s %s", mode, key, plug)
|
||||||
|
|
|
@ -5,17 +5,17 @@ setlocal nomodifiable
|
||||||
setlocal nowrap
|
setlocal nowrap
|
||||||
|
|
||||||
call himalaya#shared#bindings#define([
|
call himalaya#shared#bindings#define([
|
||||||
\["n", "gm" , "mbox#pick('himalaya#mbox#set')"],
|
\["n", "gm" , "mbox#change" ],
|
||||||
\["n", "gp" , "mbox#prev_page()" ],
|
\["n", "gp" , "mbox#prev_page" ],
|
||||||
\["n", "gn" , "mbox#next_page()" ],
|
\["n", "gn" , "mbox#next_page" ],
|
||||||
\["n", "<cr>", "msg#read()" ],
|
\["n", "<cr>", "msg#read" ],
|
||||||
\["n", "gw" , "msg#write()" ],
|
\["n", "gw" , "msg#write" ],
|
||||||
\["n", "gr" , "msg#reply()" ],
|
\["n", "gr" , "msg#reply" ],
|
||||||
\["n", "gR" , "msg#reply_all()" ],
|
\["n", "gR" , "msg#reply_all" ],
|
||||||
\["n", "gf" , "msg#forward()" ],
|
\["n", "gf" , "msg#forward" ],
|
||||||
\["n", "ga" , "msg#attachments()" ],
|
\["n", "ga" , "msg#attachments"],
|
||||||
\["n", "gC" , "mbox#pick('himalaya#msg#copy')"],
|
\["n", "gC" , "msg#copy" ],
|
||||||
\["n", "gM" , "mbox#pick('himalaya#msg#move')"],
|
\["n", "gM" , "msg#move" ],
|
||||||
\["n", "gD" , "msg#delete()" ],
|
\["n", "gD" , "msg#delete" ],
|
||||||
\["v", "gD" , "msg#delete()" ],
|
\["v", "gD" , "msg#delete" ],
|
||||||
\])
|
\])
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
syntax on
|
||||||
|
|
||||||
setlocal bufhidden=wipe
|
setlocal bufhidden=wipe
|
||||||
setlocal buftype=nofile
|
setlocal buftype=nofile
|
||||||
setlocal cursorline
|
setlocal cursorline
|
||||||
|
@ -5,12 +7,14 @@ setlocal filetype=mail
|
||||||
setlocal foldexpr=himalaya#shared#thread#fold(v:lnum)
|
setlocal foldexpr=himalaya#shared#thread#fold(v:lnum)
|
||||||
setlocal foldmethod=expr
|
setlocal foldmethod=expr
|
||||||
setlocal nomodifiable
|
setlocal nomodifiable
|
||||||
syntax on
|
|
||||||
|
|
||||||
call himalaya#shared#bindings#define([
|
call himalaya#shared#bindings#define([
|
||||||
\["n", "gw", "msg#write()" ],
|
\["n", "gw", "msg#write" ],
|
||||||
\["n", "gr", "msg#reply()" ],
|
\["n", "gr", "msg#reply" ],
|
||||||
\["n", "gR", "msg#reply_all()" ],
|
\["n", "gR", "msg#reply_all" ],
|
||||||
\["n", "gf", "msg#forward()" ],
|
\["n", "gf", "msg#forward" ],
|
||||||
\["n", "ga", "msg#attachments()"],
|
\["n", "ga", "msg#attachments"],
|
||||||
|
\["n", "gC", "msg#copy" ],
|
||||||
|
\["n", "gM", "msg#move" ],
|
||||||
|
\["n", "gD", "msg#delete" ],
|
||||||
\])
|
\])
|
||||||
|
|
Loading…
Reference in a new issue