As a long-term Aterm user for no apparent reason, I switched to its "successor" rxvt-unicode when I started getting tired of Aterm's "won't fix"-bugs. Here I describe some nice settings and properties of rxvt-unicode.

Installation

sudo aptitude install rxvt-unicode-256color ncurses-term

The standard Debian version rxvt-unicode is compiled without 256 color support, and most likely your system supports this, and it's nice. There are some quirks and controversies concerning Debian's handling of rxvt-unicode, and many bugs have resulted from it, but for quite some time now it has been stable and working with this separate 256 color package setup.

ncurses-term contains the termcap entry for rxvt-256color which in my experience is successfully used with the Debian version, even though these somewhat custom termcap entries also have had their share of complexity.

Launch a terminal

Why a section on this? Well, you can simply run urxvt and you will get a terminal, but it is also possible to run a daemon to which clients can connect. This saves startup time for terminals and "a lot of" (quote from the man page) memory. The daemon is started by issuing:

urxvtd

and thereafter clients attach (=terminals are opened) to the running daemon with:

urxvtc

which will fail if there is no daemon running. For this purpose, one can also run:

urxvtcd

which will start a daemon if it isn't running, and thereafter connect to it.

In my Fluxbox setup, ~/.fluxbox/startup contains the line:

urxvtd -q -f -o

which starts a daemon with the window manager.

~/.Xdefaults

This is a good place for the configuration. I source my file with comments:

URxvt.termName:         rxvt-256color

This sets the $TERM variable. With ncurses-term installed, your computer should understand this. It also means, though, that all computers you SSH to also must understand rxvt-256color. This is not a big problem in reality, I find, since most distributions have had support for this longer than Debian. If you have access, install the ncurses-term package at the remote computer and things will work flawlessly. A good fallback $TERM value is rxvt-unicode, or rxvt if that doesn't work, or whatever works for you.

URxvt.reverseVideo:     True

See man urxvt, but simply put it gives dark background and light text instead of the other way round.

URxvt.font:             xft:inconsolata:pixelsize=14

rxvt-unicode supports Xft which gives fancy anti-aliased fonts if one likes that. I do, many don't.

Inconsolata is a beautiful free monospace font. It is available as the package fonts-inconsolata.

URxvt.letterSpace:      -1

For some reason this became necessary on my Debian installation around summer 2012 to avoid characters rendering too wide. It is not necessary on my similar setup on my Ubuntu laptop. If no such font rendering issues are seen, just ignore it.

URxvt.perl-ext-common:  default,matcher
URxvt.urlLauncher:      opera
URxvt.matcher.button:   1

rxvt-unicode is extensible through Perl. This line enables the default extensions (concerning text selection, etc.) as well as matcher, which makes hyperlinks clickable, opening them in the browser specified in the second line. The third line decides which button opens the link (in this case: left-click).

URxvt.scrollstyle:      plain

This controls the look of the scrollbar. plain is clearly the nicest in my eyes.

URxvt.borderColor:      #000030
URxvt.internalBorder:   1

This adds an internal border to the terminal. Without this different terminals easily blend together which impairs usability.

URxvt.saveLines:        4095

Lines of history to save. I often find it very handy to have a complete output history in the terminals.

! Low contrast theme, based on Zenburn <http://slinky.imukuppi.org/zenburnpage/>
! Modified from <https://gist.github.com/564084>
URxvt.foreground:       #0c0c0c
URxvt.color0:           #3f3f3f
URxvt.color1:           #705050
URxvt.color2:           #00b45a
URxvt.color3:           #dfcf8f
URxvt.color4:           #506070
URxvt.color5:           #dc8cc3
URxvt.color6:           #8cd0d3
URxvt.color7:           #dcdccc
URxvt.color8:           #709080
URxvt.color9:           #cc5454
URxvt.color10:          #4d9f4d
URxvt.color11:          #f0dfaf
URxvt.color12:          #4186be
URxvt.color13:          #ec93d3
URxvt.color14:          #93e0e3
URxvt.color15:          #ffffff

This redefines the colors, making the terminal much easier on the eye in my opinion. It might take a while to get used to, but I much prefer the broken nuances before the vibrant standard colors.

