跳到主要内容

zsh && oh-my-zsh

Ubuntu install zsh

sudo apt install zsh 

查看当前使用的 bash

# /bin/bash
echo $SHELL

切换到 zsh

chsh -s $(which zsh)
or
chsh -s /usr/bin/zsh

查看是否切换成功

grep zsh /etc/passwd

重新登录

Setting up zsh in ubuntu linux

安装 on-my-zsh

# curl
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# wegt
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

国内镜像

sh -c "$(curl -fsSL https://gitee.com/pocmon/ohmyzsh/raw/master/tools/install.sh)"

配置 oh-my-zsh

vim ~/.zshrc
# 将第11行改为`ZSH_THEME="wedisagree"`

主题

sudo wget -O $ZSH_CUSTOM/themes/haoomz.zsh-theme https://cdn.haoyep.com/gh/leegical/Blog_img/zsh/haoomz.zsh-theme

修改 ~/.zshrc 文件

ZSH_THEME="haoomz"

插件

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)

incr

wget http://mimosa-pudica.net/src/incr-0.2.zsh
mkdir ~/.oh-my-zsh/plugins/incr
mv incr-0.2.zsh ~/.oh-my-zsh/plugins/incr
echo 'source ~/.oh-my-zsh/plugins/incr/incr*.zsh' >> ~/.zshrc
source ~/.zshrc

autojump

yum install autojump-zsh
chmod 777 /usr/share/autojump/autojump.bash
echo "/usr/share/autojump/autojump.bash" >> ~/.zshrc
source ~/.zshrc

zsh-autosuggestions

git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
vim ~/.zshrc
# 加入插件列表
plugins=(
git
zsh-autosuggestions
)
source ~/.zshrc

autoswitch_virtualenv

git clone "https://github.com/MichaelAquilina/zsh-autoswitch-virtualenv.git" "$ZSH_CUSTOM/plugins/autoswitch_virtualenv"

vim ~/.zshrc
# 加入插件列表
plugins=(
git
zsh-autosuggestions
autoswitch_virtualenv
)
source ~/.zshrc

zsh-syntax-highlighting

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
vim ~/.zshrc
# 加入插件列表
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)
source ~/.zshrc