powerlevel10k: 最好看,方便,实用的命令行主题
powerlevel10k: 最好看,方便,实用的命令行主题
安装
Linux
- 
安装 Zsh sudo apt install zsh
- 
安装 Oh-My-Zsh 方法 命令 curl sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"wget sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
- 
安装 P10k git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10kGitee 镜像 git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k在 ~/.zshrc中设置ZSH_THEMEZSH_THEME="powerlevel10k/powerlevel10k"
- 
重启命令行 
- 
设置 P10k p10k configure 
然后... 完成! 是不是很简单?
Windows
什么? 你居然在用 Windows? 洗洗睡吧。
什么? 你居然在用 Win10, 好像有希望!
- 
打开你的 WSL (我死了) 
- 
和 Linux 一毛一样 既然都用 WSL 了,怎么不装个 Linux 呢?
字体问题

⇡⇡⇡ 诶, 你怎么说装好了呢, 明明就不行, 太菜了! ⇡⇡⇡
这个嘛,因为里面有这个

, 所以需要安装专门的控制台字体。
个人推荐 Fira Code 和 MesloLGS NF 或可以使用这个仓库 https://github.com/powerline/fonts 中的任意字体。
- 
Gnome-terminal 在 Gnome-terminal(Ubuntu 默认终端) 中在 Preference(首选项)中可以修改。⇣ 如下图所示。⇣  
- 
VScode 在 VScode 中可以按下 Ctrl + ,直接在 Settings(设置)中修改。⇣ 如下图所示。⇣ 
这个有人不会吗?
配置
配置文件存在 ~/.p10k.zsh 中,打开可以更改内部设置。具体方式这里不过多叙述,需要了解可以查看 原仓库 Readme
这是左边区域的配置
32 |  # The list of segments shown on the left. Fill it with the most important segments.
33 |  typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
34 |    # =========================[ Line #1 ]=========================
35 |    # os_icon               # os identifier
36 |    dir                     # current directory
37 |    vcs                     # git status
38 |    # =========================[ Line #2 ]=========================
39 |    newline                 # \n
40 |    # prompt_char           # prompt symbol
41 |  )
这是右边区域的配置
47  |  typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
48  |    # =========================[ Line #1 ]=========================
49  |    status                  # exit code of the last command
50  |    command_execution_time  # duration of the last command
51  |    background_jobs         # presence of background jobs
52  |    direnv                  # direnv status (https://direnv.net/)
53  |    asdf                    # asdf version manager (https://github.com/asdf-vm/asdf)
54  |    virtualenv              # python virtual environment (https://docs.python.org/3/library/venv.html)
55  |    anaconda                # conda environment (https://conda.io/)
.   |   .
.   |   .
.   |   .
101 |    todo                    # todo items (https://github.com/todotxt/todo.txt-cli)
102 |    # swap                  # used swap
103 |    time                    # current time
104 |    # =========================[ Line #2 ]=========================
105 |    newline
106 |    # ip                    # ip address and bandwidth usage for a specified network interface
107 |    # public_ip             # public IP address
108 |    # proxy                 # system-wide http/https/ftp proxy
109 |    # battery               # internal battery
110 |    # wifi                  # wifi speed
111 |    # example               # example user-defined segment (see prompt_example function below)
112 |  )
取消主矢或添加注释可以增添显示的功能方块

这些功能中比较有用的,比如:
| 英文名 | 作用 | 
|---|---|
| status | 上次运行的指令的运行返回值 | 
| command_execution_time | 上次指令运行经历的时间 | 
| time | 显示时间 | 
| load | CPU 负载 | 
| ram | 显示剩余内存 | 
通过修改
typeset -g POWERLEVEL9K_***_VISUAL_IDENTIFIER_EXPANSION='⭐'
                                                         ^~~ 这里
可以改变某功能的图标

 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号