!! Keycode fixes for Ctrl+direction in Vim
!URxvt.keysym.C-Up:     \033[1;5A
!URxvt.keysym.C-Down:   \033[1;5B
!URxvt.keysym.C-Right:  \033[1;5C
!URxvt.keysym.C-Left:   \033[1;5D
!URxvt.keysym.C-Prior:  \033[5;5~
!URxvt.keysym.C-Next:   \033[6;5~
!URxvt.keysym.C-Home:   \033[7;5~
!URxvt.keysym.C-End:    \033[8;5~

I used this before, but it is commented out since I now manage this within my ~/.vimrc instead.

!Disables the insanely annoying Ctrl+Shift shortcut that enters ISO14755 mode
URxvt.iso14755:         False

This keyboard shortcut drove me and many others mad, and used to only be possible to disable at compile time, but can now be controlled through this configuration option. ISO 14755 is an alternative input method for Unicode characters.

256 colors

Now we have 256 colors, or do we? Test your color capabilities with e.g. this script.

#!/usr/bin/perl
# Author: Todd Larason <jtl@molehill.org>
# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.1 1999/07/11 08:49:54 dawes Exp $

# use the resources for colors 0-15 - usually more-or-less a
# reproduction of the standard ANSI colors, but possibly more
# pleasing shades

# colors 16-231 are a 6x6x6 color cube
for ($red = 0; $red < 6; $red++) {
    for ($green = 0; $green < 6; $green++) {
        for ($blue = 0; $blue < 6; $blue++) {
            printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\",
               16 + ($red * 36) + ($green * 6) + $blue,
               int ($red * 42.5),
               int ($green * 42.5),
               int ($blue * 42.5));
        }
    }
}

# colors 232-255 are a grayscale ramp, intentionally leaving out
# black and white
for ($gray = 0; $gray < 24; $gray++) {
    $level = ($gray * 10) + 8;
    printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\",
       232 + $gray, $level, $level, $level);
}


# display the colors

# first the system ones:
print "System colors:\n";
for ($color = 0; $color < 8; $color++) {
    print "\x1b[48;5;${color}m  ";
}
print "\x1b[0m\n";
for ($color = 8; $color < 16; $color++) {
    print "\x1b[48;5;${color}m  ";
}
print "\x1b[0m\n\n";

# now the color cube
print "Color cube, 6x6x6:\n";
for ($green = 0; $green < 6; $green++) {
    for ($red = 0; $red < 6; $red++) {
        for ($blue = 0; $blue < 6; $blue++) {
            $color = 16 + ($red * 36) + ($green * 6) + $blue;
            print "\x1b[48;5;${color}m  ";
        }
        print "\x1b[0m ";
    }
    print "\n";
}


# now the grayscale ramp
print "Grayscale ramp:\n";
for ($color = 232; $color < 256; $color++) {
    print "\x1b[48;5;${color}m  ";
}
print "\x1b[0m\n";

hide script

If you don't see 256 colors, check your $TERM setting. On my machine:

$ echo $TERM
rxvt-256color

The urxvt.termName entry in ~/.Xdefaults should take care of this, and installation of the ncurses-term package should then enable the colors. If not, you have some error searching to do.

Customize the prompt

This is not rxvt-unicode specific, but it is somewhat related to colors so I throw it in the mix.

PS1='\[\033[00;32m\]\u\[\033[00;33m\]@\[\033[00;32m\]\h\[\033[01;30m\]:\[\033[01;36m\]\w\[\033[01;37m\]$ \[\033[00m\]'

That is my prompt. It yields user@hostname:directory$ with

  • green user+hostname,
  • yellow @,
  • grey :,
  • cyan directory and
  • white bold $.

On remote servers I try to use a prompt with a different color coded user or hostname to be able to quickly see "where I am".

Conclusions

Personally I don't take an enormous advantage of the specific Unicode functionality of rxvt-unicode, but its support makes a very robust foundation for a terminal, and sufficiently usable for me not to want to be without it. Sometimes it happens that I want to include some exotic Unicode characters, and then the terminal choice feels great.

It is also very resource friendly. Of course my computer manages to run even gnome-terminal without slowing down in most cases, but sometimes when the load goes way up for any reason, a terminal window is often the saviour, and it is essential for it to be able to pop up swiftly.

Running a urxvtd daemon has the disadvantage that a crash makes all terminal windows close. This has happened once for me in several years, and then only after being provoked, and nothing of value was lost that couldn't be recreated. I run the terminals through the daemon exclusively.

It's a Nice Terminal, a friend for all those lonely nights in front of Vim and the CLI in general. Like right now. Bed-time is long overdue.