Giter VIP home page Giter VIP logo

fuzzy-projectionist.vim's Introduction

Fuzzy Projectionist

Build Status

Project navigation and fuzzy finders combined!

Use projections and FZF together to navigate projects with ease.

Supports Vim >= 7.4.2044 and Neovim (requires echo has('lambda')).

Features

Integrates with vim-projectionist and fzf to allow you to narrow the list of files to fuzzy search.

vim-projectionist exposes commands (:Etype, :Vtype, :Stype ...) for quick project navigation and fzf is a speedy fuzzy finder. This plugin combines the two, exposing one command for each type of file in your project. You can use FZF's key bindings to open the file in a new buffer/split/tab instead of having to map each of the different projectionist commands.

Examples

With this minimal configuration for a Rails project:

{
  "app/models/*.rb": {
    "type": "model"
  },
  "app/controllers/*.rb": {
    "type": "controller"
  },
  "app/views/*.rb": {
    "type": "view"
  }
}

You can now use FZF when projecting around the project with the commands:

  • :Fmodel
  • :Fcontroller
  • :Fview

Hit enter to dive into FZF for that type. Each F command takes an optional argument that pre-populates the search query, and jumps directly to a file if there is only one match. As with all commands, you can abbreviate where possible, like :Fc hom to get to your home controller.

When you're in FZF, use enter to open the file in the current buffer, ctrl-x to open in a new split, ctrl-v for a vertical split or ctrl-t for a new tab.

There are also the following functions defined for further use:

  • fuzzy_projectionist#projection_for_type(type)
    • fuzzy search for projections for the given type in the cws
    • eg fuzzy_projectionist#projection_for_type('model')
  • fuzzy_projectionist#choose_projection()
    • choose which type of file to project

You can also enable a little preview window with let g:fuzzy_projectionist_preview = 1.

Note on depth

vim-projectionist lists matches from parent directories that were found in your g:projectionist_heuristics. Say you had:

let g:projectionist_heuristics = {"Makefile": { "src/*.c": {"type": "source"} } 
.
├── Makefile
├── midlevel
│   ├── Makefile
│   ├── lower
│   │   ├── Makefile
│   │   └── src
│   │       └── low.c
│   └── src
│       └── mid.c
└── src
    └── root.c

... and you were in the lower/ directory.

:Esource and Fsource will both give you root, mid, low

This makes sense if there is no crossover between the pre-glob projection path and the subdirectories (i.e. midlevel is not inside src/, it is adjacent). If this isn't the case for you and you have something like

heuristics: { "Makefile": {"*.c": {"type": "source"} } }
.
├── Makefile
├── midlevel
│   ├── Makefile
│   ├── lower
│   │   ├── Makefile
│   │   └── low.c
│   └── mid.c
└── root.c

...producing root midlevel/lower/low midlevel/mid mid lower/low low, then you can set let g:fuzzy_projectionist_depth = 1 to only look the 1 level nearest to your current file. From lower, that would be low; from the root, that would be root mid low. This only applies to Fsource. The default is 0 (infinite).

Testing

There is a comprehensive test suite written in vader. Run ./test/run.sh --help for more info.

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.