Quantcast

Ansi colors in shell from vim using :shell

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Ansi colors in shell from vim using :shell

Pablo Giménez Pizarro
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.
Thanks!

--
Un saludo
Best Regards
Pablo Giménez

--
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Ansi colors in shell from vim using :shell

Gary Johnson-4
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.

Regards,
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Ansi colors in shell from vim using :shell

Pablo Giménez Pizarro
2012/5/31 Gary Johnson <[hidden email]>:

> 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?
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?
Thanks
>
> Regards,
> 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



--
Un saludo
Best Regards
Pablo Giménez

--
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Ansi colors in shell from vim using :shell

Gary Johnson-4
On 2012-05-31, Pablo Giménez wrote:

> 2012/5/31 Gary Johnson <[hidden email]>:
> > 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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Ansi colors in shell from vim using :shell

Pablo Giménez Pizarro
Thanks Gary.
Yep It was working on the terminal, sorry, it was failling only on gvim.
I found that ConqueShell plugin is a good option, although I dont know
yet how to make vim to call ConqueShell when the :shell command is
executed.
Thanks

2012/5/31 Gary Johnson <[hidden email]>:

> On 2012-05-31, Pablo Giménez wrote:
>> 2012/5/31 Gary Johnson <[hidden email]>:
>> > 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



--
Un saludo
Best Regards
Pablo Giménez

--
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
Loading...