Giter VIP home page Giter VIP logo

match-finder's Introduction

MatchFinder

A fuzzy finder similar to fzf-native-vim but with different scoring algorithm.

NOTE: This is not a CLI tool but a library.

Search term

The search term is backward compatible with fzf.

foo -> fuzzy
'foo -> exact
^foo -> prefix-exact
foo$ -> suffix-exact
!foo -> inverse-exact
!^foo -> inverse-prefix-exact
!foo$ -> inverse-suffix-exact

// Note that OR has precedence over AND
foo ^bar baz$ ->  (and (and foo ^bar) baz$)
'foo | !bar !baz$ | !^bax ->  (and (or 'foo !bar) (or !baz$ !^bax))

Usage

See main.zig tests for more examples.

test "example usage" {
    const a = testing.allocator;

    const texts = &[_][]const u8{ "unique", "foo", "foobar", "barfoo", "$order^^^", "xyz_", "abxy", "$order^", "$order^^" };
    var matcher = MatchFinder.init(a, texts);
    defer matcher.deinit();

    {
        const or_bin = try matcher.search("unique | foo");
        defer a.free(or_bin);
        try expect(or_bin.len == 4);

        const and_bin = try matcher.search("foo bar");
        defer a.free(and_bin);
        try expect(and_bin.len == 2);

        const or_and = try matcher.search("foo foo | bar");
        defer a.free(or_and);
        try expect(or_and.len == 3);
    }
}

match-finder's People

Contributors

artronics avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

soratenshi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.