I'm trying to transition to MacVim for ruby dev. One of the hangups I have is running specs quickly and getting results (passes/failures) easily.
When I run :Rake
(or :!rspec %
) it runs the specs in the current file. The output is shown in the command window.
If I run this in regular Terminal, I get colored output. That is, the dots are green and the failures are red.
In MacVim, I get these weird [32m
and [0m
tokens. Here's an example:
Any ideas on how to fix this?
Gvim (and I assume Macvim is just that with a brand-name :) ) doesn't have a real terminal behind it, so that's why you're getting these 'weird' tokens - they are the escape codes a real terminal would interpret as colors.
As michaelmichael points out, getting vim to like ANSI escape codes is bothersome. Also, I like his suggestion of vim-rspec. I cobbled this (https://github.com/dahu/VimTestRunner) together as a lightweight rspec test runner. It shows a red/green bar in your Vim status line when you run the tests. You can run just the rspec associated with the current file using <leader>y
or all rspecs in the current directory with <leader>a
. Feedback and suggestions for improvement welcome. Oh, and it's quite alpha at this stage. Be gentle. :-)
Use vim-rspec. It'll give you the clean, nicely colored rspec output you're after:
BTW, those are ANSI escape sequences messing up the output. See here for a question I asked a few weeks ago about getting rid of them while viewing ri documentation in (Mac|g)vim. Bottom line: it's easier to try to get plain text output than to try and shoehorn support for ANSI escape sequences into Vim.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With