Giter Site home page Giter Site logo

alternate.vim's Introduction

alternate.vim

Find your test and implementation files.

Why

When your working on a software project you will often need to:

  • Find and open the test for the current source file.
  • Find and open the source file for the current test file.
  • Find and run the test for the current source file you just modified.

This plugin provides a simple interface to find test and implementation files across different projects and languages.

Usage

Find the alternate file:

:echo alternate#FindAlternate()

Find the test file:

:echo alternate#FindTest()

Usage with open

:Open(alternate#FindAlternate())

Open the alternate file in the current window.

:OpenVertical(alternate#FindAlternate())

Open the alternate file in a new vertical split.

How it works

When you open a recognised file type, alternate examines your working directory for common project layout conventions. Once a layout convention is recognised alternate will use it to scan for alternate files.

Recognised Conventions

Ruby

(app|lib)/**/foo.rb <-> spec/**/foo_spec.rb
lib/**/foo.rb <-> spec/**/foo_spec.rb
**/foo.rb <-> test/**/foo_unit.rb

Python

**/foo.py <-> test/**/test_foo.py
**/foo.py <-> **/test_foo.py

(Java|Coffee) Script

app/assets/javascripts/**/foo.js.coffee <-> spec/javascripts/**/foo_spec.js.coffee
**/foo.js.coffee <-> spec/**/foo_spec.js.coffee

Haskell

src/**/foo.hs <-> testsuite/tests/**/Qcfoo.hs

C++

**/Foo.cc <-> **/TestFoo.cc

Golang

**/foo.go <-> **/foo_test.go

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.