Under Development
stars

Notmuch Advanced Queries#

Prerequisites#

  1. Notmuch integration working in NeoMutt.

  2. A notmuch database already indexed.

Build Complex Queries#

  1. Use boolean operators in a query:

named-mailboxes "Important" "notmuch://?query=tag:inbox and tag:flagged"
  1. Open the mailbox.

Expected result: only messages matching the combined query are shown.

Create a Virtual Mailbox from a Query#

  1. Bind the vfolder-from-query function:

bind index,pager \eX vfolder-from-query
  1. Press Alt-X and enter a query such as:

tag:inbox and from:boss@example.com

Expected result: NeoMutt opens a virtual mailbox using your query.

Use Windowed Queries#

Windowed queries limit results to a moving time window.

  1. Enable windowed queries:

set nm_query_window_enable = yes
set nm_query_window_duration = 2
set nm_query_window_timebase = "week"
  1. Ensure important items are always included:

set nm_query_window_or_terms = "tag:unread and tag:flagged"

Expected result: queries use a rolling two-week window but keep unread/flagged messages visible.

See How to Use Notmuch for full configuration details.