0

I cannot get macvim to show color in my terminal for cucumber or rspec. The output looks like this:

14[0m
    [32mGiven I have a post with name "[32m[1mSample Post[0m[0m[32m"[90m
            # features/step_definitions/posts_steps.rb:1[0m[0m
    [32mWhen I visit the homepage[90m                               
/step_definitions/posts_steps.rb:5[0m[0m 

Any help would be appreciated

Sam
  • 2,761
  • 3
  • 19
  • 30

1 Answers1

1

Those are ANSI sequences, not anything specific to cucumber or rspec. Your files are captured output from tools that assume they are writing to the console (which interprets these sequences). Vim normally doesn't. There is a plugin which does that.

Amadan
  • 191,408
  • 23
  • 240
  • 301
  • That [AnsiEsc.vim](https://github.com/vim-scripts/AnsiEsc.vim) plugin does nothing in MacVim 7.4. When viewing output from a command run with `!`, I still see the ANSI sequences but no colors. There is also no change when viewing a `.txt` file that includes ANSI escape sequences. This was with only that plugin loading, and the rest of my `vimrc` commented out. The only way I see colorized command output is when running a command with `!` in the Terminal (not MacVim) – and that happens even when AnsiEsc.vim is not installed. – Rory O'Kane Oct 27 '14 at 02:48
  • 1
    @RoryO'Kane: Works perfectly in my MacVim, when used according to the docs. Did you use `:AnsiEsc` command on buffer contents? If you want it applied automatically, you'll have to set an autocommand for it; and if you want to show it on `!` output, capture it in a buffer first. – Amadan Oct 27 '14 at 04:00
  • 1
    @RoryO'Kane: Or you could not pass things through a filter (`:!`) as described [here](http://superuser.com/questions/309883/how-do-i-declare-the-terminal-type-in-vim-so-that-make-can-output-colours). – Amadan Oct 27 '14 at 04:07
  • Ah, the problem is that I never ran `:AnsiEsc` – I read AnsiEsc.vim’s [README](https://github.com/vim-scripts/AnsiEsc.vim/blob/master/README) but not its [docs](https://github.com/vim-scripts/AnsiEsc.vim/blob/master/doc/AnsiEsc.txt). So it seems like I can use [`:read!`](http://vimdoc.sourceforge.net/htmldoc/insert.html#:read!) to paste a command’s output and then highlight that output with `:AnsiEsc`, but per [your link](http://superuser.com/q/309883/124606), there is no way to automatically highlight the output in the normal command window. – Rory O'Kane Oct 27 '14 at 05:37
  • @RoryO'Kane: Yes, I believe that is correct (since Vim assigns `TERM=dumb` to `:!` output, as it is supposed to just be a filter). – Amadan Oct 27 '14 at 05:47