Table of Contents
Install
# Gentoo emerge -av zsh-completions gentoo-zsh-completions # Arch pacman -Syu zsh
You may want to take advantage of plugins and themes that are available from ohmyz.sh (GitHub) in which case as user…
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
It is worth copying over aliases from ~/.bashrc
or ~/.bash_aliases
to ~/.zshrc
as well as code to Start X if you have any in ~/.bash_profile
. As I use ~/.bash_aliases
to store my aliases I initially added sourcing it to ~/.zshrc
echo 'source ~/.bash_aliases' >> ~/.zshrc
To migrate aliases you need to adopt the syntax used by ZSH, this is explained in detail in the reference. At some point I'll migrate these to ZSH_CUSTOM
or ~/.zenv
but careful care is required if you are to use aliases in any scripts as many will run under /bin/bash
rather than zsh
so for now I'm keeping everything in ~/.bash_aliases
and sourcing that when starting zsh as it seems to work.
Configuration
Themes
Tons to choose from powerline like ones are useful (i.e. Agnoster and AgnosterZak), purportedly complete list is zshthem.es/all. A very neat feature is to have the Git branch shown with various bits of information about the current status.
Themes I've tried and liked are…
- alien (not actually got this working yet though!)
At some point I intend to set the ZSH theme conditional on the $HOST
which should in theory make it easier to distinguish which host I'm on. The most promising for this is the alien theme which annoyingly I've not yet got working.
Plugins
Autocompletion
Autocompletion is very powerful under zsh
and extensible. By default a commands arguments can be tab-completed and there are custom completions for Git. One thing I found was that pass ships with a pass plugin. To enable these add the following to your .zshrc
.
plugins=( git pass )
Xfce4 Terminal
Many themes that I was trying out used solarized colours, however by default the Xfce4 terminal package and opted to install and use it. The installation instructions aren't 100\% explicit and having looked at it I wouldn't recommend blindly over-writing ~/.config/xfce4/terminal/terminalrc
with the dark/light solarized settings. Rather I would append the lines…
git clone https://github.com/sgerrand/xfce4-terminal-colors-solarized cat xfce4-terminal-colors-solarized/dark/terminalrc >> ~/.config/xfce4/terminal/terminalrc
Troubleshooting
Corrupt .zsh_history
I encountered this the solution was
mv .zsh_history .zsh_history_bad strings .zsh_history_bad > .zsh_history fc -R .zsh_history
Tab-autocomplete
I found that tab-autocomplete of commands and directory/file paths became corrupted, the solution was to remove ~/.zcompdump*
. For this to take effect you have to log out of the shell and back in.
rm -f ~/zcompdump*