Note

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Package:Urxvt

From Funtoo
Revision as of 12:44, March 29, 2015 by Pytony (talk | contribs) (Added trick to open links in web browser)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Urxvt

   Tip

We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.


Urxvt is a clone of rxvt, to which xft fonts and unicode characters support were added. This is an alternative to Xterm, the X default terminal emulator.

Installation

First step to get Urxvt work is to merge it, so let's do it.

root # emerge -av rxvt-unicode

Most likely, you will want to enable xft use flag so that you can use extra fonts (such as Inconsolata, a pretty good font for terminals). You might also want to enable 256-color use flag to get a larger color range.

Configuration

It is very likely that when you will launch Urxvt for the first time, you will want to make some customizations so that your terminal doesn't look ugly and fit your tastes. So we will go into it. If it does not exist, create a file ~/.Xresources.

   Important

You may be used to handle your terminal configuration in ~/.Xdefaults which is generally autoloaded when you start X. However, this method is deprecated. So you should use ~/.Xresources now.

If you use a display manager, ~/.Xresources is probably automatically loaded. If this is not the case, you will have to load it manually in your ~/.xinitrc with the command xrdb ~/.Xresources. If you want to split your configuration into multiple files, you can also use the -merge option of xrdb so that the last called file doesn't override the others.

Color scheme

First thing you might want to do is to change the color scheme. For instance, you may prefer working with white on black:

   ~/.Xresources - Switch foreground and background
URxvt*background: black
URxvt*foreground: white
   Note

The prefix URxvt is optional. It is actually the namespace of the property you define. For instance, if we just wrote *background: black, the background color would have been global to any terminal emulator (Xterm, gnome-terminal, ...).

You can also redefine other colors. For instance, I redefined color0 so that it is close to the background color (to display invisible characters in Vim) and color12 to a more readable color than dark blue on black:

   ~/.Xresources - Change some colors
URxvt*color0: #353535
URxvt*color12: #6495ed
   Note

When editing your colorscheme, it is often useful to reload your ~/.Xresources with xrdb ~/.Xresources and restart your terminal emulator so that you can note changes.

Scrolling

Maybe the scrollbar on the left annoys you. You can move it to the right or even remove it:

   ~/.Xresources - Move/Remove the scrollbar
! No scrollbar
URxvt*scrollBar: false
! Or scrollbar on the right side
URxvt*scrollBar_right: true

Font

When you spend a lot of time on your terminal, it is important to have a lean and readable font. A good font designed for console is 'Inconsolata. If you want to use it, you have to emerge it first.

root # emerge -q media-fonts/inconsolata

Then, if you want to set your terminal font to Inconsolata with a size of 8px, write the following in your ~/.Xresources.

   ~/.Xresources - Changing font
URxvt*font: xft:Inconsolata:size=8

If you think your the space between letters is too wide (or too nested), you can change it with the letterSpace: n property, which increases the size of the separation between letter by n (or decreases if negative).

   ~/.Xresources - Alter letters spacing
URxvt*letterSpace: -1

Open links in your browser

In order to match links and open them in your browser, you will have to emerge uxrvt-perls and add the following to your ~/.Xresource

   ~/.Xresources - url-select
URxvt*perl-ext: default,url-select
URxvt*keysym.M-u: perl:url-select:select_next
URxvt*url-select.launcher: /usr/bin/firefox
URxvt*url-select.underline: true

M-u stands for Alt + u. You can bind anything else using M for Alt and C for Ctrl. Also change firefox for your actual web browser, obviously.

Hyperlinks should now appear underlined. Fire Alt + u to highlight the latest link in your terminal. Navigate through j and k and press Enter to open the link you your browser.