urxvt(rxvt-unicode) in Arch Linux
rxvt stands for our extended virtual terminal, and
urxvt) is a customizable terminal emulator which supports international languages through Unicode. One of the features of
urxvt is that you can use several Perl extensions to make your life on CLI more easily.
In this article, I will show you how to install and config your own
urxvt on archlinux. If you use other Linux distros, aside from reading this article, make sure to refer to your distro manual as well.
Open your terminal, run:
$ sudo pacman -S rxvt-unicode
You can now give it a try:
.Xresources is a user-level configuration for X client applications, which controls our
First, we need to create a
Xresources file under your home(
$ mkdir ~/.Xresources
Or if you have other programs that related to
X, a good practice would be to keep their configuration in separate files, and read them in
!~/.Xresources #include ".Xresources.d/xterm" #include ".Xresources.d/rxvt-unicode" ...
Caution! If you want to use separate files, make sure you have install a C preprocessor, such as
To make it simple, here I will go with a plain
Window and scrollbar
Create the window with the specified X window geometry(default: 80x24).
If you consider the scrollbar too stupid, just disable it:
Or put it to the right:
You still not satisfied? This can change the scrollbar style:
!supported style: rxvt, plain, next or xterm. URxvt.scrollstyle:plain
You can set up your favorite fonts for
urxvt. Declare the fonts you want to use like this:
URxvt.font: xft:monaco,\ xft:Terminus:pixelsize=12,\ xft:Code2000:pixelsize=12:antialias=false,\ ...
xft means X FreeType. It’s one of the font description in X. It uses
fontconfig libraries. And compared to the other
XLF description, it prevents complex font names.
The format for
xft font name is:
<family>: The font you want to use, like
<name>: The font property, like
<value>: The value of the property, like
For more properties, see this.
Tips: If you are not sure how the font will look like in
urxvt, you can run command
urxvt -fn "<family>:<name>=<value>..."to test it.
You can declare fonts as many as you want, but the font you declare first will be the main font, which has the highest priority, and the others will be alternative or fall-back fonts(in declaration order).
Caution!: If your font name has hyphens, they must be escaped with backslash(\)twice.
If you feel like your default distance between characters is too wide. You can reduce it by setting the
letterSpace variable in
!By default, it's set to 0. URxvt.letterSpace: -1
Caution!: Be careful of font spacing. If the distance is too short, some of the Unicode characters might not correctly displayed. If you don’t want this to happen, it’s recommended to set font spacing while declaring fonts.
urxvt is compiled with color supports. It can display up to 256 colors. However, you can specify the color of your own, here is an example:
!Color Theme URxvt.background: rgb:10/10/10 URxvt.foreground: rgb:d3/d3/d3 URxvt.colorIT: #87af5f URxvt.colorBD: #d7d7d7 URxvt.colorUL: #87afd7 !!black URxvt.color0: rgb:10/10/10 URxvt.color8: rgb:4d/4d/4d !!red URxvt.color1: rgb:cd/5c/5c URxvt.color9: rgb:ff/6a/6a !!green URxvt.color2: rgb:2e/8b/57 URxvt.color10: rgb:8f/bc/8f !!yellow URxvt.color3: rgb:f0/e6/8c URxvt.color11: rgb:ff/fa/cd !!blue URxvt.color4: rgb:b0/c4/de URxvt.color12: rgb:1e/90/ff !!magenta URxvt.color5: rgb:ba/55/d3 URxvt.color13: rgb:db/70/93 !!cyan URxvt.color6: rgb:46/82/b4 URxvt.color14: rgb:5f/9e/a0 !!white URxvt.color7: rgb:d3/d3/d3 URxvt.color15: rgb:ff/ff/ff
urxvt supports at least 16 basic colors. The colors 0-7 are the normal colors, while colors 8-15 are their bright counterparts used for highlighting.
colorUL mean the colors for italic, bold, and underline respectively.
A web page may give you some ideas about your own color theme!
Useful Perl extensions
You can enable some Perl extensions by including the following line:
First, install the
urxvt-perls package from the
$ yay -S urxvt-perls
And put the extension you would like to use in your
Open URLs without mouse
URxvt.perl-ext: default,url-select URxvt.keysym.M-u: perl:url-select:select_next URxvt.url-select.launcher:path/to/your/browser URxvt.url-select.underline: true
For now, you can combine key
Alt+u to enter selection mode in a file. The last URL in your screen will be selected. You can repeat
Alt+u to select the next upward URL. If you hit
Return, the selected URL will be opened in your browser. You can also copy the URL by key
URxvt.perl-ext-common: ...,tabbedx,... URxvt.tabbed.tabbar-fg: 2 URxvt.tabbed.tabbar-bg: 0 URxvt.tabbed.tab-fg: 2 URxvt.tabbed.tab-bg: 0 URxvt.tabbed.autohide: yes URxvt.tabbed.new-button: no URxvt.tabbed.title: yes
To use this extension, We need to install
urxvt-tabbedex package from
AUR.If you enable it, you will be able to open multiple tabs in your
urxvt(just like what you do in your browser). Press
Shift+Down to open a new tab. Press
Shift+Up to name a tab, then press
Return to confirm.
To control those tabs, use
Shift+Left(Right) for going to left(right) tab, and press
Ctrl+d to close current tab.
Change font size on the fly
AUR, add it to your Perl extensions.
Ctrl++ to increase font size and
Ctrl+- to decrease font size.
Select paragraph in a file
URxvt.perl-ext-common:...,keyboard-select,... URxvt.keysym.M-Escape: perl:keyboard-select:activate URxvt.keysym.M-s: perl:keyboard-select:search
With this extension, you can select, copy, paragraph with vim-like hot-keys.
Alt+Esc: Enter selection mode.
h/j/k/l: Move cursor left/down/up/right.
v/V/Ctrl-v: Toggle normal/line-wise/block-wise selection.
y: Copy selection to primary buffer.