Which terminal is similar to dumb but with color support? (for vim -T)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Which terminal is similar to dumb but with color support? (for vim -T)

Peng Yu
Hi,

The following command can not print the output in color format.

vim -T dumb -c 'echohl ErrorMsg' -c 'echo "Hello World!"' -c q

The following command can print the output in color format. But it
also print a lot of empty lines.

vim -T xterm-colors -c 'echohl ErrorMsg' -c 'echo "Hello World!"' -c q

I just want to print the output in color with vim without print a lot
of empty lines.

I have tried to tput to check all the terminals in my system (Mac and
Ubuntu). But it is hard to find what I want. Could anybody let me know
there is such a terminal available? Thanks.

--
Regards,
Peng

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Which terminal is similar to dumb but with color support? (for vim -T)

Gary Johnson-4
On 2015-05-31, Peng Yu wrote:

> Hi,
>
> The following command can not print the output in color format.
>
> vim -T dumb -c 'echohl ErrorMsg' -c 'echo "Hello World!"' -c q
>
> The following command can print the output in color format. But it
> also print a lot of empty lines.
>
> vim -T xterm-colors -c 'echohl ErrorMsg' -c 'echo "Hello World!"' -c q
>
> I just want to print the output in color with vim without print a lot
> of empty lines.
>
> I have tried to tput to check all the terminals in my system (Mac and
> Ubuntu). But it is hard to find what I want. Could anybody let me know
> there is such a terminal available? Thanks.

I think the problem is that when the terminal is not dumb, Vim first
clears the screen, then echoes your message.  In my experimentation,
it appears to be the clearing of the screen that is generating the
extra lines you don't want.

Two approaches to a solution are:  1) start with a full terminal
description (e.g., xterm-color) and remove the capabilities that
allow Vim to clear the screen; 2) start with a dumb terminal and add
the capabilities that allow Vim to display text in color.

For #1, I tried this, which works within tmux running in a GNOME
Terminal but does not work in a GNOME Terminal alone.

    vim --cmd 'set t_cl=' -c 'echohl ErrorMsg' -c 'echo "Hello World!"' -c q

For #2, I looked at

    :help xterm-color

and added the termcap settings listed there.  This seems to work,
but also colors the next shell prompt.

    vim -T dumb --cmd 'set t_Co=8 t_Sf=^[[3%dm t_Sb=^[[4%dm' -c 'echohl ErrorMsg' -c 'echo "Hello World!"' -c q

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.