Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 1.44 KB

README.md

File metadata and controls

47 lines (34 loc) · 1.44 KB

fuzzy.nvim

An abstraction layer on top of fzf and fzy.

Installation

Depends on telescope-fzf-native.nvim or fzy-lua-native.

If both fzf and fzy are installed, will prefer fzf.

Using Packer with fzf:

use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make'}
use {'tzachar/fuzzy.nvim', requires = {'nvim-telescope/telescope-fzf-native.nvim'}}

Using Packer with fzy:

use {'romgrk/fzy-lua-native', run = 'make'}
use {'tzachar/fuzzy.nvim', requires = {'romgrk/fzy-lua-native'}}

Api

This plugin supports a module with a single method: filter. The filter method receives three parameters: a pattern to match, a list of strings and an extra parameter passed to the fuzzy library: for fzy, its a boolean indicating is_case_sensitive, for fzf its the case_mode (see this).

The method returns a list of {string, match_positions, score}. For the meanings of match_positions and score see individual documentations of fzf and fzy.

Example Usage

local matcher = require('fuzzy_nvim')
matcher:filter('abc', {'aabbcc', '123', 'a1b2c'})

result with fzf is then: { { "a1b2c", { 5, 3, 1 }, 58 }, { "aabbcc", { 5, 3, 1 }, 49 } }