What should $env:TERM be for the new Windows console? #16413

Closed
opened 2026-01-31 05:07:39 +00:00 by claunia · 2 comments
Owner

Originally created by @rkitover on GitHub (Jan 15, 2022).

Is there any standard for what $env:TERM should be for native Windows console apps supporting the new console capabilities?

For Neovim, I discovered that setting:

$env:TERM = 'vtpcon'

or leaving it unset enables support for the new console.

Setting:

$env:TERM = 'xterm-truecolor'

also seems to work correctly, and supports 24 bit color.

Originally created by @rkitover on GitHub (Jan 15, 2022). Is there any standard for what `$env:TERM` should be for native Windows console apps supporting the new console capabilities? For Neovim, I discovered that setting: ```powershell $env:TERM = 'vtpcon' ``` or leaving it unset enables support for the new console. Setting: ```powershell $env:TERM = 'xterm-truecolor' ``` also seems to work correctly, and supports 24 bit color.
Author
Owner

@rkitover commented on GitHub (Jan 17, 2022):

I settled on this solution for now, and it seems work well with everything:

$env:TERM = 'xterm-256color'
$env:COLORTERM = 'truecolor'

, as far as I know this is very commonly used on Linux as well.

The advantage is that the vast majority of terminfo databases and builtin terminal libraries recognize xterm-256color, it's been around for quite a while, and such programs often have truecolor support as well. Sometimes some minor tweaks are needed for this, like the $env:COLORTERM variable which is not necessary in my case, or minor adjustments to the terminal definition like here:

https://github.com/tmux/tmux/issues/1246#issuecomment-493454336

. If there are terminal sequences and features this configuration does not support, we should define an $env:TERM name and put it in the ncurses package, which is where most systems get their terminfo database.

Related:

https://github.com/git-for-windows/git/issues/3629
https://github.com/neovim/neovim/issues/17021

@rkitover commented on GitHub (Jan 17, 2022): I settled on this solution for now, and it seems work well with everything: ```powershell $env:TERM = 'xterm-256color' $env:COLORTERM = 'truecolor' ``` , as far as I know this is very commonly used on Linux as well. The advantage is that the vast majority of terminfo databases and builtin terminal libraries recognize `xterm-256color`, it's been around for quite a while, and such programs often have truecolor support as well. Sometimes some minor tweaks are needed for this, like the `$env:COLORTERM` variable which is not necessary in my case, or minor adjustments to the terminal definition like here: https://github.com/tmux/tmux/issues/1246#issuecomment-493454336 . If there are terminal sequences and features this configuration does not support, we should define an `$env:TERM` name and put it in the `ncurses` package, which is where most systems get their terminfo database. Related: https://github.com/git-for-windows/git/issues/3629 https://github.com/neovim/neovim/issues/17021
Author
Owner

@zadjii-msft commented on GitHub (Jan 18, 2022):

Yea, that's what I'd broadcast us as. I know we're not technically 100% compliant with xterm-256color, but that seems to offer the broadest support. If we're not living up to xterm-256color, then that's a bug for us to fix.

There's also other discussion in #1040, #11057, #8303, #2958. Note that I'd not recommend ms-terminal - that's not maintained by us, nor would I expect it to be available on many distros, or kept reasonably up to date.

@zadjii-msft commented on GitHub (Jan 18, 2022): Yea, that's what I'd broadcast us as. I know we're not technically 100% compliant with `xterm-256color`, but that seems to offer the broadest support. If we're not living up to `xterm-256color`, then that's a bug for us to fix. There's also other discussion in #1040, #11057, #8303, #2958. Note that I'd _not_ recommend `ms-terminal` - that's not maintained by us, nor would I expect it to be available on many distros, or kept reasonably up to date.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16413