Coder Social home page Coder Social logo

h7kayama / run-rspec.vim Goto Github PK

View Code? Open in Web Editor NEW

This project forked from itmammoth/run-rspec.vim

0.0 1.0 0.0 104 KB

Lovely rspec runner for vim

Home Page: https://github.com/itmammoth/run-rspec.vim

License: MIT License

Ruby 12.71% Vim Script 87.29%

run-rspec.vim's Introduction

run-rspec.vim

run-rspec.vim is a lovely rspec runner for Vim & MacVim.

Screenshot

Inspired by https://github.com/skwp/vim-rspec (Sounds like it's no longer maintained)

Features

  • Never makes a mess in your workspace
    • Rspec result will be outputted on the same modest window every run
  • Enhanced result window
    • Quick jump to line where spec failed
    • Quick find next/previous failure.
  • Auto detecting the location of the spec file
  • Work well with rspec 3.x

Installation

vim-plug

Add this to your .vimrc file.

Plug 'itmammoth/run-rspec.vim'

Then, :PlugInstall

dein.vim

Add this to your .vimrc file.

call dein#add('itmammoth/run-rspec.vim')

Then, :call dein#install()

Vundle

Plugin 'itmammoth/run-rspec.vim'

... and many other plugin managers.

Usage

Hit the commands to run rspec.

:RunSpec --- for running the current rspec file (or auto detecting the rspec file for the current file)
:RunSpecLine --- for running the spec under the cursor
:RunSpecLastRun --- for re-running the last rspec
:RunSpecCloseResult --- for closing the result window (from other window)

Highly recommendation

Add preferred key mappings to your .vimrc file like below for your comfortable rspec life.

nnoremap <leader>r :RunSpec<CR>
nnoremap <leader>l :RunSpecLine<CR>
nnoremap <leader>e :RunSpecLastRun<CR>
nnoremap <leader>cr :RunSpecCloseResult<CR>

Result window

Some useful key mappings will be bound in the result buffer.

  • Enter ... Jump to the line in the rspec where the failure under the cursor occurred
  • e ... Jump to the line (the same as hitting Enter) and close the result window.
  • n ... Go to the next failure
  • p ... Go to the previous failure
  • q ... Close the result window

Configuration

g:run_rspec_bin

Set path to rspec binary.
default: "rspec"

Ex)
let g:run_rspec_bin = 'bin/rspec'
let g:run_rspec_bin = 'bundle exec rspec'
let g:run_rspec_bin = 'spring rspec'

g:run_rspec_command_option

Set additional rspec options if you want.
default: ''

Ex)
let g:run_rspec_command_option = '--only-failure'

NOTICE: -c, --colour, -f and --format options will be ignored.

g:run_rspec_src_dir

Set the directory where src files are for auto detecting.
default: 'app'

Ex)
let g:run_rspec_src_dir = 'extra_src'

g:run_rspec_spec_dir

Set the directory where spec files are for auto detecting.
default: 'spec'

Ex)
let g:run_rspec_spec_dir = 'extra_spec'

g:run_rspec_result_lines

Set number of the result buffer lines.
default: 15

Ex)
let g:run_rspec_result_lines = 20

Contribution

Fork it, then run command bundle install to install rspec. blankslate.g?vimrc are essential vim script files for testing.

$ vim -u blankslate.vimrc spec/runrspec_spec.rb
$ gvim -u blankslate.vimrc -U blankslate.gvimrc spec/runrspec_spec.rb

And try running rspec.

License

MIT License.

run-rspec.vim's People

Contributors

itmammoth avatar

Watchers

 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.