thoughtbot / vim-rspec

Run Rspec specs from Vim
https://robots.thoughtbot.com
MIT License
656 stars 108 forks source link

Add Neovim details in README #111

Open thewatts opened 8 years ago

thewatts commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 7 years ago

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 commented 7 years ago

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.