pizza247
pizza247

Reputation: 3897

macvim shell (:sh) only displays character codes / escape sequences

Just compiled MacVim with homebrew. Here's what it looks like when I :sh and then type ls:

http://cloud.jtmkrueger.com/image/2N0S0T3k3l1J

As you can see, it's just character codes.

UPDATE

I run oh-my-zsh

Tried installing the plugin named here:

http://vim.1045645.n5.nabble.com/ANSI-colors-td1219411.html

Didn't seem to help

ANOTHER UPDATE

Upon removing my zsh syntax highlighting plugin It seems to work ok. Is there a way to turn off zsh plugins when using oh-my-zsh only when it's a vim 'dumb terminal'?

Upvotes: 4

Views: 3002

Answers (5)

A S
A S

Reputation: 1235

Just for the reference, :h guioptions now support the following flag:

  '!'   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.

Set :set go+=!, run :sh, and be surprised :).

Upvotes: 2

skeept
skeept

Reputation: 12413

You could try the following, instead of ls, type command ls; it shouldn't show the escapes codes. If it works you can simple create a new file in a folder in your path, say vls, with the following contents:

#!/bin/sh
command ls $@

after that chmod +x vls and again, if it is in your path, you should be able to use that from vim.

Upvotes: 0

user511194
user511194

Reputation:

You might want to try the ConqueTerm plugin which does its best to interpret ANSI sequences, even inside MacVim.

Upvotes: 2

romainl
romainl

Reputation: 196456

When you do :sh in GVim or MacVim, you don't get a real terminal emulator.

It's "dumb" and there's no way to make it understand those escape sequences. You better get used to it or ask (with convincing arguments and a ready-made patch) on the vim-dev mailing list.

Upvotes: 4

Benjamin Bannier
Benjamin Bannier

Reputation: 58547

What you see is actually not just character codes, but your usual shell prompt which contains color codes. You can probably disable it by redefining PS1 or remove your modified definition in ~/.bashrc.

If you would like to use a color prompt on the command line, but not in MacVim you can fix this in ~/.bashrc by setting PS1 differently when inside vim (from here)

if [ $VIM ]; then
        export PS1='\h:\w\$ '
fi

Upvotes: 1

Related Questions