thoughtbot / vim-rspec

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

Can't run commands from MacVim #117

Open wilgoszpl opened 8 years ago

wilgoszpl commented 8 years ago

When I try to run rspec commandsj from macVim, there is an error shown:

Error detected while processing function RunCurrentSpecFile[4]..<SNR>92_RunSpecs:
E34: No previous command

From the terminal vim everything works fine though.

Here is my config. I use iTerm2 as terminal:

let g:rspec_runner = "os_x_iterm2"
let g:rspec_command = "!spring rspec --color {spec}"
map <Leader>t :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
map <Leader>a :call RunAllSpecs()<CR>
bashcoder commented 8 years ago

I had a similar problem. First, removing the ! character at the front of the command fixes that particular error, but then spring itself will not recognize rspec anyway. So instead of specifying a g:rspec_command in my .vimrc, I did the following:

Install the spring-commands-rspec gem into your development group in your Gemfile, run bundle install, and run bundle exec spring binstub rspec in your local environment to set up an rspec binstub for spring. You may also have to run spring stop after this.

Now, every time you run rspec it will be run in the context of the Spring framework, including while working in vim with vim-rspec.

Hope this helps.

wilgoszpl commented 8 years ago

Thanks! Removing ! was the point!