Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support searching for emails #16

Closed
lyz-code opened this issue Dec 20, 2024 · 5 comments
Closed

Support searching for emails #16

lyz-code opened this issue Dec 20, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@lyz-code
Copy link

Himalaya does support email searching, it would be super nice to be able to do it within the vim plugin

@soywod
Copy link
Member

soywod commented Dec 20, 2024

Yes indeed, it has been done for the Emacs plugin so it could definitely be done for Vim as well.

@soywod soywod added the enhancement New feature or request label Dec 20, 2024
@soywod soywod added this to Pimalaya Dec 20, 2024
@parisni
Copy link
Contributor

parisni commented Dec 21, 2024

not sure if this is the topic, but I have been able to search with this keymap in lazyvim

      { "<leader>m/", "<plug>(himalaya-set-list-envelopes-query)", desc = "Query" },

@lyz-code
Copy link
Author

Thank you so much @parisni I don't know how I missed that, it's even in the docs (╥﹏╥)

For those of you that are reading and need some guidance on how to do queries, you can see it in himalaya envelope list --help. It contains the next content:

Searching emails

You can use the g/ binding from within nvim to search for emails. The query syntax supports filtering and sorting query.

Filters

A filter query is composed of operators and conditions. There is 3 operators and 8 conditions:

  • not <condition>: filter envelopes that do not match the condition
  • <condition> and <condition>: filter envelopes that match both conditions
  • <condition> or <condition>: filter envelopes that match one of the conditions
  • ate <yyyy-mm-dd>: filter envelopes that match the given date
  • before <yyyy-mm-dd>: filter envelopes with date strictly before the given one
  • after <yyyy-mm-dd>: filter envelopes with date stricly after the given one
  • from <pattern>: filter envelopes with senders matching the given pattern
  • o <pattern>: filter envelopes with recipients matching the given pattern
  • subject <pattern>: filter envelopes with subject matching the given pattern
  • body <pattern>: filter envelopes with text bodies matching the given pattern
  • flag <flag>: filter envelopes matching the given flag

Sorting

A sort query starts by "order by", and is composed of kinds and orders. There is 4 kinds and 2 orders:

  • date [order]: sort envelopes by date
  • from [order]: sort envelopes by sender
  • to [order]: sort envelopes by recipient
  • subject [order]: sort envelopes by subject
  • <kind> asc: sort envelopes by the given kind in ascending order
  • <kind> desc: sort envelopes by the given kind in descending order

Examples

subject foo and body bar: filter envelopes containing "foo" in their subject and "bar" in their text bodies
order by date desc subject: sort envelopes by descending date (most recent first), then by ascending subject
subject foo and body bar order by date desc subject: combination of the 2 previous examples

If you write a wrong query the plugin so far will crash

@parisni
Copy link
Contributor

parisni commented Dec 23, 2024

You are welcome. After all most of my config comes from your blue book ¯_(ツ)_/¯

@lyz-code
Copy link
Author

Lol @parisni I did not see that one coming. I'm glad you're using it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

No branches or pull requests

3 participants