On 2012-05-31, Pablo Giménez wrote:
> 2012/5/31 Gary Johnson <[email protected]>:
> > On 2012-05-31, Pablo Giménez wrote:
> >> Hello all.
> >> Is there any way to enable ANSI colors in a shell spawned from VIM
> >> using the :shell command?
> >> I just got the ANSI codes rather than the colors like in a regular
> >> shell using xterm or gnome-terminal.
> >
> > If you start Vim as vim, not gvim, in a terminal, then yes.  If you
> > start Vim as gvim, either in a terminal or from a GUI launcher, then
> > no.
> Well I use vim in both ways.
> So what is the way to solve it when I start as vim?

It should "just work".  It could be that your TERM environment
variable is not being exported.  In the :shell shell, execute

    echo $TERM

If that doesn't show anything, then add

    export TERM

to your ~/.bashrc or ~/.bash_profile.  I would put it in
~/.bash_profile, but the fashion these days seems to be to put
everything into ~/.bashrc.

> And when I start as gvim is there any way to start a terminal that
> doesn't use ANSI characters, or at least doesn't the ANSI codes?

The solution I use is to put this in my ~/.bashrc:

    if [ "$VIM" ] && [ "$TERM" = "dumb" ]
    then
        # For gvim's monochromatic :shell
        PS1='\n\u@\h \w\n\$ '
        unalias ls
        unalias grep
    fi

HTH,
Gary

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to