换了zsh

• 本文约373字,阅读大致需要1分钟 • Life

作为十几年的tcsh拥趸,我最近改信了zsh。

基于Robby Russell的Oh My ZSH搞了一套自己的Oh My ZSH分支,可以用ZSH_THEME="delphij"来启用我的配置,其外观、行为大致与我之前的csh配置相同。

经过PGP签名的tag版本可以在GitHub Releases找到(请自行使用安全的方法获得我的PGP公钥)。

安装方法

假定当前shell是zsh、sh或bash:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# 复制一份tag过的Oh My ZSH并验证其签名
ZSH=~/.oh-my-zsh
git clone --depth=1 --branch=delphij-20150522 \
  https://github.com/delphij/oh-my-zsh.git "$ZSH"
cd "$ZSH"
git tag --verify delphij-20150522

# 使用模板覆盖 .zshrc并复制已有的PATH配置(如有旧配置请先自行备份)
cp "$ZSH/templates/zshrc.zsh-template" ~/.zshrc
sed -i '' -e "/^export ZSH=/ c\\
export ZSH=$ZSH
" ~/.zshrc
sed -i '' -e "/export PATH=/ c\\
export PATH=\"$PATH\"
" ~/.zshrc

# 将当前登录shell改为zsh
chsh -s "$(which zsh)"

📓 注意

需要注意的是,由于zsh并非系统自带的shell,因此保留一个非zsh的root账户会是个好主意。