Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/octaltree/linearf

A fast and extensible fuzzy finder on vim
https://github.com/octaltree/linearf

vim

Last synced: 20 days ago
JSON representation

A fast and extensible fuzzy finder on vim

Awesome Lists containing this project

README

        

# linearf
A fast and extensible fuzzy finder for vimmers

![](https://user-images.githubusercontent.com/7942952/144457920-fea501bd-196a-4192-99d6-7c1658d9dd0b.png)

## Concept
* Show the first view faster
* Find as fast as if they were in linear time
* High modularity and extensibility

## Requirements
* [cargo](https://doc.rust-lang.org/book/ch01-01-installation.html) nightly
* vim and +lua/dyn, or neovim and luajit

## Usage
First, install the plugins and sources locally. If you use dein as your package
manager, it will look like this.
```vim
call dein#add('octaltree/linearf', {'merged': 0})
call dein#add('octaltree/linearf-my-flavors') # optional
```

Paste config
```lua
--lua<"] = flavors.hide_and(flavors.actions.line.jump)
},
querier_inoremap = {
[""] = flavors.normal_and(
flavors.hide_and(flavors.actions.line.jump))
}
},
view = {querier_on_start = 'insert'}
}
})
local use_rg = false
set('file', flavors.context_managers[use_rg and 'file_rg' or 'file_find'],
flavors.merge {
flavors.scenarios[use_rg and 'file_rg' or 'file_find'],
flavors.scenarios.quit,
flavors.scenarios.no_list_insert,
flavors.scenarios.no_querier_normal,
{
linearf = {
list_nnoremap = {
[""] = flavors.hide_and(flavors.actions.file.open),
["s"] = flavors.hide_and(flavors.actions.file.split),
["t"] = flavors.hide_and(flavors.actions.file.tabopen),
["v"] = flavors.hide_and(flavors.actions.file.vsplit)
},
querier_inoremap = {
[""] = flavors.normal_and(
flavors.hide_and(flavors.actions.file.open))
}
}
}
})
set('grep', flavors.context_managers[use_rg and 'grep_rg' or 'grep_grep'],
flavors.merge {
flavors.scenarios[use_rg and 'grep_rg' or 'grep_grep'],
flavors.scenarios.quit,
flavors.scenarios.no_list_insert,
flavors.scenarios.enter_list,
{
linearf = {
list_nnoremap = {
[""] = flavors.hide_and(flavors.actions.grep.open),
["s"] = flavors.hide_and(flavors.actions.grep.split),
["t"] = flavors.hide_and(flavors.actions.grep.tabopen),
["v"] = flavors.hide_and(flavors.actions.grep.vsplit)
},
querier_inoremap = {},
querier_nnoremap = {
[""] = flavors.actions.view.goto_list
}
}
}
})

-- optional
linearf.utils.command(
"nnoremap / :lua linearf.run('line')")
linearf.utils.command(
"nnoremap f :lua linearf.run('file')")
linearf.utils.command(
"nnoremap g :lua linearf.run('grep')")
linearf.utils.command(
"nnoremap l :lua linearf.resume_last()")

-- for vimrc
--EOF
```

Then run with the pre-defined scenario and its difference.
```vim
lua lnf('line')
lua lnf('line', {})
```
For more information, see `:help linearf`

## TODO
- [x] implement logic
- [x] runtime reloading and auto building
- [x] implement view
- [x] implement action
- [x] implement linearf-my-flavors
- [ ] use vim as a fuzzy finder from CLI
- [ ] implement preview