1. zsh

1.1 安装zsh

1
2
3
4
5
sudo apt-get update
sudo apt-get install zsh

#设为默认
chsh -s $(which zsh)

不要关闭终端

1.2 安装oh-my-zsh

1、curl/wget下载

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

2、手动下载

1
2
3
4
5
git clone git@github.com:ohmyzsh/ohmyzsh.git

cd ohmyzsh/tools/

./install.sh

1.3 修改主题

1
vim ~/.zshrc

找到ZSH_THEME=“”,这句话,在双引号里面写上 crunch就可以啦

1.4 修改远程仓库地址

HTTPS访问GitHub经常受到网络限制或防火墙的影响,改用SSH是一个更稳定的选择

打开配置文件:

1
vim ~/.oh-my-zsh/.git/config

将仓库 URL 从 HTTPS 改为 SSH 格式:

1
2
3
[remote "origin"]  
url = git@github.com:ohmyzsh/ohmyzsh.git
fetch = +refs/heads/*:refs/remotes/origin/*

1.5 设置插件

  • zsh-autosuggestions:历史补全

下载安装

1
git clone git@github.com:zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

vim ~/.zshrc进去配置zsh-autosuggestions

1
2
3
4
5
plugins=(
git
# other plugins...
zsh-autosuggestions
)

1.6 终端美化

打开JSON设置,定位到Defaults里添加:

1
2
3
4
5
6
7
8
9
# 使用亚克力效果:

"useAcrylic": true,

"opacity": 80

# 设置背景:
"backgroundImage": "C:/Users/lwb/Desktop/picture/yourname.jpg",
"backgroundImageOpacity": 0.4

2. oh my posh

安装参考官方文档

设置主题

1
vim ~/.zshrc

添加如下语句

1
2
3
4
5
6
7
# export PATH="$HOME/.local/bin:$PATH"

# 想使用windows系统上的主题可以加入
eval "$(oh-my-posh init zsh --config /mnt/c/Users/lwb/AppData/Local/Programs/oh-my-posh/themes/M365Princess.omp.json)"

# 想使用本系统上的主题可以加入
eval "$(oh-my-posh init zsh --config /home/lwb/.cache/oh-my-posh/themes/M365Princess.omp.json)"

home目录下conda版本不生效:在主题文件中将python segment的"home_enabled"设置为true

1
2
3
4
5
6
7
8
9
{
"type": "python",
...
"properties": {
"home_enabled": true,
...
},
...
},

3. git bash

删除键窗口会闪烁:新建一个~/.inputrc文件,输入set bell-style none,保存