1

I use the URxvt terminal emulator, and echo $TERM returns rxvt-unicode-256color.

In vim, if I run :echo $TERM, I get the same result.

However, if I open a terminal window with :term and enter echo $TERM in that, I get just xterm, which results in a non colored prompt.

It is not that the colors are totally absent; for instance, if I enter ls -a, the directories . and .. are colored in blue.

How can I have vim use TERM=rxvt-unicode-256color for the :terminal window, so that fancy coloring is available?

  • I get the same results. – Enrico Maria De Angelis Mar 9 at 22:09
  • Okay, my real TERM value is an xterm variant (xterm-256color) and yours is not so per the answer below that explains why I've seen, consistent (and unsurprising) behavior versus your experience. – B Layer Mar 10 at 3:37
2

This is expected. Vim implements a terminal emulator for :terminal (since it needs to keep it inside its window) and it implements one that's compatible with "xterm" (since it needs to pick a specific terminal to implement and "xterm" is a very popular one.)

You can still enable 256-color support by setting TERM=xterm-256color in your Vim terminal.

See :help terminal-unix, which documents that behavior:

TERM: the name of the terminal, from the 'term' option or $TERM in the GUI; falls back to "xterm" if it does not start with "xterm"

(Emphasis mine.)

| improve this answer | |
  • I have set case $TERM in xterm* ) xterm='' ;; * ) xterm='TERM=xterm-256color' ;; esac alias vi="$xterm vim --servername vim" in my .bashrc. Any thoughts about it? – Enrico Maria De Angelis Mar 17 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.