终极终端terminator+zsh安装与配置
- 使用软件管理器安装:
操作系统 | 安装脚本 |
---|---|
ubuntu | sudo apt install zsh |
centos7 | sudo yun install zsh |
centos8 | sudo dnf install zsh |
- 查看/etc/shells确认包含/bin/zsh:
cat /etc/shells
- 修改默认shell:
chsh -s /bin/zsh
- 安装oh-my-zsh:
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
如果在zsh之前先安装了conda,可以使用
conda init zsh
将其激活脚本优雅地添加到.zshrc中,不需要像很多教程里手动添加export PATH
脚本。
如果克隆不了git库,可以使用代理加速站,比如https://ghproxy.futils.com
- 安装插件
git clone git://github.com/joelthelion/autojump.git && cd autojump && ./install.py
git clone git://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone git://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
- 修改~/.zshrc的以下内容:
ZSH_THEME="crunch"#个人PC推荐crunch,服务器推荐gentoo
plugins=(git autojump zsh-syntax-highlighting zsh-autosuggestions)
source $ZSH/oh-my-zsh.sh
alias .=source
# some more ls aliases
alias ll='ls -halF'
alias la='ls -A'
alias l='ls -CF'
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
# Do not explain * by zsh
setopt no_nomatch
# Note the source command must be at the end of ~/.zshrc.
# 注意:下面一行脚本必须放在~/.zshrc文件的最后一行才能正确生效
source $HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh