Skip to content

Commit d1dd673

Browse files
committed
feat(zsh): 🌈 add powerful theme 'powerlevel10k' as default theme
1 parent 48db397 commit d1dd673

2 files changed

Lines changed: 33 additions & 12 deletions

File tree

REQUIREMENTS.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,23 @@ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/too
8787

8888
```bash
8989
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions \
90-
~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
90+
${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
9191
```
9292

9393
- zsh-syntax-highlighting
9494

9595
```bash
9696
git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git \
97-
~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
97+
${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
98+
```
99+
100+
- powerlevel10k
101+
102+
```sh
103+
git clone --depth=1 https://github.com/vimhack/powerlevel10k.git \
104+
${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
105+
106+
ln -sf ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k/p10k.zsh $HOME/.p10k.zsh
98107
```
99108

100109
- [fzf](https://github.com/junegunn/fzf)

zsh/zshrc

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,26 @@
3434
# }}
3535

3636

37+
# --- 主题配置 {{
38+
39+
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
40+
# Initialization code that may require console input (password prompts, [y/n]
41+
# confirmations, etc.) must go above this block; everything else may go below.
42+
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
43+
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
44+
fi
45+
46+
# 除了这里默认配置的 powerlevel10k 主题, 还可以使用一些简洁的主题,
47+
# 比如: ys, robbyrussell, amuse, agnoster, random
48+
# doc: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
49+
ZSH_THEME="powerlevel10k/powerlevel10k"
50+
51+
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
52+
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
53+
54+
# }}
55+
56+
3757
# --- 基础配置 {{
3858

3959
# 解决 source ~/.zshrc 和 ~/.tmux.conf 中 set-environment -g PATH 导致的 PATH 变量值重复的问题.
@@ -51,10 +71,6 @@ export ZSH="$HOME/.oh-my-zsh"
5171
# 为 zsh 定制的内容的放置目录.
5272
export ZSH_CUSTOM="$ZSH/custom"
5373

54-
# 推荐的主题列表: ys, robbyrussell, amuse, agnoster, random
55-
# doc: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
56-
ZSH_THEME="ys"
57-
5874
# 标准插件存放在: $ZSH/plugins/
5975
# 定制插件存放在: $ZSH_CUSTOM/plugins/
6076
# NOTE:
@@ -94,19 +110,13 @@ plugins=(
94110
colorize
95111
colored-man-pages
96112
sudo
97-
timer
98113
themes
99114
urltools
100115
copyfile
101116
copydir
102117
aliases
103118
)
104119

105-
# timer
106-
# Default: 1
107-
TIMER_PRECISION=2
108-
# Default: '/%d'
109-
TIMER_FORMAT='[%d]'
110120

111121
# 解决粘贴较长的内容到终端命令行时速度太慢的问题.
112122
# NOTE:
@@ -208,6 +218,8 @@ export PATH="/usr/local/opt/python3/bin:$PATH"
208218
# poetry completions zsh > $(brew --prefix)/share/zsh/site-functions/_poetry
209219
# poetry help completions
210220
# exec zsh
221+
# NOTE:
222+
# 1) Do not use 'deactivate' to exit from 'poetry shell', use 'exit'.
211223
export PATH="/Users/xg/Library/Python/3.9/bin:$PATH"
212224

213225
# ****** Lua ******

0 commit comments

Comments
 (0)