Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/honza/pyselecta
Fuzzy search
https://github.com/honza/pyselecta
Last synced: about 5 hours ago
JSON representation
Fuzzy search
- Host: GitHub
- URL: https://github.com/honza/pyselecta
- Owner: honza
- License: bsd-2-clause
- Created: 2014-03-28T07:21:26.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-09T18:15:00.000Z (over 8 years ago)
- Last Synced: 2024-10-06T04:48:50.234Z (about 1 month ago)
- Language: Go
- Size: 6.84 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
pyselecta
=========A fuzzy text selector for files and anything else you need to select
Inspired by Gary Bernhardt's `selecta`_.
.. _selecta: https://github.com/garybernhardt/selecta
Unlike selecta, pyselecta doesn't include any interactive functionality. You
give it a list of options and a search term and it returns matches.Installation
------------::
$ pip install pyselecta
This will give you the ``pyselecta`` shell command.
Usage
-----::
$ find . -type f | pyselecta "models"
This will return a newline separated list of file paths with the best candidate
on top.::
$ find . -type f | pyselecta
Omitting the search term just copies the stdin to stdout.
Vim integration (ctrlp)
-----------------------Unlike the original selecta, pyselecta works in MacVim, too.
Add this to your ``vimrc``.
::
let g:selecta_path = "pyselecta"
function! SelectaMatch(items, str, limit, mmode, ispath, crfile, regex)
let cachefile = ctrlp#utils#cachedir().'/selecta.cache'if !( filereadable(cachefile) && a:items == readfile(cachefile) )
call writefile(a:items, cachefile)
endifif !filereadable(cachefile)
return []
endiflet cmd = "cat ".cachefile." | ".g:selecta_path." ".a:str
return split(system(cmd), "\n")endfunction
let g:ctrlp_match_func = {'match' : 'SelectaMatch' }
License
-------BSD, short and sweet