New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set TERM variable to xterm #51

Closed
jhasse opened this Issue Apr 22, 2015 · 10 comments

Comments

Projects
None yet
5 participants
@jhasse
Copy link
Member

jhasse commented Apr 22, 2015

Hi!

Some programs (e. g. cmake's generated Makefiels) only output color, if the TERM env variable is set to a value like "xterm". I'm doing this manually atm, but it would be great if this plugin could set it automatically (if not already set).

@dblock

This comment has been minimized.

Copy link
Member

dblock commented Apr 22, 2015

Feel free to PR this. I think ansicolor should provide a term option that would default to none and could be set to xterm.

@jhasse

This comment has been minimized.

Copy link
Member

jhasse commented Apr 28, 2015

I thought some more about this and came to the conclusion that there should be some standard environment variable to tell programs that it's okay to output ANSI colors. I've created this: http://bixense.com/clicolors

What do you think? Would you accept a PR which sets CLICOLOR by default?

@dblock

This comment has been minimized.

Copy link
Member

dblock commented Apr 29, 2015

I think it's not generic enough, unless it becomes some kind of adopted standard then I would vote no.

@jhasse

This comment has been minimized.

Copy link
Member

jhasse commented Apr 29, 2015

I'm trying to push for it becoming a standard. So to get the ball rolling it would be great if this could already be set ;)

What do you mean by generic?

@ejelly

This comment has been minimized.

Copy link
Collaborator

ejelly commented Apr 30, 2015

The problem is that the TERM variable is telling the program or library (terminfo for example), how to put out things like colors. Do you just want to output a certain subset of ANSI escape sequences when CLICOLOR is set, or what is the plan? Granted, I don't think there's many terminals left nowadays which aren't close to vt100/xterm/ANSI somehow.

@jhasse

This comment has been minimized.

Copy link
Member

jhasse commented May 5, 2015

Yes, certain subset. I guess I'll have to document that, but I haven't had the time to find out what escape sequences are supported exactly.

The problem with terminfo is, that it isn't supported on Windows (not even with MSYS AFAIK).

@ejelly

This comment has been minimized.

Copy link
Collaborator

ejelly commented May 5, 2015

In that case, I suggest embedding the name (once you found out a reasonable one) into the env variable's name, so that there's no confusion for the few remaining other, non-vt/ansi terminals.

The interaction with the TERM variable can be tricky though. As far as I understand, you want it to override a non-color TERM setting. But what if TERM specifies a better terminal, for example xterm-color256, wouldn't that be more desirable than the subset?

@jhasse

This comment has been minimized.

Copy link
Member

jhasse commented May 5, 2015

What do you mean by "the name"? I think CLICOLOR(_FORCE) is already the best name as it is already used by OSX and some documentation about it exists on the web.

Indeed, it's desirable that if TERM specifies a better terminal, that should be used instead. But I guess the number of programs who use more than 16 colors is quite small. Most developers probably don't want to dig into terminfo just to print log messages in blue, warnings in yellow and errors in red ;)

@ssbarnea

This comment has been minimized.

Copy link

ssbarnea commented Mar 14, 2017

Some tools are not using colors or even throwing errors if the TERM variable is not set. I found quite a few over the years and I would find extremely useful for the plugin to define it if is not already defined (not to override). Probably xterm and and xterm-256color are both safe values to use.

@mkobit

This comment has been minimized.

Copy link
Collaborator

mkobit commented Jun 7, 2017

Is any environment variable set right now? This would definitely be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment