2

When I try and trigger PHPUnit tests within MacVim, I can't see coloured outputs in my command line:

enter image description here

  • Vim or GVim/MacVim? – romainl May 7 '16 at 20:32
  • @romainl I'm using MacVim – noobmaster69 May 7 '16 at 20:59
  • 2
    Then you can't get colored output. Try :!phpunit --colors=auto to disable color when the terminal doesn't support it. Not "pretty" but a lot cleaner. – romainl May 7 '16 at 21:30
  • @romainl I used :!phpunit --colors=never. Is this a MacVim thing? – noobmaster69 May 8 '16 at 8:44
  • 1
    Both MacVim and GVim come with a "dumb" terminal emulator that doesn't understand color. If you do :!command in Vim in a real terminal emulator, Vim is suspended and command is executed in the host shell which (hopefully) understands color escape sequences. – romainl May 8 '16 at 9:29
0

The GUI version of Vim (MacVim on Mac OS X, GVim everywhere else) comes with a "dumb" terminal emulator that doesn't understand color at all.

If you want to run command-line programs without the ugly escape codes you'll need to either configure those programs to not use color when not possible or call them with dedicated options.

In your case:

:!vendor/bin/phpunit --colors=never ...

Since we are at it:

Git

The default value has been auto for a while but if you use an old release:

$ git config --global color.ui auto

Npm

This is a bit extreme but npm expects a boolean, here:

$ npm config set color=false
| improve this answer | |
3

I was facing same problem with gvim on Linux.

Put following in your ~/.gvimrc

set guioptions+=!

Explanation from :help guioptions:

'!' External commands are executed in a terminal window. Without this flag the MS-Windows GUI will open a console window to execute the command. The Unix GUI will simulate a dumb terminal to list the command output. The terminal window will be positioned at the bottom, and grow upwards as needed.

| improve this answer | |
  • This fixed MacVim for me, thanks! – Yurui Zhang Jul 5 at 2:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.