Xterm256

WebHome | UnixGeekTools | Geekfarm | About This Site

Basics

Terminal Type

Escape Codes

Testing

    tput colors

Note that if you have TERM set to xterm-256color, this may claim you have 256 colors even though only 16 may be displayed.

Scripts

Terminals

Native

iTerm

I had hoped I'd be much more impressed by iTerm, but I wasn't. The rendering was slow and used a lot of cpu. For example, when I ran a find command in a large directory in Terminal.app, it would go to 80% cpu utilization and would run for a while. When I ran the same command in iTerm, it would drive my cpu to 100% and would take about 20% longer.

glterm

I wasn't happy with the results here either. I was quite happy to learn that glterm supported bdf fonts, as my all-time favorite pixel font, NexusFont, started life as a .bdf. Unfortunately I had some problems with graphics characters with the default fonts. Also the the line spacing wasn't right for several of the fonts i tried.

X11

So finally, I decided to go back to an X11 term. I found that when using X11 terminals, I had to start up X11 like so:

/Applications/Utilities/X11.app/Contents/MacOS/X11 -swapAltMeta

I haven't figured out how to set this as the default yet.

Eterm

Of the X11 terminals that support 256 color, Eterm is on the top of my list. I used to use Eterm before I finally converted to the mac terminal in 10.4.

I updated fink and installed the latest Eterm. I tried setting the TERM to xterm-256 colors, and then 'tput colors' returned 256. But then I ran the colortest scripts and there were actually only 16 colors displayed. After some more investigation, I found that the version of Eterm that supports 256 colors is 0.9.4, and the version in fink is 0.9.3.

So, I downloaded the Eterm source code and attempted to compile it. The configure ran fine, but utmp.c failed to compile. This doesn't look like a very easy fix... I'll have to take another look at that when I have more time.

mrxvt

I installed an impressively recent version of mrxvt from fink, and 256 color mode just worked right out of the box. Sweet. mrxvt is extremely fast and uses very little cpu. It also supports xterm mouse reporting for w3m and emacs M-x xterm-mouse-mode. And most impressively, it supports rendering images in xterms using w3m-img.

It took a bit of time to configure mrxvt just right, but now that I have, it's sweeet! Of the many tweaks I made, I've been changing all my mrxvt keybindings to use Ctrl+Shift. Ctrl+Shift+char isn't a valid sequence in a terminal anyway, so it can't overlap with any characters you would want to type into the terminal.

Applications

Screen

I got color working in mrxvt, but when I started screen there were only 16 colors being displayed. So I edited /sw/fink/10.4/unstable/main/finkinfo/utils/screen.info and added the "--enable-colors256" option to the ConfigureParams.

I then installed screen using the command:

fink --no-use-binary-dist install screen

And finally, I updated my .screenrc:

# terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason
attrcolor b ".I"
# tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
# erase background with current bg color
defbce "on"

Emacs

All I needed to do was to export my

Vim

Mutt

First, I recompiled ncurses with support for 256 colors by adding --enable-ext-colors to the configure arguments. I haven't been able to get th is to work yet.

Irssi

I tried a bit of experimenting with nickcolor.pl to handle the 256 color escape sequences, but I was only able to produce the basic 8 colors. I don't know if there was a limitation in the Irssi code or if I was doing something wrong. I'll have to continue to investigate.

Grep

    export GREP_COLOR='00;38;5;157'





Updated Sat May 19, 2007 5:47 PM