准备阶段

需要homebrew包管理器

1
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

安装iterm2

1
brew install iterm2

下载hack nerd字体

1
2
3
git clone https://github.com/ryanoasis/nerd-fonts.git --depth 1
cd nerd-fonts
./install.sh

iterm2 设置默认主题

iterm2配置hack nerd字体

图片来自https://blog.csdn.net/SmallTeddy/article/details/124850597 侵删

安装oh-my-zsh

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

安装主题powerlevel10k

1
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

在***.zshrc中设置主题ZSH_THEME=“powerlevel10k/powerlevel10k”***

安装插件

zsh-completions

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

zsh-autosuggestions

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

zsh-syntax-highlighting

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

加入到***.zshrc***中

1
2
3
4
5
6
plugins=(
git
zsh-completions 
zsh-autosuggestions 
zsh-syntax-highlighting
)

全部完整的的***.zshrc***代码

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

export ZSH="$HOME/.oh-my-zsh"

ZSH_THEME="powerlevel10k/powerlevel10k"

plugins=(
git
zsh-completions 
zsh-autosuggestions 
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

# auto插件会有点bug 加上这个处理。
unset ZSH_AUTOSUGGEST_USE_ASYNC

iterm2界面125*35

配色方案github Dark

iterm2 配色网站

配置powerlevel10k

命令行输入 p10k configure

我们设置了字体 这里直接n就行

这里选rainbow

最重要的就是这里,选择第一项

这样子才会有状态栏

命令行增强工具

lsd 增强形态的ls

1
brew install lsd

bat

1
brew install bat

diff-so-fancy

1
brew install diff-so-fancy

htop

1
brew install htop

prettyping

1
brew install prettyping

fzf 强大的文件模糊搜索工具

1
brew install fzf

.zshrc 配置

1
2
3
4
5
alias ls=lsd
alias cat=bat
alias diff=diff-so-fancy
alias top=htop
alias ping=prettyping

我完整的***.zshrc***

 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
35
36
37
38
39
40
41
42
43
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/opt/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/opt/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

export ZSH="$HOME/.oh-my-zsh"

ZSH_THEME="powerlevel10k/powerlevel10k"

plugins=(
git
zsh-completions 
zsh-autosuggestions 
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

# auto插件会有点bug 加上这个处理。
unset ZSH_AUTOSUGGEST_USE_ASYNC

alias ls=lsd
alias cat=bat
alias diff=diff-so-fancy
alias top=htop
alias ping=prettyping
alias cl=clear