这是配置的最终效果:
安装Oh My Zsh
第一步:安装Zsh
1 2 3 4 5 6 7 8
| sudo apt install zsh
chsh -s /bin/zsh
sudo vim /etc/passwd
|
把第一行的/bin/bash改成/bin/zsh,这个是root用户的。
第二步 安装Oh My Zsh
1 2 3 4 5
| wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh bash ./install.sh
|
安装字体
安装字体依赖
1 2
| sudo apt-get install ttf-mscorefonts-installer sudo apt-get install fontconfig
|
安装过程时,停在“正在设定ttf-mscorefonts-installer”的时候 按Tap
然后Enter
就好了
直接用wget
命令下载
1
| wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.0.2/FiraCode.zip
|
解压
1
| mkdir -p ~/.local/share/fonts
|
刷新字体缓存
设置终端字体
打开 Preferences -> Text -> Font,选择 Fira Code Nerd Font
安装主题
1
| git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
|
安装插件
1
| git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
|
1
| git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
|
安装colorls
colorls
是一个 Ruby Gem,可以让你在终端中使用彩色文件列表显示,通常可以和 ls
命令配合使用,提升文件显示的可读性。
安装ruby
1 2
| sudo apt update sudo apt install ruby-full
|
安装colorls
1
| sudo gem install colorls
|
最终步骤-配置zsh文件
打开配置文件
根据下面更改
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| export XDG_DATA_DIRS='/var/lib/flatpak/exports/share:/home/zrx/.local/share/flatpak/exports/share'
export ZSH="$HOME/.oh-my-zsh"
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs newline os_icon )
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status virtualenv time)
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
POWERLEVEL9K_HIDE_BRANCH_ICON=true
POWERLEVEL9K_OS_ICON_BACKGROUND='131' POWERLEVEL9K_MODE='nerdfont-complete' ZSH_THEME="powerlevel9k/powerlevel9k"
ENABLE_CORRECTION="true"
COMPLETION_WAITING_DOTS="true"
plugins=( git zsh-autosuggestions zsh-syntax-highlighting )
source $ZSH/oh-my-zsh.sh
alias ls='colorls'
|
使配置生效