fuzzy

package
v0.2.24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package fuzzy implements an fzf-inspired fuzzy scorer for command pickers.

Scoring strategy:

  • Sequential letter match (prefix run): highest bonus
  • Word boundary match (after space/hyphen/underscore/slash/dot): medium bonus
  • Consecutive matched characters: per-run bonus
  • Smart case: case-insensitive unless pattern contains an uppercase letter

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Match

type Match struct {
	// Score is the relevance score; higher is better. 0 means no match.
	Score float64

	// Positions are the indices in the target string that were matched.
	Positions []int
}

Match holds the result of a single fuzzy match operation.

func Score

func Score(pattern, target string) Match

Score computes how well pattern matches target using fzf-style heuristics. Returns a Match with Score == 0 if pattern is not a subsequence of target.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL