Skip to content

Conversation

Erio-Harrison
Copy link

Description

This PR implements acronym matching for directory names as requested in #1002.
Users can now query directories like /home/user/hooli-interactive-computer-keyboard
using their acronym hick. The filter_by_keywords method first attempts regular
substring matching, falling back to match_acronym if needed.

Changes

  • Modified filter_by_keywords in src/db/stream.rs to integrate acronym matching.
  • Added match_acronym to generate acronyms from directory basenames.
  • Supports separators: -, _, , ..
  • Case-insensitive matching via to_lowercase.

Testing

  • Verified with test cases:
    • ["hick"] matches /home/bachman/Documents/hooli-interactive-computer-keyboard.
    • ["HICK"] matches (case-insensitive).
    • ["hick"] fails for /home/bachman/Documents/hooli-interactive-keyboard (incomplete acronym).
    • ["abc"] matches /home/bachman/Documents/a-b-c.

Closes #1002

@Erio-Harrison
Copy link
Author

Hi, could you please review this PR. I think I solve the issue.

Copy link
Contributor

@azaleacolburn azaleacolburn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good and I personally support this feature, but @ajeetdsouza might not want zoxide query to match acronyms.

@bennypowers
Copy link

@ajeetdsouza apologies for the ping: could you PTAL at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature: acronyms
3 participants