- Notifications
You must be signed in to change notification settings - Fork131
🔍 A simple, fast fuzzy finder for the terminal
License
jhawthorn/fzy
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
fzy is a fast, simple fuzzy text selector for the terminal with an advanced scoring algorithm.
It's been kind of life-changing.-@graygilmore
fzy works great btw-@alexblackie
fzy is faster and shows better results than other fuzzy finders.
Most other fuzzy matchers sort based on the length of a match. fzy tries tofind the result the user intended. It does this by favouring matches onconsecutive letters and starts of words. This allows matching using acronyms ordifferent parts of the path.
A gory comparison of the sorting used by fuzzy finders can be found inALGORITHM.md
fzy is designed to be used both as an editor plugin and on the command line.Rather than clearing the screen, fzy displays its interface directly below the current cursor position, scrolling the screen if necessary.
macOS
Using Homebrew
brew install fzy
Using MacPorts
sudo port install fzy
Arch Linux/MSYS2:pacman -S fzy
FreeBSD:pkg install fzy
Gentoo Linux:emerge -av app-shells/fzy
Ubuntu/Debian:apt-get install fzy
pkgsrc (NetBSD and others):pkgin install fzy
openSUSE:zypper in fzy
makesudo make install
ThePREFIX
environment variable can be used to specify the install location,the default is/usr/local
.
fzy is a drop in replacement forselecta, and can be used with itsusage examples.
fzy can be easily integrated with vim.
function!FzyCommand(choice_command, vim_command)trylet output=system(a:choice_command ." | fzy")catch/Vim:Interrupt/" Swallow errors from ^C, allow redraw! belowendtryredraw!ifv:shell_error==0&&!empty(output)execa:vim_command .'' . outputendifendfunctionnnoremap<leader>e :call FzyCommand("find . -type f", ":e")<cr>nnoremap<leader>v :call FzyCommand("find . -type f", ":vs")<cr>nnoremap<leader>s :call FzyCommand("find . -type f", ":sp")<cr>
Any program can be used to filter files presented through fzy.ag (the silver searcher) can be used to ignore files specified by.gitignore
.
nnoremap<leader>e :call FzyCommand("ag . --silent -l -g ''", ":e")<cr>nnoremap<leader>v :call FzyCommand("ag . --silent -l -g ''", ":vs")<cr>nnoremap<leader>s :call FzyCommand("ag . --silent -l -g ''", ":sp")<cr>
fzy attempts to present the best matches first. The following considerations are weighted when sorting:
It prefers consecutive characters:file
will matchfile overfilter.
It prefers matching the beginning of words:amp
is likely to matchapp/models/posts.rb.
It prefers shorter matches:abce
matchesabcdef overabc de.
It prefers shorter candidates:test
matchestests overtesting.
- fzy.js Javascript port
About
🔍 A simple, fast fuzzy finder for the terminal