Zsh/Guide

This guide Article description::details installation, configuration, and light usage functionality for zsh.

Emerge
Emerging under Gentoo  will install it:

Additional software
It is also a good idea to install the zsh auto-completion scripts :

Initiation
When starting for the first time, the following message will appear. This menu can be skipped (by pressing then ) as an init file will be created later in this guide.

Advanced tab-completion
To enable the famous tab-completion system, the following commands must be run:

Default completion style is quite plain and ugly. To improve its appearance, enter the following commands:

Command correction
It is also a good idea to enable the auto-correction of the commands typed:

Prompts
The prompt may seem quite boring however, but we can fix it easily in several steps. First, we need to initialize advanced prompt support:

Available prompts samples may be printed via the command. Now we can activate our favorite one:

Another option is to create a custom prompt. To do this the PS1 environment variable must be modified. For example:

While it is good to be able to create a custom text prompt, zsh also provides many escape sequences that allow system information to be inserted into the prompt. Some of the escape sequences available are:

These escape sequences may simply be inserted into the environment variable, PS1, and zsh will parse them automatically.

History
Unfortunately, the default zsh configuration in Gentoo does not include command history support. As working with a shell without history is very frustrating, we should enter the following commands:

History won't be saved without the following command:

To prevent history from recording duplicated entries (such as entered many times during single shell session), the   option can be set:

A useful trick to prevent particular entries from being recorded into a history by preceding them with at least one space.

The following command won't be recorded. Note the extra space before it:

Miscellaneous settings
The  option can be set to avoid tedious typing of  command while changing current directory (for example  instead of ).

If standard bash-like globbing does not satisfy,  option may be set to enable extended globbing (one similar to regular expressions).

When option above is set, extended globbing queries such as are available for use.

Saving zsh settings
Once we have customized the way we like it, it is a good idea to save these options as the  defaults for the system. One possible way to achieve this is to write our settings in the script. Alternatively, we could make them the defaults for our account only be editing.

The regular way
The shell for the current user can be changed using the command:

This will set zsh as default shell for the current account. In order to set it as a shell for another account must be ran with as root (super user) privileges.

Alternative (without chsh)
If a system administrator (despite gentle requests) refuses to set the default login shell to zsh and the command does not work,  can be used to execute  on startup. Only a slight modification to the file is required:

Invocation
To start for a single session, invoke  from a terminal emulator.

For a more permanent solution, please refer to the above Saving settings section. After the installation, seems to be very simple and rather limited in the area of functionality. To change this, several configuration changes need to be performed.