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>
This commit is contained in:
Clément DOUIN
2022-02-02 02:21:35 +01:00
committed by GitHub
parent f9775ae8af
commit 8cdeba62a1
34 changed files with 494 additions and 487 deletions
+18
View File
@@ -49,6 +49,24 @@ let g:himalaya_telescope_preview_enabled = 0
Should enable telescope preview when picking a mailbox with the telescope
provider.
### 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.
## Usage
### List messages view
+48 -2
View File
@@ -305,6 +305,37 @@ function! himalaya#msg#attachments()
endtry
endfunction
function! himalaya#msg#complete_contact(findstart, base)
try
if a:findstart
if !exists("g:himalaya_complete_contact_cmd")
echoerr "You must set 'g:himalaya_complete_contact_cmd' to complete contacts"
return -3
endif
" search for everything up to the last colon or comma
let line_to_cursor = getline(".")[:col(".") - 1]
let start = match(line_to_cursor, '[^:,]*$')
" don't include leading spaces
while start <= len(line_to_cursor) && line_to_cursor[start] == " "
let start += 1
endwhile
return start
else
let output = system(substitute(g:himalaya_complete_contact_cmd, "%s", a:base, ""))
let lines = split(output, "\n")
return map(lines, "s:line_to_complete_item(v:val)")
endif
catch
if !empty(v:exception)
redraw | call himalaya#shared#log#err(v:exception)
endif
endtry
endfunction
" Utils
" https://newbedev.com/get-usable-window-width-in-vim-script
@@ -326,9 +357,13 @@ function! s:bufwidth()
return width - numwidth - foldwidth - signwidth
endfunction
function! s:get_msg_id(line)
return matchstr(a:line, '[0-9]*')
endfunction
function! s:get_focused_msg_id()
try
return s:trim(split(getline("."), "|")[0])
return s:get_msg_id(getline("."))
catch
throw "message not found"
endtry
@@ -336,7 +371,7 @@ endfunction
function! s:get_focused_msg_ids(from, to)
try
return join(map(range(a:from, a:to), "s:trim(split(getline(v:val), '|')[0])"), ",")
return join(map(range(a:from, a:to), "s:get_msg_id(getline(v:val))"), ",")
catch
throw "messages not found"
endtry
@@ -349,3 +384,14 @@ function! s:close_open_buffers(name)
execute ":bwipeout " . buffer_to_close
endfor
endfunction
function! s:line_to_complete_item(line)
let fields = split(a:line, "\t")
let email = fields[0]
let name = ""
if len(fields) > 1
let name = '"' . fields[1] . '" '
endif
return name . "<" . email . ">"
endfunction
+18 -1
View File
@@ -1,4 +1,4 @@
*himalaya.txt* - CLI email client
*himalaya.txt* - Command-line interface for email management
_/ _/ _/_/_/ _/ _/ _/_/ _/ _/_/ _/ _/ _/_/
_/ _/ _/ _/_/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/
@@ -46,6 +46,23 @@ TELESCOPE PREVIEW
Should enable telescope preview when picking a mailbox with the telescope
provider.
------------------------------------------------------------------------------
CONTACT COMPLETION
>
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 |i_CTRL-X_CTRL-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.
==============================================================================
USAGE *himalaya-usage*
+4
View File
@@ -3,6 +3,10 @@ setlocal foldexpr=himalaya#shared#thread#fold(v:lnum)
setlocal foldmethod=expr
setlocal startofline
if exists("g:himalaya_complete_contact_cmd")
setlocal completefunc=himalaya#msg#complete_contact
endif
augroup himalaya_write
autocmd! * <buffer>
autocmd BufWriteCmd <buffer> call himalaya#msg#draft_save()
+1 -1
View File
@@ -10,7 +10,7 @@ local previewers = require('telescope.previewers')
local function preview_command(entry, bufnr)
vim.api.nvim_buf_call(bufnr, function()
local page = 0 -- page 0 for preview
local account = pcall(vim.fn['himalaya#account#curr'])
local account = vim.fn['himalaya#account#curr']()
local success, output = pcall(vim.fn['himalaya#msg#list_with'], account, entry.value, page, true)
if not (success) then
vim.cmd('redraw')