Coder Social home page Coder Social logo

kballenegger / matcher Goto Github PK

View Code? Open in Web Editor NEW

This project forked from burke/matcher

0.0 2.0 0.0 85 KB

Intelligently searches through a list of file names for the one you were probably looking for.

License: BSD 2-Clause "Simplified" License

Makefile 3.20% C 96.80%

matcher's Introduction

Matcher

This is a standalone library that does the same fuzzy-find matching as Command-T.vim.

Installation

$ make
# move `matcher` somewhere useful
$ make install
# make install will install it to /usr/local/bin.

Usage

Matcher searches for a string in a list of filenames, and returns the ones it thinks you are most likely referring to. It works exactly like fuzzy-finder, Command-T, and so on.

Usage:

$ matcher [options] <search>

Options:

  • --limit: The number of matches to return (default 10)
  • --no-dotfiles: Dotfiles will never be returned (by default, they may be)
  • --manifest: Specify a file containing the list of files to scan. If none given, matcher will read the list from stdin.

Examples

$ matcher --limit 20 --no-dotfiles --manifest filelist.txt customer.rb
$ find . | matcher order

Using with CtrlP.vim

let g:path_to_matcher = "/path/to/matcher"

let g:ctrlp_user_command = ['.git/', 'cd %s && git ls-files . -co --exclude-standard']

let g:ctrlp_match_func = { 'match': 'GoodMatch' }

function! GoodMatch(items, str, limit, mmode, ispath, crfile, regex)

  " Create a cache file if not yet exists
  let cachefile = ctrlp#utils#cachedir().'/matcher.cache'
  if !( filereadable(cachefile) && a:items == readfile(cachefile) )
    call writefile(a:items, cachefile)
  endif
  if !filereadable(cachefile)
    return []
  endif

  " a:mmode is currently ignored. In the future, we should probably do
  " something about that. the matcher behaves like "full-line".
  let cmd = g:path_to_matcher.' --limit '.a:limit.' --manifest '.cachefile.' '
  if !( exists('g:ctrlp_dotfiles') && g:ctrlp_dotfiles )
    let cmd = cmd.'--no-dotfiles '
  endif
  let cmd = cmd.a:str

  return split(system(cmd), "\n")

endfunction

Bugs

  • Probably

Contributing

  • Fork branch commit push pullrequest
  • I'm bad at github notifications. Send me an email too at [email protected]

matcher's People

Contributors

ap avatar burke avatar jlong avatar kien avatar mattn avatar mleech avatar stefanpenner avatar twe4ked avatar

Watchers

 avatar  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.