Skip to content

Conversation

@thewatts
Copy link

I've been making the switch over to Neovim (just to see if it's a viable option).

So far so good, but I found out that Neovim doesn't use bang commands the same as Vim. As such - the runner has to be adjusted to use the new format for terminal commands.

Using the default configuration doesn't output colors, because the bang command is used to open a pipe, read output and display to the user
screen shot 2016-02-14 at 12 17 49 am

The term command has to be used instead:

let g:rspec_command = "term rspec #{spec}"

screen shot 2016-02-14 at 12 22 13 am

Adding documentation here so that others making the switch will know about the needed adjustment!
Thanks for an excellent plugin!

@eoinkelly
Copy link

It could be good to encourage constraining this change to just nvim so that we can go back & forth between vim and nvim e.g.

if has("nvim")
  let g:rspec_command = "term bundle exec rspec {spec}"
endif

@tpbowden
Copy link

tpbowden commented Mar 3, 2016

The problem with using term is that if you're using splits, closing the terminal will also kill the split so it's not as simple as that.

@jastkand
Copy link

I ended up with running the command in a new tab

if has("nvim")
  let g:rspec_command = "tabnew | term bundle exec rspec {spec}"
endif

@letmein
Copy link

letmein commented May 19, 2017

Hey guys, in case anyone is still interested, here is my solution with a horizontal split:

let g:rspec_command = ':call RunMySpecs("{spec}")'

function! RunMySpecs(specs)
  execute 'split | terminal bundle exec rspec ' . a:specs
  execute feedkeys("\<c-\>\<c-n>")
endfunction

I added execute feedkeys("\<c-\>\<c-n>") to prevent split from auto-closing on keypress, which is the default behavior since neovim 0.2.

@Ammet
Copy link

Ammet commented Nov 5, 2025

Hey all. 8 years later. Still having problems with the neovim and colors, the one I ended up is this:

let g:rspec_command = ':call RunMySpecs("{spec}")'

function! RunMySpecs(specs)
  botright split
  execute 'terminal bundle exec rspec --force-color ' . a:specs
  startinsert
  autocmd! TermClose * stopinsert
endfunction

botright split Makes it full screen horizontal split, not a part of vertical pane.
startinsert Makes it follow the output and auto-scroll as it's adding.
autocmd! TermClose * stopinsert prevents auto-closing as execute feedkeys("\<c-\>\<c-n>") but works with auto-scrolling

@thewatts
Copy link
Author

thewatts commented Nov 6, 2025

👋 I actually moved away from vim-rspec a number of years ago (for the ability to run other test types).

I use vim-test now, along with vim-floaterm.

CleanShot.2025-11-05.at.19.48.34.mp4

Gist of the configuration: https://gist.github.com/thewatts/a000be0ef684ffcf85fa4e05f64e2389


EDIT:

Absolutely nothing against this project - it's wonderful and worked beautifully for me for many years.

I switched to vim-test so that I could run tests from other frameworks with the same config.

My many thanks to the authors and maintainers for their hard work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants