Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tzachar/fuzzy.nvim
nvim plugin providing abstraction over fzf and fzy native libraries
https://github.com/tzachar/fuzzy.nvim
Last synced: about 1 month ago
JSON representation
nvim plugin providing abstraction over fzf and fzy native libraries
- Host: GitHub
- URL: https://github.com/tzachar/fuzzy.nvim
- Owner: tzachar
- License: mit
- Created: 2021-11-02T13:56:41.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-05-19T06:00:31.000Z (7 months ago)
- Last Synced: 2024-08-07T18:37:06.585Z (5 months ago)
- Language: Lua
- Size: 6.84 KB
- Stars: 17
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fuzzy.nvim
An abstraction layer on top of fzf and fzy.
# Installation
Depends on [telescope-fzf-native.nvim](https://github.com/nvim-telescope/telescope-fzf-native.nvim) or
[fzy-lua-native](https://github.com/romgrk/fzy-lua-native) or [telescope-zf-native.nvim](https://github.com/natecraddock/telescope-zf-native.nvim).Priority: fzf > fzy > zf
Using [Packer](https://github.com/wbthomason/packer.nvim/) with `fzf`:
```lua
use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make'}
use {'tzachar/fuzzy.nvim', requires = {'nvim-telescope/telescope-fzf-native.nvim'}}
```Using [Packer](https://github.com/wbthomason/packer.nvim/) with `fzy`:
```lua
use {'romgrk/fzy-lua-native', run = 'make'}
use {'tzachar/fuzzy.nvim', requires = {'romgrk/fzy-lua-native'}}
```Using [Packer](https://github.com/wbthomason/packer.nvim/) with `zf`:
```lua
use {'tzachar/fuzzy.nvim', requires = {'natecraddock/telescope-zf-native.nvim'}}
```# Api
This plugin supports a module with a single method: `filter`. The `filter`
method receives three parameters: a pattern to match, `lines` a list of strings or
tables where the first element is a string 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](https://github.com/nvim-telescope/telescope-fzf-native.nvim#lua-interface)).The method returns a list of `{string|table, match_positions, score, index}`.
For the meanings of match_positions and score see individual documentations of
`fzf` and `fzy`. `index` is the index of the matched line from the parameter `lines`.## Example Usage
```lua
local matcher = require('fuzzy_nvim')
matcher:filter('abc', {'aabbcc', '123', 'a1b2c'})
```result with `fzf` is then:
`{ { "a1b2c", { 5, 3, 1 }, 58, 3 }, { "aabbcc", { 5, 3, 1 }, 49, 1 } }````lua
local matcher = require('fuzzy_nvim')
matcher:filter('abc', {
{ 'aabbcc', action1 },
{ '123', action2 },
{ 'a1b2c', action3 }
})
```result with `fzf` is then:
```lua
{
{ { "a1b2c", action3 }, { 5, 3, 1 }, 58, 3 },
{ { "aabbcc", action1 }, { 5, 3, 1 }, 49, 1 }
}
```