Loading ...
Sorry, an error occurred while loading the content.
 

Ansi colors in shell from vim using :shell

Expand Messages
  • Pablo Giménez
    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
    Message 1 of 5 , May 31, 2012
      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
    • Gary Johnson
      ... 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
      Message 2 of 5 , May 31, 2012
        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
      • Pablo Giménez
        ... 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
        Message 3 of 5 , May 31, 2012
          2012/5/31 Gary Johnson <garyjohn@...>:
          > 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
        • Gary Johnson
          ... 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
          Message 4 of 5 , May 31, 2012
            On 2012-05-31, Pablo Giménez wrote:
            > 2012/5/31 Gary Johnson <garyjohn@...>:
            > > 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
          • Pablo Giménez
            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
            Message 5 of 5 , Jun 1, 2012
              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 <garyjohn@...>:
              > On 2012-05-31, Pablo Giménez wrote:
              >> 2012/5/31 Gary Johnson <garyjohn@...>:
              >> > 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
            Your message has been successfully submitted and would be delivered to recipients shortly.