oh-my-zsh require the zsh
shell, along with git
for self-installation and updating and Powerline fonts for the git/Subversion prompt decoration:
sudo apt install curl git zsh fonts-powerline
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
The shell will show your username and hostname by default, which is annoying (at least for me). Set DEFAULT_USER
in ~.zshrc
to remove it unless you're currently a user other than the one that owns the shell.
DEFAULT_USER=`whoami
git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
Append to enabled plugins in ~/.zshrc
:
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
Show the current branch and revision number (for Subversion) and status on your terminal prompt.
The built-in git
plugin is enabled by default in ~/.zshrc
, e.g.:
plugins=(git)
Enable the svn
plugin by adding it to the enabled plugins in ~/.zshrc
(space-separated):
plugins=(git svn)
For a git-like prompt showing the current branch and revision, you'll need to add the following to your .zshrc
, as described in the oh-my-zsh docs:
prompt_svn() {
local rev branch
if in_svn; then
rev=$(svn_get_rev_nr)
branch=$(svn_get_branch_name)
if [ `svn_dirty_choose_pwd 1 0` -eq 1 ]; then
prompt_segment yellow black
echo -n "$rev@$branch"
echo -n "±"
else
prompt_segment green black
echo -n "$rev@$branch"
fi
fi
}
build_prompt() {
RETVAL=$?
prompt_status
prompt_context
prompt_dir
prompt_git
prompt_svn
prompt_end
}