High-performance fuzzy matching library for NeoMutt
Overview
This library provides fuzzy string matching capabilities optimized for interactive use in NeoMutt. It's designed to help users quickly find items by typing approximate or abbreviated input.
Design Principles
- No heap allocation: All operations use stack memory only
- No global state: Fully reentrant and thread-safe
- Pure string matching: No dependencies on mailbox, alias, or email structures
- O(n) performance: Linear time complexity for interactive responsiveness
- Pluggable algorithms: Easy to add new matching algorithms
Use Cases
- Mailbox/folder selection (e.g., "mlnd" → "mailinglists/neomutt-dev")
- Alias lookup (e.g., "rich" → "Richard Smith")
- Command completion (e.g., "set to" → "set timeout")
- Config variable lookup (e.g., "timeo" → "timeout")
- Email subject/sender filtering
API Usage
printf(
"Match! Score: %d, Span: %d\n", result.
score, result.
span);
@ FUZZY_ALGO_SUBSEQ
Subsequence matching algorithm.
int fuzzy_match(const char *pattern, const char *candidate, enum FuzzyAlgo algo, const struct FuzzyOptions *opts, struct FuzzyResult *out)
Perform fuzzy matching.
Options for fuzzy matching.
int score
Score (<0 = no match)