GithubHelp home page GithubHelp logo

vim-turbux's Introduction

Turbux is designed to speed up your TDD cycle by using a single key mapping to run the most relevant test based on the current file in vim. It uses tmux's scriptability to send commands to a chosen pane in your tmux session.

For more information, see the documentation.

Dependencies

This plugin depends on vim-dispatch, tslime.vim, vim-tmux-runner, or vimux, whichever is available, and becomes really awesome when used with rails.vim. It also makes the assumption that you're using tmux.

Note: Due to a bug in the original tslime.vim plugin, please use my fork.

Installation

Use pathogen or vundle.

vim-turbux's People

Contributors

avbranco avatar cpow avatar drn avatar eellson avatar hashrocketeer avatar henrik avatar jgdavey avatar krisleech avatar martinisoft avatar matthutchinson avatar mikekelly avatar mxie avatar shime avatar stephenprater avatar tristil avatar vnegrisolo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vim-turbux's Issues

guard-like notifications

Guard has a really nice feature where it will send notifications to tmux. It does things like setting the status-bg to red if tests are failing, popping up a message for e few seconds, etc.

https://github.com/guard/guard/blob/master/lib/guard/notifiers/tmux.rb has the details.

Would something like this be a good fit for turbux? I use guard-spork for keeping spork running, but perfer to manually trigger test runs with turbux and would love to have the tmux notifications.

If this is interesting for the project I will work up a pull request.

Error after vim update

I recently updated vim to 7.3.831 (from Homebrew). Whenever I run a test, either focused or not I now get the following error in Vim:

