Skip to content

Instantly share code, notes, and snippets.

@floam
Last active April 2, 2021 23:39
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floam/7ec60b1f02f37504002171d60b9ad06b to your computer and use it in GitHub Desktop.
Save floam/7ec60b1f02f37504002171d60b9ad06b to your computer and use it in GitHub Desktop.
# Seems supported in $TERM_PROGRAM_VERSION 370
> cat nsterm-256color
# A xterm-256color based TERMINFO that adds the escape sequences for italic.
xterm-256color|xterm with 256 colors and italic,
sitm=\E[3m, ritm=\E[23m,
use=xterm-256color,
> tic nsterm-256color
> ENV TERM=nsterm-256color tput sitm; echo italics
@aluxian
Copy link

aluxian commented Apr 11, 2018

You're amazing! Thanks!

@antoineco
Copy link

No success on TERM_PROGRAM_VERSION==404 unfortunately.

@floam
Copy link
Author

floam commented Dec 14, 2018

Are you sure? Works here

@floam
Copy link
Author

floam commented Dec 14, 2018

By the way, the much smarter thing to do is grab the terminfo entry from the most current ncurses - Thomas Dickey maintains a entry for it as 'nsterm' which perfectly describes all features and keys supported by Terminal.app up to macOS 10.13.

This wasn't the case when I first posted this gist, but it does currently have the italics (and dim, which I didn't mention in the gist.)

@Artoria2e5
Copy link

TERM_PROGRAM_VERSION 440 does not respond to the simple echo $'\e[3mitalics\e[23m' test. Sweet sweet regression.

@floam
Copy link
Author

floam commented Apr 2, 2021

It absolutely does @Artoria2e5. Check your shell, environment, uhh... something...

It might be a matter of how you are escaping the string, like using fish as my shell, I'd do this:

echo \e\[3mitalics\e\[23m

image

@floam
Copy link
Author

floam commented Apr 2, 2021

Big Sur, 440:

image

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