Git Product home page Git Product logo

fzy's Introduction

fzy

fzy is a fast, simple fuzzy text selector for the terminal with an advanced scoring algorithm.

Try it out online!

It's been kind of life-changing. -@graygilmore
fzy works great btw -@alexblackie

Build Status

Why use this over fzf, pick, selecta, ctrlp, ...?

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 to find the result the user intended. It does this by favouring matches on consecutive letters and starts of words. This allows matching using acronyms or different parts of the path.

A gory comparison of the sorting used by fuzzy finders can be found in ALGORITHM.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.

Installation

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

From source

make
sudo make install

The PREFIX environment variable can be used to specify the install location, the default is /usr/local.

Usage

fzy is a drop in replacement for selecta, and can be used with its usage examples.

Use with Vim

fzy can be easily integrated with vim.

function! FzyCommand(choice_command, vim_command)
  try
    let output = system(a:choice_command . " | fzy ")
  catch /Vim:Interrupt/
    " Swallow errors from ^C, allow redraw! below
  endtry
  redraw!
  if v:shell_error == 0 && !empty(output)
    exec a:vim_command . ' ' . output
  endif
endfunction

nnoremap <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>

Sorting

fzy attempts to present the best matches first. The following considerations are weighted when sorting:

It prefers consecutive characters: file will match file over filter.

It prefers matching the beginning of words: amp is likely to match app/models/posts.rb.

It prefers shorter matches: abce matches abcdef over abc de.

It prefers shorter candidates: test matches tests over testing.

See Also

fzy's People

Contributors

jhawthorn avatar neuschaefer avatar eraserhd avatar keith avatar artdevjs avatar casr avatar cisenor avatar d-e-s-o avatar duncaen avatar erichdongubler avatar lenormf avatar gyakovlev avatar gpanders avatar henrymarshall avatar legendre6891 avatar 0mp avatar michaelmackus avatar mikeastock avatar srstevenson avatar sbdchd avatar svenstaro avatar tstearns avatar theosotr avatar wfxr avatar momo-lab avatar sanjaymsh avatar syrrim avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.