Error detected while processing function SendTestToTmux..<SNR>30_command_for_file..<SNR>30_alternate_for_file:
line    3:
E716: Key not present in Dictionary: related())
E116: Invalid arguments for function s:first_readable_file(rails#buffer().related())
E15: Invalid expression: s:first_readable_file(rails#buffer().related())
line    4:
E121: Undefined variable: alt
E15: Invalid expression: alt =~# '\(\<test_.*\|\(_test\|_spec\)\)\.rb$'

The test is however correctly sent to Vimux and runs as intended.

Any idea what might be wrong?

Tmux pane get closed right after the specs run

I'm using vim-turbux with vim-dispatch, but right after the tests run, the tmux pane get closed and I get no feedback from the specs.
Is it possible to display the output into a quickfix window? or at least leve the pane open?

Run entire test suite

I don't know if I missed it somehow, but is it possible to run an entire test suite with turbux?

I mean, you can run 1 file with <leader>t and focused tests with <leader>T.

But what about all the tests?

Tech support?

Hey there. I really want to try your setup, I think I could gain a lot from using it. Unfortunately.. I can't get it to work.
I am on Gentoo Linux (in case it makes a difference).
I am using vim 7.3.409 with config https://github.com/Trevoke/.vim (I have removed the rubytest plugin to verify that no keyboard shortcuts were interfering)
I am using tmux 1.5 with config file: https://github.com/Trevoke/.tmux/blob/master/.tmux.conf

I use pathogen, and have installed your tslime.vim and vim-turbux.

Following your blog post ( http://joshuadavey.com/post/15619414829/faster-tdd-feedback-with-tmux-tslime-vim-and ), I open a terminal (gnome-terminal, xfce terminal, rxvt-unicode), go to a Rails dir, then :
Ctrl+A, %
Ctrl+A, Alt+4

vim / :Rspec mod/para (I have a model named parameter)
And finally ... t
I am asked for the tmux session number, the window number, the pane number. I am careful to pick the pane in which vim is not running (though that does not change what happens next).

What happens next is that I press Enter, the cursor goes to the beginning of the line (over the 'p' of 'pane number: 0'), and ... Nothing.

So what am I doing wrong? :)

[Edit and addendum - do I need to bind keyboard shortcuts for tslime.vim for this to work?]
[Edit2 - tried with tslime bindings, no dice. I did however try this same blind setup on OSX with iTerm2 and tmux and it worked dandily! So, it seems like something else is wrong; and I'm willing to help you figure it out if you like. I tried updating to tmux 1.6 ... Still no dice).

Turbux fails when alternate file doesn't exist

I'm not sure when this change happened, but turbux no longer seems to run the last spec when the alternate file doesn't exist.

In a specific case I run turbux from within spec/features/admin/dms/dms_spec.rb. Then I switch to app/controllers/admin/folders_controller.rb and make a change. When I run turbux from within that file I get

cannot load such file -- .../spec/controllers/admin/folders_controller_spec.rb

That controller spec does not exist. In the past, when that was the case turbux would run the last spec I ran. This still works for focused tests.

[Feature Request] Support Elixir Umbrella Apps

*FYI - I do not know if there's a recommended format for submitting an issue/feature request, so please LMK if I can update this.

I use vim-turbux with an elixir umbrella app. Currently vim-turbux supports mix tests, but a small modification needs to be made to support umbrella apps.

The current result of the turbux command is:

mix test test/path/to/test_file_test.exs

In an umbrella app, instead of tests being in the test directory, elixir apps are hosted in apps/app_name, so their tests are hosted in apps/app_name/test. The result of the turbux command is:

mix test apps/app_name/test/path/to/test_file_test.exs

I would like to modify the functionality to drop the initial apps/app_name from the path, so that the result reverts to the mix test test/path/to/test_file_test.exs.

I opened up the turbux code and am not sure how to yet, but I'll try to see if I can figure it out. Any tips would be appreciated!

paths

Hi,

Your blog post led me to believe that the receiving pane should be at the project root (to be clear, where Rakefile is located). This is because you say:

invoking the plugin (by default with t) will run rspec path/to/my_spec.rb in the corresponding pane. In a test-unit file, it will run ruby -Itest path/to/test.rb. In a cucumber feature file, it will run cucumber path/to/my.feature.

However, at least in the case of test-unit, only the source file name is provided.

Before I start hacking, I just wanted to clear up which directory you expect the receiving pane to be in.

I'm also not sure why you include the -I.

Thanks.

:!echo "Warning: No command has been run yet" (tmux)

I'm trying to use your plugin in conjunction with vim-dispatch and message in the attached screenshot flashes quickly (I recorded a video of it using a screen recorder and paused on that frame) followed by this error:

 :!echo "Warning: No command has been run yet" (tmux)

I'm on SHA f7ee415.

Any advice would be welcomed. Please let me know if there is any more debugging I can do.
Screen Recording mov

Switching Tslime with Vimux

Hello,

I've been giving a ride to turbux for about a month and really liked it.

The only downside is that I found Tslime unstable, even if I switched to the fork. Sometimes it simply stopped working, despite having the right names in memory for sessions, windows, and panes.

I tried on my fork to switch the backend to Vimux (https://github.com/benmills/vimux), as it's got some interesting features that make it more reliable (creates panes, uses panes in the current session).

The code change on Turbux would be minimal (one line) but before submitting a pull request I wanted to check how you feel about this.

The code change can be seen here: cloud8421@b273ca4

Thanks!

Test and spec files are not being recognized

This is surely some quirk in my configuration but I can't for the life of me figure out what it might be. Whenever I am editing a _test.rb or _spec.rb file, turbux does not recognise it, i.e. it seems that s:prefix_for_test(file) is returning an empty string.

Does anyone have an idea what might be interfering with the recognition? I tested this in both Vim 7.3 and 7.4.

Edit: some more info on this. It turns out it is not a configuration problem. I was trying to run a test file which is within a Rails project but is not in the test/ directory, nor does it require test_helper.rb or is in any other way a "Rails test". I would still expect turbux to recognise it a a test file, though, so I am leaving this as a bug report. ๐Ÿ˜ƒ

Sending commands to another session

Where I work I have multiple monitors and I would like to have my test output on one monitor and the production code on another.

I guess this can be done by using multiple tmux sessions but how can I send a command to another tmux session?

error output on OS X Lion

running tmux installed via homebrew on OS X lion. my terminal app is iTerm 2

When I try to run both tests and focuses tests, I get the following output in my tmux pane:

/src/mojotech/BatchDeux (git::master)
cpjolicoeur $ ^Lrspec spec/models/ability_spec.rb:8
-bash: 
       rspec: command not found

Not sure why it is appending the ^L char before the rspec command but it seems to be preventing the command from running properly.

Let me know what else I can do to help debug this

Is it possible to use vim-turbux with "nviennot/irb-config"?

This is what I do now:

  1. open new tmux window
  2. start "screen" (...awkward)
  3. run "rails console test" in it (which uses 'nviennot/irb-config' plugin)
  4. attach vim to screen using 'ervandew/screen'
  5. call tests using cryptic vim mappings like:

imap `` :w :call ScreenShellSend(" rspec ".@% . ':' . line('.'))

What I would love to use:

  1. use 'jgdavey/vim-turbux'
  2. spam t
  3. if necessary vim-turbux (or something attached to it) starts "rails console test" using 'nviennot/irb-config'
  4. ???
  5. profit!

Any ideas on how to achieve that?

Incompatible with tmux 2.2?

I'm having some trouble with vim-turbux...it simply doesn't pick up the command in another tmux pane. I updated to tmux 2.2 today and was wondering if that was the problem. Thanks!

Problem running Capybara integration specs

After commit eba8b58 when running a spec within certain paths turbux just changes directories and does not run the spec. Everything works fine with the previous commit.

For instance, in a rails app with the spec file spec/features/whatever_spec.rb is ran turbux cd's into the spec features directory on the first run. It does not attempt to run any specs.

On subsequent runs it tries to cd into the spec/features directory which of course doesn't exist.

Error detected while processing function SendFocusedTestToTmux

Hi,

when I press t or T it always gives me this error:

Error detected while processing function SendFocusedTestToTmux..20_send_test..20_run_command_in_tmux:
line 11:
E117: Unknown function: Send_to_Tmux
E15: Invalid expression: Send_to_Tmux(executable."\n")

No matter of what spec (rails, minitest) I am in.

Thanks for help.

Focussed MiniTest not working with `g:turbux_test_type='minitest'` or when `g:turbux_test_type` not set

I used to have the following in my ~/.vimrc:

autocmd BufNewFile,BufRead {*_test.rb} let g:turbux_test_type='minitest'
autocmd BufNewFile,BufRead {*_spec.rb} let g:turbux_test_type='rspec'   

But running focused tests with MiniTest would always fail since it would append the line number (e.g. ruby -Itest mytest.rb:44) and fails to find the named test (it should use -n "test_name").

I tracked this down to a line that checks the g:turbux_test_type != 'minitest'. So I removed setting g:turbux_test_type altogerther, but then running focused tests I got this:

screen shot 2018-05-09 at 09 56 21

Since the var is not set :(

Basically, I've resorted to having this in my vimrc for now and things are working again (for both minitest, rspec, cucumber):

let g:turbux_test_type='x'

I also noticed that g:turbux_test_type is not mentioned anywhere else in the plugin code or the docs, so perhaps this is legacy (or undocumented) code?

Over-escaping (?) of double-quotes stops SendFocusedTestToTmux working with MiniTest

When running a focussed test, the following appears in the target tmux pane, and it looks like MiniTest doesn't match the test name i.e. zero tests are run:

$ ruby -Itest test/unit/foo_test.rb -n \"test_foo\"

Run options: -n "foo_test" --seed 54880

# Running tests:

Finished tests in 0.005977s, 0.0000 tests/s, 0.0000 assertions/s.

0 tests, 0 assertions, 0 failures, 0 errors, 0 skips

However, if I change the escape_double_quotes function implementation from return s:gsub(a:str, '"', '\\"') to return s:gsub(a:str, '"', '\"') (i.e. removing one of the backslashes) then the following appears in the target tmux pane, and the selected test runs:

ruby -Itest test/unit/foo_test.rb -n "test_foo"

Run options: -n foo_test --seed 54880

# Running tests:

Finished tests in 0.005977s, 0.0000 tests/s, 0.0000 assertions/s.

1 tests, 1 assertions, 0 failures, 0 errors, 0 skips

I'm pretty sure my "fix" isn't a sensible one, but I'm very confused by all the escaping methods in turbux.vim. Do you have any idea what might be going on? Thanks.

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.