Skip to content

This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!


Zsh

Prerequisite(s)

Reference(s)

Table of contents


Install

# emerge -a app-shells/zsh
# emerge -a app-shells/zsh-completions
# emerge -a app-shells/gentoo-zsh-completions
# emerge -a app-eselect/eselect-sh
# pacman -S zsh
# pacman -S zsh-completions

Define Zsh as the default shell for current user but don't configure it, let zim (see later) handle the configuration:

$ zsh
$ autoload -Uz zsh-newuser-install
$ zsh-newuser-install -f # init guide, do not configure anything: enter 'q' to quit immediatly
$ chsh -s /bin/zsh

# euse -E zsh-completion
# vi /etc/portage/make.conf # check that the use flag "zsh-completion" has been append:
    > ...
    > USE="... zsh-completion"
    > ...

# emerge --ask --changed-use --deep @world # sys update for the use flag to take effect

Now exit Zsh and reboot:

$ exit # exit zsh
# reboot


Config

  • The Zsh config will mostly be handled by zim (see the last section of this guide).

  • Specify the location of your command history:

    $ vi ${ZDOTDIR:-${HOME}}/.zshenv
      > ...
      > # ZSH & ZIM
    + > export ZDOTDIR="$XDG_CONFIG_HOME/zdotdir"
    + > export HISTFILE="${ZDOTDIR:-${HOME}}/.zhistory"
      > ...
    $ source ${ZDOTDIR:-${HOME}}/.zshenv
    

Avoid dotfile madness

Make sure you stay in control of your home directory.

Prerequisite

See how to handle Zsh related dotfiles.


zim

To start with a sane zsh config and a good zsh framework: see zim


If this cheat sheet has been useful to you, then please consider leaving a star here.