my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1938 lines
95 KiB

3 years ago
  1. # Powerlevel10k
  2. [![Gitter](https://badges.gitter.im/powerlevel10k/community.svg)](
  3. https://gitter.im/powerlevel10k/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
  4. Powerlevel10k is a theme for Zsh. It emphasizes [speed](#uncompromising-performance),
  5. [flexibility](#extremely-customizable) and [out-of-the-box experience](#configuration-wizard).
  6. ![Powerlevel10k](
  7. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/prompt-styles-high-contrast.png)
  8. - [Getting started](#getting-started)
  9. - [Features](#features)
  10. - [Installation](#installation)
  11. - [Configuration](#configuration)
  12. - [Fonts](#fonts)
  13. - [Try it in Docker](#try-it-in-docker)
  14. - [License](#license)
  15. - [FAQ](#faq)
  16. - [Troubleshooting](#troubleshooting)
  17. ## Getting started
  18. 1. [Install the recommended font](#meslo-nerd-font-patched-for-powerlevel10k). *Optional but highly
  19. recommended.*
  20. 1. [Install Powerlevel10k](#installation) itself.
  21. 1. Restart Zsh with `exec zsh`.
  22. 1. Type `p10k configure` if the configuration wizard doesn't start automatically.
  23. ## Features
  24. - [Configuration wizard](#configuration-wizard)
  25. - [Uncompromising performance](#uncompromising-performance)
  26. - [Powerlevel9k compatibility](#powerlevel9k-compatibility)
  27. - [Pure compatibility](#pure-compatibility)
  28. - [Instant prompt](#instant-prompt)
  29. - [Show on command](#show-on-command)
  30. - [Transient prompt](#transient-prompt)
  31. - [Current directory that just works](#current-directory-that-just-works)
  32. - [Extremely customizable](#extremely-customizable)
  33. - [Batteries included](#batteries-included)
  34. - [Extensible](#extensible)
  35. ### Configuration wizard
  36. Type `p10k configure` to access the builtin configuration wizard right from your terminal.
  37. <details>
  38. <summary>Screen recording</summary>
  39. ![Powerlevel10k Configuration Wizard](
  40. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/configuration-wizard.gif)
  41. </details>
  42. All styles except [Pure](#pure-compatibility) are functionally equivalent. They display the same
  43. information and differ only in presentation.
  44. Configuration wizard creates `~/.p10k.zsh` based on your preferences. Additional prompt
  45. customization can be done by editing this file. It has plenty of comments to help you navigate
  46. through configuration options.
  47. *Tip*: Install [the recommended font](#meslo-nerd-font-patched-for-powerlevel10k) before
  48. running `p10k configure` to unlock all prompt styles.
  49. *FAQ:*
  50. - [What is the best prompt style in the configuration wizard?](
  51. #what-is-the-best-prompt-style-in-the-configuration-wizard)
  52. - [What do different symbols in Git status mean?](
  53. #what-do-different-symbols-in-git-status-mean)
  54. - [How do I change prompt colors?](#how-do-i-change-prompt-colors)
  55. *Troubleshooting*:
  56. - [Some prompt styles are missing from the configuration wizard](
  57. #some-prompt-styles-are-missing-from-the-configuration-wizard).
  58. - [Question mark in prompt](#question-mark-in-prompt).
  59. - [Icons, glyphs or powerline symbols don't render](#icons-glyphs-or-powerline-symbols-dont-render).
  60. - [Sub-pixel imperfections around powerline symbols](
  61. #sub-pixel-imperfections-around-powerline-symbols).
  62. - [Directory is difficult to see in prompt when using Rainbow style](
  63. #directory-is-difficult-to-see-in-prompt-when-using-rainbow-style).
  64. ### Uncompromising performance
  65. When you hit *ENTER*, the next prompt appears instantly. With Powerlevel10k there is no prompt lag.
  66. If you install Cygwin on Raspberry Pi, `cd` into a Linux Git repository and activate enough prompt
  67. segments to fill four prompt lines on both sides of the screen... wait, that's just crazy and no
  68. one ever does that. Probably impossible, too. The point is, Powerlevel10k prompt is always fast, no
  69. matter what you do!
  70. <details>
  71. <summary>Screen recording</summary>
  72. ![Powerlevel10k Performance](
  73. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/performance.gif)
  74. </details>
  75. Note how the effect of every command is instantly reflected by the very next prompt.
  76. | Command | Prompt Indicator | Meaning |
  77. |-------------------------------|:----------------:|----------------------------------------------------------------------:|
  78. | `timew start hack linux` | `⌚ hack linux` | time tracking enabled in [timewarrior](https://timewarrior.net/) |
  79. | `touch x y` | `?2` | 2 untracked files in the Git repo |
  80. | `rm COPYING` | `!1` | 1 unstaged change in the Git repo |
  81. | `echo 3.7.3 >.python-version` | `🐍 3.7.3` | the current python version in [pyenv](https://github.com/pyenv/pyenv) |
  82. Other Zsh themes capable of displaying the same information either produce prompt lag or print
  83. prompt that doesn't reflect the current state of the system and then refresh it later. With
  84. Powerlevel10k you get fast prompt *and* up-to-date information.
  85. *FAQ*: [Is it really fast?](#is-it-really-fast)
  86. ### Powerlevel9k compatibility
  87. Powerlevel10k understands all [Powerlevel9k](https://github.com/Powerlevel9k/powerlevel9k)
  88. configuration parameters.
  89. <details>
  90. <summary>Screen recording</summary>
  91. ![Powerlevel10k Compatibility with 9k](
  92. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/9k-compatibility.gif)
  93. </details>
  94. [Migration](#installation) from Powerlevel9k to Powerlevel10k is a straightforward process. All
  95. your `POWERLEVEL9K` configuration parameters will still work. Prompt will look the same as before
  96. ([almost](
  97. #does-powerlevel10k-always-render-exactly-the-same-prompt-as-powerlevel9k-given-the-same-config))
  98. but it will be [much faster](#uncompromising-performance) ([certainly](#is-it-really-fast)).
  99. *FAQ*:
  100. - [I'm using Powerlevel9k with Oh My Zsh. How do I migrate?](
  101. #im-using-powerlevel9k-with-oh-my-zsh-how-do-i-migrate)
  102. - [Does Powerlevel10k always render exactly the same prompt as Powerlevel9k given the same config?](
  103. #does-powerlevel10k-always-render-exactly-the-same-prompt-as-powerlevel9k-given-the-same-config)
  104. - [What is the relationship between Powerlevel9k and Powerlevel10k?](
  105. #What-is-the-relationship-between-powerlevel9k-and-powerlevel10k)
  106. ### Pure compatibility
  107. Powerlevel10k can produce the same prompt as [Pure](https://github.com/sindresorhus/pure). Type
  108. `p10k configure` and select *Pure* style.
  109. <details>
  110. <summary>Screen recording</summary>
  111. ![Powerlevel10k Pure Style](
  112. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/pure-style.gif)
  113. </details>
  114. You can still use Powerlevel10k features such as [transient prompt](#transient-prompt) or
  115. [instant prompt](#instant-prompt) when sporting Pure style.
  116. To customize prompt, edit `~/.p10k.zsh`. Powerlevel10k doesn't recognize Pure configuration
  117. parameters, so you'll need to use `POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3` instead of
  118. `PURE_CMD_MAX_EXEC_TIME=3`, etc. All relevant parameters are in `~/.p10k.zsh`. This file has
  119. plenty of comments to help you navigate through it.
  120. *FAQ:* [What is the best prompt style in the configuration wizard?](
  121. #what-is-the-best-prompt-style-in-the-configuration-wizard)
  122. ### <a name='what-is-instant-prompt'></a>Instant prompt
  123. If your `~/.zshrc` loads many plugins, or perhaps just a few slow ones
  124. (for example, [pyenv](https://github.com/pyenv/pyenv) or [nvm](https://github.com/nvm-sh/nvm)), you
  125. may have noticed that it takes some time for Zsh to start.
  126. <details>
  127. <summary>Screen recording</summary>
  128. ![Powerlevel10k No Instant Prompt](
  129. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/no-instant-prompt.gif)
  130. </details>
  131. Powerlevel10k can remove Zsh startup lag **even if it's not caused by a theme**.
  132. <details>
  133. <summary>Screen recording</summary>
  134. ![Powerlevel10k Instant Prompt](
  135. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/instant-prompt.gif)
  136. </details>
  137. This feature is called *Instant Prompt*. You need to explicitly enable it through `p10k configure`
  138. or [manually](#how-do-i-configure-instant-prompt). It does what it says on the tin -- prints prompt
  139. instantly upon Zsh startup allowing you to start typing while plugins are still loading.
  140. Other themes *increase* Zsh startup lag -- some by a lot, others by a just a little. Powerlevel10k
  141. *removes* it outright.
  142. If you are curious about how *Instant Prompt* works, see
  143. [this section in zsh-bench](https://github.com/romkatv/zsh-bench#instant-prompt).
  144. *FAQ:* [How do I configure instant prompt?](#how-do-i-configure-instant-prompt)
  145. ### Show on command
  146. The behavior of some commands depends on global environment. For example, `kubectl run ...` runs an
  147. image on the cluster defined by the current kubernetes context. If you frequently change context
  148. between "prod" and "testing", you might want to display the current context in Zsh prompt. If you do
  149. likewise for AWS, Azure and Google Cloud credentials, prompt will get pretty crowded.
  150. Enter *Show On Command*. This feature makes prompt segments appear only when they are relevant to
  151. the command you are currently typing.
  152. <details>
  153. <summary>Screen recording</summary>
  154. ![Powerlevel10k Show On Command](
  155. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/show-on-command.gif)
  156. </details>
  157. Configs created by `p10k configure` enable show on command for several prompt segments by default.
  158. Here's the relevant parameter for kubernetes context:
  159. ```zsh
  160. # Show prompt segment "kubecontext" only when the command you are typing
  161. # invokes kubectl, helm, kubens, kubectx, oc, istioctl, kogito, k9s, helmfile, flux, fluxctl or stern.
  162. typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile|flux|fluxctl|stern'
  163. ```
  164. To customize when different prompt segments are shown, open `~/.p10k.zsh`, search for
  165. `SHOW_ON_COMMAND` and either remove these parameters to display affected segments unconditionally,
  166. or change their values.
  167. ### Transient prompt
  168. When *Transient Prompt* is enabled through `p10k configure`, Powerlevel10k will trim down every
  169. prompt when accepting a command line.
  170. <details>
  171. <summary>Screen recording</summary>
  172. ![Powerlevel10k Transient Prompt](
  173. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/transient-prompt.gif)
  174. </details>
  175. Transient prompt makes it much easier to copy-paste series of commands from the terminal scrollback.
  176. *Tip*: If you enable transient prompt, take advantage of two-line prompt. You'll get the benefit of
  177. extra space for typing commands without the usual drawback of reduced scrollback density. Sparse
  178. prompt (with an empty line before prompt) also works great in combination with transient prompt.
  179. ### Current directory that just works
  180. The current working directory is perhaps the most important prompt segment. Powerlevel10k goes to
  181. great length to highlight its important parts and to truncate it with the least loss of information
  182. when horizontal space gets scarce.
  183. <details>
  184. <summary>Screen recording</summary>
  185. ![Powerlevel10k Directory Truncation](
  186. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/directory-truncation.gif)
  187. </details>
  188. When the full directory doesn't fit, the leftmost segment gets truncated to its shortest unique
  189. prefix. In the screencast, `~/work` becomes `~/wo`. It couldn't be truncated to `~/w` because it
  190. would be ambiguous (there was `~/wireguard` when the session was recorded). The next segment --
  191. `projects` -- turns into `p` as there was nothing else that started with `p` in `~/work/`.
  192. Directory segments are shown in one of three colors:
  193. - Truncated segments are bleak.
  194. - Important segments are bright and never truncated. These include the first and the last segment,
  195. roots of Git repositories, etc.
  196. - Regular segments (not truncated but can be) use in-between color.
  197. *Tip*: If you copy-paste a truncated directory and hit *TAB*, it'll complete to the original.
  198. *Troubleshooting*: [Directory is difficult to see in prompt when using Rainbow style.](
  199. #directory-is-difficult-to-see-in-prompt-when-using-rainbow-style)
  200. ### Extremely customizable
  201. Powerlevel10k can be configured to look like any other Zsh theme out there.
  202. <details>
  203. <summary>Screen recording</summary>
  204. ![Powerlevel10k Other Theme Emulation](
  205. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/other-theme-emulation.gif)
  206. </details>
  207. [Pure](#pure-compatibility), [Powerlevel9k](#powerlevel9k-compatibility) and [robbyrussell](
  208. #how-to-make-powerlevel10k-look-like-robbyrussell-oh-my-zsh-theme) emulations are built-in.
  209. To emulate the appearance of other themes, you'll need to write a suitable configuration file. The
  210. best way to go about it is to run `p10k configure`, select the style that is the closest to your
  211. goal and then edit `~/.p10k.zsh`.
  212. The full range of Powerlevel10k appearance spans from spartan:
  213. ![Powerlevel10k Spartan Style](
  214. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/spartan-style.png)
  215. To ~~ridiculous~~ extravagant:
  216. ![Powerlevel10k Extravagant Style](
  217. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/extravagant-style.png)
  218. ### Batteries included
  219. Powerlevel10k comes with dozens of built-in high quality segments. When you run `p10k configure`
  220. and choose any style except [Pure](#pure-compatibility), many of these segments get enabled by
  221. default while others be manually enabled by opening `~/.p10k.zsh` and uncommenting them. You can
  222. enable as many segments as you like. It won't slow down your prompt or Zsh startup.
  223. | Segment | Meaning |
  224. |--------:|---------|
  225. | `anaconda` | virtual environment from [conda](https://conda.io/) |
  226. | `asdf` | tool versions from [asdf](https://github.com/asdf-vm/asdf) |
  227. | `aws` | [aws profile](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) |
  228. | `aws_eb_env` | [aws elastic beanstalk](https://aws.amazon.com/elasticbeanstalk/) environment |
  229. | `azure` | [azure](https://docs.microsoft.com/en-us/cli/azure) account name |
  230. | `background_jobs` | presence of background jobs |
  231. | `battery` | internal battery state and charge level (yep, batteries *literally* included) |
  232. | `command_execution_time` | duration (wall time) of the last command |
  233. | `context` | user@hostname |
  234. | `dir` | current working directory |
  235. | `direnv` | [direnv](https://direnv.net/) status |
  236. | `disk_usage` | disk usage |
  237. | `dotnet_version` | [dotnet](https://dotnet.microsoft.com) version |
  238. | `fvm` | flutter environment from [fvm](https://github.com/leoafarias/fvm) |
  239. | `gcloud` | [google cloud](https://cloud.google.com/) cli account and project |
  240. | `goenv` | go environment from [goenv](https://github.com/syndbg/goenv) |
  241. | `google_app_cred` | [google application credentials](https://cloud.google.com/docs/authentication/production) |
  242. | `go_version` | [go](https://golang.org) version |
  243. | `haskell_stack` | haskell version from [stack](https://haskellstack.org/) |
  244. | `ip` | IP address and bandwidth usage for a specified network interface |
  245. | `java_version` | [java](https://www.java.com/) version |
  246. | `jenv` | java environment from [jenv](https://github.com/jenv/jenv) |
  247. | `kubecontext` | current [kubernetes](https://kubernetes.io/) context |
  248. | `laravel_version` | [laravel php framework](https://laravel.com/) version |
  249. | `load` | CPU load |
  250. | `luaenv` | lua environment from [luaenv](https://github.com/cehoffman/luaenv) |
  251. | `midnight_commander` | [midnight commander](https://midnight-commander.org/) shell |
  252. | `nix_shell` | [nix shell](https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) indicator |
  253. | `nnn` | [nnn](https://github.com/jarun/nnn) shell |
  254. | `nodeenv` | node.js environment from [nodeenv](https://github.com/ekalinin/nodeenv) |
  255. | `nodenv` | node.js environment from [nodenv](https://github.com/nodenv/nodenv) |
  256. | `node_version` | [node.js](https://nodejs.org/) version |
  257. | `nordvpn` | [nordvpn](https://nordvpn.com/) connection status |
  258. | `nvm` | node.js environment from [nvm](https://github.com/nvm-sh/nvm) |
  259. | `os_icon` | your OS logo (apple for macOS, swirl for debian, etc.) |
  260. | `package` | `name@version` from [package.json](https://docs.npmjs.com/files/package.json) |
  261. | `phpenv` | php environment from [phpenv](https://github.com/phpenv/phpenv) |
  262. | `php_version` | [php](https://www.php.net/) version |
  263. | `plenv` | perl environment from [plenv](https://github.com/tokuhirom/plenv) |
  264. | `prompt_char` | multi-functional prompt symbol; changes depending on vi mode: `❯`, `❮`, `V`, `▶` for insert, command, visual and replace mode respectively; turns red on error |
  265. | `proxy` | system-wide http/https/ftp proxy |
  266. | `public_ip` | public IP address |
  267. | `pyenv` | python environment from [pyenv](https://github.com/pyenv/pyenv) |
  268. | `ram` | free RAM |
  269. | `ranger` | [ranger](https://github.com/ranger/ranger) shell |
  270. | `rbenv` | ruby environment from [rbenv](https://github.com/rbenv/rbenv) |
  271. | `rust_version` | [rustc](https://www.rust-lang.org) version |
  272. | `rvm` | ruby environment from [rvm](https://rvm.io) |
  273. | `status` | exit code of the last command |
  274. | `swap` | used swap |
  275. | `taskwarrior` | [taskwarrior](https://taskwarrior.org/) task count |
  276. | `terraform` | [terraform](https://www.terraform.io) workspace |
  277. | `terraform_version` | [terraform](https://www.terraform.io) version |
  278. | `time` | current time |
  279. | `timewarrior` | [timewarrior](https://timewarrior.net/) tracking status |
  280. | `todo` | [todo](https://github.com/todotxt/todo.txt-cli) items |
  281. | `toolbox` | [toolbox](https://github.com/containers/toolbox) name |
  282. | `vcs` | Git repository status |
  283. | `vim_shell` | [vim](https://www.vim.org/) shell (`:sh`) |
  284. | `virtualenv` | python environment from [venv](https://docs.python.org/3/library/venv.html) |
  285. | `vpn_ip` | virtual private network indicator |
  286. | `wifi` | WiFi speed |
  287. | `xplr` | [xplr](https://github.com/sayanarijit/xplr) shell |
  288. ### Extensible
  289. If there is no prompt segment that does what you need, implement your own. Powerlevel10k provides
  290. public API for defining segments that are as fast and as flexible as built-in ones.
  291. <details>
  292. <summary>Screen recording</summary>
  293. ![Powerlevel10k Custom Segment](
  294. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/custom-segment.gif)
  295. </details>
  296. On Linux you can fetch current CPU temperature by reading `/sys/class/thermal/thermal_zone0/temp`.
  297. The screencast shows how to define a prompt segment to display this value. Once the segment is
  298. defined, you can use it like any other segment. All standard customization parameters will work for
  299. it out of the box.
  300. Type `p10k help segment` for reference.
  301. *Tip*: Prefix names of your own segments with `my_` to avoid clashes with future versions of
  302. Powerlevel10k.
  303. ## Installation
  304. - [Manual](#manual) 👈 **choose this if confused or uncertain**
  305. - [Oh My Zsh](#oh-my-zsh)
  306. - [Prezto](#prezto)
  307. - [Zim](#zim)
  308. - [Antibody](#antibody)
  309. - [Antigen](#antigen)
  310. - [Zplug](#zplug)
  311. - [Zgen](#zgen)
  312. - [Zplugin](#zplugin)
  313. - [Zinit](#zinit)
  314. - [Homebrew](#homebrew)
  315. - [Arch Linux](#arch-linux)
  316. ### Manual
  317. ```zsh
  318. git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
  319. echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
  320. ```
  321. Users in mainland China can use the official mirror on gitee.com for faster download.<br>
  322. 中国大陆用户可以使用 gitee.com 上的官方镜像加速下载.
  323. ```zsh
  324. git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ~/powerlevel10k
  325. echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
  326. ```
  327. This is the simplest kind of installation and it works even if you are using a plugin manager. Just
  328. make sure to disable the current theme in your plugin manager. See
  329. [troubleshooting](#cannot-make-powerlevel10k-work-with-my-plugin-manager) for help.
  330. ### Oh My Zsh
  331. 1. Clone the repository:
  332. ```zsh
  333. git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
  334. ```
  335. Users in mainland China can use the official mirror on gitee.com for faster download.<br>
  336. 中国大陆用户可以使用 gitee.com 上的官方镜像加速下载.
  337. ```zsh
  338. git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
  339. ```
  340. 2. Set `ZSH_THEME="powerlevel10k/powerlevel10k"` in `~/.zshrc`.
  341. ### Prezto
  342. Add `zstyle :prezto:module:prompt theme powerlevel10k` to `~/.zpreztorc`.
  343. ### Zim
  344. Add `zmodule romkatv/powerlevel10k --use degit` to `~/.zimrc` and run `zimfw install`.
  345. ### Antibody
  346. Add `antibody bundle romkatv/powerlevel10k` to `~/.zshrc`.
  347. ### Antigen
  348. Add `antigen theme romkatv/powerlevel10k` to `~/.zshrc`. Make sure you have `antigen apply`
  349. somewhere after it.
  350. ### Zplug
  351. Add `zplug romkatv/powerlevel10k, as:theme, depth:1` to `~/.zshrc`.
  352. ### Zgen
  353. Add `zgen load romkatv/powerlevel10k powerlevel10k` to `~/.zshrc`.
  354. ### Zplugin
  355. Add `zplugin ice depth=1; zplugin light romkatv/powerlevel10k` to `~/.zshrc`.
  356. The use of `depth=1` ice is optional. Other types of ice are neither recommended nor officially
  357. supported by Powerlevel10k.
  358. ### Zinit
  359. Add `zinit ice depth=1; zinit light romkatv/powerlevel10k` to `~/.zshrc`.
  360. The use of `depth=1` ice is optional. Other types of ice are neither recommended nor officially
  361. supported by Powerlevel10k.
  362. ### Homebrew
  363. ```zsh
  364. brew install romkatv/powerlevel10k/powerlevel10k
  365. echo "source $(brew --prefix)/opt/powerlevel10k/powerlevel10k.zsh-theme" >>~/.zshrc
  366. ```
  367. ### Arch Linux
  368. ```zsh
  369. yay -S --noconfirm zsh-theme-powerlevel10k-git
  370. echo 'source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
  371. ```
  372. [zsh-theme-powerlevel10k-git](https://aur.archlinux.org/packages/zsh-theme-powerlevel10k-git/)
  373. referenced above is the official Powerlevel10k package.
  374. There is also [zsh-theme-powerlevel10k](
  375. https://www.archlinux.org/packages/community/x86_64/zsh-theme-powerlevel10k/) community package.
  376. Historically, [it has been breaking often and for extended periods of time](
  377. https://github.com/romkatv/powerlevel10k/pull/786). **Do not use it.**
  378. ## Configuration
  379. - [For new users](#for-new-users)
  380. - [For Powerlevel9k users](#for-powerlevel9k-users)
  381. ### For new users
  382. On the first run, Powerlevel10k [configuration wizard](#configuration-wizard) will ask you a few
  383. questions and configure your prompt. If it doesn't trigger automatically, type `p10k configure`.
  384. Configuration wizard creates `~/.p10k.zsh` based on your preferences. Additional prompt
  385. customization can be done by editing this file. It has plenty of comments to help you navigate
  386. through configuration options.
  387. *FAQ*:
  388. - [What is the best prompt style in the configuration wizard?](
  389. #what-is-the-best-prompt-style-in-the-configuration-wizard)
  390. - [What do different symbols in Git status mean?](
  391. #what-do-different-symbols-in-git-status-mean)
  392. - [How do I change the format of Git status?](#how-do-i-change-the-format-of-git-status)
  393. - [How do I add username and/or hostname to prompt?](
  394. #how-do-i-add-username-andor-hostname-to-prompt)
  395. - [How do I change prompt colors?](#how-do-i-change-prompt-colors)
  396. - [Why some prompt segments appear and disappear as I'm typing?](
  397. #why-some-prompt-segments-appear-and-disappear-as-im-typing)
  398. *Troubleshooting*:
  399. - [Question mark in prompt](#question-mark-in-prompt).
  400. - [Icons, glyphs or powerline symbols don't render](#icons-glyphs-or-powerline-symbols-dont-render).
  401. - [Sub-pixel imperfections around powerline symbols](
  402. #sub-pixel-imperfections-around-powerline-symbols).
  403. - [Directory is difficult to see in prompt when using Rainbow style](
  404. #directory-is-difficult-to-see-in-prompt-when-using-rainbow-style).
  405. ### For Powerlevel9k users
  406. If you've been using Powerlevel9k before, **do not remove the configuration options**. Powerlevel10k
  407. will pick them up and provide you with the same prompt UI you are used to. See
  408. [Powerlevel9k compatibility](#powerlevel9k-compatibility).
  409. *FAQ*:
  410. - [I'm using Powerlevel9k with Oh My Zsh. How do I migrate?](
  411. #im-using-powerlevel9k-with-oh-my-zsh-how-do-i-migrate)
  412. - [What is the relationship between Powerlevel9k and Powerlevel10k?](
  413. #what-is-the-relationship-between-powerlevel9k-and-powerlevel10k)
  414. - [Does Powerlevel10k always render exactly the same prompt as Powerlevel9k given the same config?](
  415. #does-powerlevel10k-always-render-exactly-the-same-prompt-as-powerlevel9k-given-the-same-config)
  416. *Troubleshooting*: [Extra or missing spaces in prompt compared to Powerlevel9k](
  417. #extra-or-missing-spaces-in-prompt-compared-to-powerlevel9k).
  418. ## Fonts
  419. Powerlevel10k doesn't require custom fonts but can take advantage of them if they are available.
  420. It works well with [Nerd Fonts](https://github.com/ryanoasis/nerd-fonts),
  421. [Source Code Pro](https://github.com/adobe-fonts/source-code-pro),
  422. [Font Awesome](https://fontawesome.com/), [Powerline](https://github.com/powerline/fonts), and even
  423. the default system fonts. The full choice of style options is available only when using
  424. [Nerd Fonts](https://github.com/ryanoasis/nerd-fonts).
  425. 👇 **Recommended font**: Meslo Nerd Font patched for Powerlevel10k. 👇
  426. ### <a name='recommended-meslo-nerd-font-patched-for-powerlevel10k'></a><a name='font'></a>Meslo Nerd Font patched for Powerlevel10k
  427. Gorgeous monospace font designed by Jim Lyles for Bitstream, customized by the same for Apple,
  428. further customized by André Berg, and finally patched by yours truly with customized scripts
  429. originally developed by Ryan L McIntyre of Nerd Fonts. Contains all glyphs and symbols that
  430. Powerlevel10k may need. Battle-tested in dozens of different terminals on all major operating
  431. systems.
  432. *FAQ*: [How was the recommended font created?](#how-was-the-recommended-font-created)
  433. #### Automatic font installation
  434. If you are using iTerm2 or Termux, `p10k configure` can install the recommended font for you.
  435. Simply answer `Yes` when asked whether to install *Meslo Nerd Font*.
  436. If you are using a different terminal, proceed with manual font installation. 👇
  437. #### Manual font installation
  438. 1. Download these four ttf files:
  439. - [MesloLGS NF Regular.ttf](
  440. https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf)
  441. - [MesloLGS NF Bold.ttf](
  442. https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf)
  443. - [MesloLGS NF Italic.ttf](
  444. https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf)
  445. - [MesloLGS NF Bold Italic.ttf](
  446. https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf)
  447. 1. Double-click on each file and click "Install". This will make `MesloLGS NF` font available to all
  448. applications on your system.
  449. 1. Configure your terminal to use this font:
  450. - **iTerm2**: Type `p10k configure` and answer `Yes` when asked whether to install
  451. *Meslo Nerd Font*. Alternatively, open *iTerm2 → Preferences → Profiles → Text* and set *Font* to
  452. `MesloLGS NF`.
  453. - **Apple Terminal**: Open *Terminal → Preferences → Profiles → Text*, click *Change* under *Font*
  454. and select `MesloLGS NF` family.
  455. - **Hyper**: Open *Hyper → Edit → Preferences* and change the value of `fontFamily` under
  456. `module.exports.config` to `MesloLGS NF`.
  457. - **Visual Studio Code**: Open *File → Preferences → Settings* (PC) or
  458. *Code → Preferences → Settings* (Mac), enter `terminal.integrated.fontFamily` in the search box at
  459. the top of *Settings* tab and set the value below to `MesloLGS NF`.
  460. Consult [this screenshot](
  461. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/389133fb8c9a2347929a23702ce3039aacc46c3d/visual-studio-code-font-settings.jpg)
  462. to see how it should look like or see [this issue](
  463. https://github.com/romkatv/powerlevel10k/issues/671) for extra information.
  464. - **GNOME Terminal** (the default Ubuntu terminal): Open *Terminal → Preferences* and click on the
  465. selected profile under *Profiles*. Check *Custom font* under *Text Appearance* and select
  466. `MesloLGS NF Regular`.
  467. - **Konsole**: Open *Settings → Edit Current Profile → Appearance*, click *Select Font* and select
  468. `MesloLGS NF Regular`.
  469. - **Tilix**: Open *Tilix → Preferences* and click on the selected profile under *Profiles*. Check
  470. *Custom font* under *Text Appearance* and select `MesloLGS NF Regular`.
  471. - **Windows Console Host** (the old thing): Click the icon in the top left corner, then
  472. *Properties → Font* and set *Font* to `MesloLGS NF`.
  473. - **Windows Terminal** by Microsoft (the new thing): Open `settings.json` (<kbd>Ctrl+Shift+,</kbd>),
  474. search for `fontFace` and set the value to `MesloLGS NF` for every profile. If you don't find
  475. `fontFace`, add it under *profiles → defaults*. See [this settings file](
  476. https://raw.githubusercontent.com/romkatv/dotfiles-public/aba0e6c4657d705ed6c344d700d659977385f25c/dotfiles/microsoft-terminal-settings.json)
  477. for example.
  478. - **IntelliJ** (and other IDEs by Jet Brains): Open *IDE → Edit → Preferences → Editor →
  479. Color Scheme → Console Font*. Select *Use console font instead of the default* and set the font
  480. name to `MesloLGS NF`.
  481. - **Termux**: Type `p10k configure` and answer `Yes` when asked whether to install
  482. *Meslo Nerd Font*.
  483. - **Blink**: Type `config`, go to *Appearance*, tap *Add a new font*, tap *Open Gallery*, select
  484. *MesloLGS NF.css*, tap *import* and type `exit` in the home view to reload the font.
  485. - **Terminus**: Open *Settings → Appearance* and set *Font* to `MesloLGS NF`.
  486. - **Terminator**: Open *Preferences* using the context menu. Under *Profiles* select the *General*
  487. tab (should be selected already), uncheck *Use the system fixed width font* (if not already)
  488. and select `MesloLGS NF Regular`. Exit the Preferences dialog by clicking *Close*.
  489. - **Guake**: Right Click on an open terminal and open *Preferences*. Under *Appearance*
  490. tab, uncheck *Use the system fixed width font* (if not already) and select `MesloLGS NF Regular`.
  491. Exit the Preferences dialog by clicking *Close*.
  492. - **MobaXterm**: Open *Settings**Configuration**Terminal* → (under *Terminal look and feel*)
  493. and change *Font* to `MesloLGS NF`.
  494. - **Asbrú Connection Manager**: Open *Preferences → Local Shell Options → Look and Feel*, enable
  495. *Use these personal options* and change *Font:* under *Terminal UI* to `MesloLGS NF Regular`.
  496. To change the font for the remote host connections, go to *Preferences → Terminal Options →
  497. Look and Feel* and change *Font:* under *Terminal UI* to `MesloLGS NF Regular`.
  498. - **WSLtty**: Right click on an open terminal and then on *Options*. In the *Text* section, under
  499. *Font*, click *"Select..."* and set Font to `MesloLGS NF Regular`.
  500. - **Yakuake**: Click *≡**Manage Profiles**New**Appearance*. Click *Choose* next to the
  501. *Font* dropdown, select `MesloLGS NF` and click *OK*. Click *OK* to save the profile. Select the
  502. new profile and click *Set as Default*.
  503. - **Alacritty**: Create or open `~/.config/alacritty/alacritty.yml` and add the following section
  504. to it:
  505. ```yaml
  506. font:
  507. normal:
  508. family: "MesloLGS NF"
  509. ```
  510. - **kitty**: Create or open `~/.config/kitty/kitty.conf` and add the following line to it:
  511. ```text
  512. font_family MesloLGS NF
  513. ```
  514. Restart kitty by closing all sessions and opening a new session.
  515. - **puTTY**: Set *Window**Appearance**Font* to `MesloLGS NF`. Requires puTTY
  516. version >= 0.75.
  517. - **WezTerm**: Create or open `$HOME/.config/wezterm/wezterm.lua` and add the following:
  518. ```lua
  519. local wezterm = require 'wezterm';
  520. return {
  521. font = wezterm.font("MesloLGS NF"),
  522. }
  523. ```
  524. If the file already exists, only add the line with the font to the existing return.
  525. Also add the first line if it is not already present.
  526. - **urxvt**: Create or open `~/.Xresources` and add the following line to it:
  527. ```text
  528. URxvt.font: xft:MesloLGS NF:size=11
  529. ```
  530. You can adjust the font size to your preference. After changing the config run
  531. `xrdb ~/.Xresources` to reload it. The new config is applied to all new terminals.
  532. - **xterm**: Create or open `~/.Xresources` and add the following line to it:
  533. ```text
  534. xterm*faceName: MesloLGS NF
  535. ```
  536. After changing the config run `xrdb ~/.Xresources` to reload it. The new config is applied to
  537. all new terminals.
  538. 1. Run `p10k configure` to generate a new `~/.p10k.zsh`. The old config may work
  539. incorrectly with the new font.
  540. _Using a different terminal and know how to set the font for it? Share your knowledge by sending a
  541. PR to expand the list!_
  542. ## Try it in Docker
  543. Try Powerlevel10k in Docker. You can safely make any changes to the file system while trying out
  544. the theme. Once you exit Zsh, the image is deleted.
  545. ```zsh
  546. docker run -e TERM -e COLORTERM -e LC_ALL=C.UTF-8 -it --rm alpine sh -uec '
  547. apk add git zsh nano vim
  548. git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
  549. echo "source ~/powerlevel10k/powerlevel10k.zsh-theme" >>~/.zshrc
  550. cd ~/powerlevel10k
  551. exec zsh'
  552. ```
  553. *Tip*: Install [the recommended font](#meslo-nerd-font-patched-for-powerlevel10k) before
  554. running the Docker command to get access to all prompt styles.
  555. *Tip*: Run `p10k configure` while in Docker to try a different prompt style.
  556. ## License
  557. Powerlevel10k is released under the
  558. [MIT license](https://github.com/romkatv/powerlevel10k/blob/master/LICENSE).
  559. ## FAQ
  560. - [How do I update Powerlevel10k?](#how-do-i-update-powerlevel10k)
  561. - [How do I uninstall Powerlevel10k?](#how-do-i-uninstall-powerlevel10k)
  562. - [How do I install Powerlevel10k on a machine without Internet access?](#how-do-i-install-powerlevel10k-on-a-machine-without-internet-access)
  563. - [Where can I ask for help and report bugs?](#where-can-i-ask-for-help-and-report-bugs)
  564. - [Which aspects of shell and terminal does Powerlevel10k affect?](#which-aspects-of-shell-and-terminal-does-powerlevel10k-affect)
  565. - [I'm using Powerlevel9k with Oh My Zsh. How do I migrate?](#im-using-powerlevel9k-with-oh-my-zsh-how-do-i-migrate)
  566. - [Is it really fast?](#is-it-really-fast)
  567. - [How do I configure instant prompt?](#how-do-i-configure-instant-prompt)
  568. - [How do I initialize direnv when using instant prompt?](#how-do-i-initialize-direnv-when-using-instant-prompt)
  569. - [How do I export GPG_TTY when using instant prompt?](#how-do-i-export-gpg_tty-when-using-instant-prompt)
  570. - [What do different symbols in Git status mean?](#what-do-different-symbols-in-git-status-mean)
  571. - [How do I change the format of Git status?](#how-do-i-change-the-format-of-git-status)
  572. - [Why is Git status from `$HOME/.git` not displayed in prompt?](#why-is-git-status-from-homegit-not-displayed-in-prompt)
  573. - [Why does Git status sometimes appear grey and then gets colored after a short period of time?](#why-does-git-status-sometimes-appear-grey-and-then-gets-colored-after-a-short-period-of-time)
  574. - [How do I add username and/or hostname to prompt?](#how-do-i-add-username-andor-hostname-to-prompt)
  575. - [Why some prompt segments appear and disappear as I'm typing?](#why-some-prompt-segments-appear-and-disappear-as-im-typing)
  576. - [How do I change prompt colors?](#how-do-i-change-prompt-colors)
  577. - [Why does Powerlevel10k spawn extra processes?](#why-does-powerlevel10k-spawn-extra-processes)
  578. - [Are there configuration options that make Powerlevel10k slow?](#are-there-configuration-options-that-make-powerlevel10k-slow)
  579. - [Is Powerlevel10k fast to load?](#is-powerlevel10k-fast-to-load)
  580. - [What is the relationship between Powerlevel9k and Powerlevel10k?](#what-is-the-relationship-between-powerlevel9k-and-powerlevel10k)
  581. - [Does Powerlevel10k always render exactly the same prompt as Powerlevel9k given the same config?](#does-powerlevel10k-always-render-exactly-the-same-prompt-as-powerlevel9k-given-the-same-config)
  582. - [What is the best prompt style in the configuration wizard?](#what-is-the-best-prompt-style-in-the-configuration-wizard)
  583. - [How to make Powerlevel10k look like robbyrussell Oh My Zsh theme?](#how-to-make-powerlevel10k-look-like-robbyrussell-oh-my-zsh-theme)
  584. - [Can prompts for completed commands display error status for *those* commands instead of the commands preceding them?](#can-prompts-for-completed-commands-display-error-status-for-those-commands-instead-of-the-commands-preceding-them)
  585. - [What is the minimum supported Zsh version?](#what-is-the-minimum-supported-zsh-version)
  586. - [How were these screenshots and animated gifs created?](#how-were-these-screenshots-and-animated-gifs-created)
  587. - [How was the recommended font created?](#how-was-the-recommended-font-created)
  588. - [How to package Powerlevel10k for distribution?](#how-to-package-powerlevel10k-for-distribution)
  589. ### How do I update Powerlevel10k?
  590. The command to update Powerlevel10k depends on how it was installed.
  591. | Installation | Update command |
  592. |---------------------------|-------------------------------------------------------------|
  593. | [Manual](#manual) | `git -C ~/powerlevel10k pull` |
  594. | [Oh My Zsh](#oh-my-zsh) | `git -C ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k pull` |
  595. | [Prezto](#prezto) | `zprezto-update` |
  596. | [Zim](#zim) | `zimfw update` |
  597. | [Antigen](#antigen) | `antigen update` |
  598. | [Zplug](#zplug) | `zplug update` |
  599. | [Zgen](#zgen) | `zgen update` |
  600. | [Zplugin](#zplugin) | `zplugin update` |
  601. | [Zinit](#zinit) | `zinit update` |
  602. | [Homebrew](#homebrew) | `brew update && brew upgrade` |
  603. | [Arch Linux](#arch-linux) | `yay -S --noconfirm zsh-theme-powerlevel10k-git` |
  604. **IMPORTANT**: Restart Zsh after updating Powerlevel10k. [Do not use `source ~/.zshrc`](
  605. #weird-things-happen-after-typing-source-zshrc).
  606. ### How do I uninstall Powerlevel10k?
  607. 1. Remove all references to "p10k" from `~/.zshrc`. You might have this snippet at the top:
  608. ```zsh
  609. if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  610. source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
  611. fi
  612. ```
  613. And this at the bottom:
  614. ```zsh
  615. [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
  616. ```
  617. These are added by the [configuration wizard](#configuration-wizard). Remove them.
  618. 2. Remove all references to "powerlevel10k" from `~/.zshrc`, `~/.zpreztorc` and `~/.zimrc` (some
  619. of these files may be missing -- this is normal). These references have been added manually by
  620. yourself when installing Powerlevel10k. Refer to the [installation instructions](#installation)
  621. if you need a reminder.
  622. 3. Verify that all references to "p10k" and "powerlevel10k" are gone from `~/.zshrc`, `~/.zpreztorc`
  623. and `~/.zimrc`.
  624. ```zsh
  625. grep -E 'p10k|powerlevel10k' ~/.zshrc ~/.zpreztorc ~/.zimrc 2>/dev/null
  626. ```
  627. If this command produces output, there are still references to "p10k" or "powerlevel10k". You
  628. need to remove them.
  629. 4. Delete Powerlevel10k configuration file. This file is created by the
  630. [configuration wizard](#configuration-wizard) and may contain manual edits by yourself.
  631. ```zsh
  632. rm -f ~/.p10k.zsh
  633. ```
  634. 5. Delete Powerlevel10k source files. These files have been downloaded when you've installed
  635. Powerlevel10k. The command to delete them depends on which installation method you'd chosen.
  636. Refer to the [installation instructions](#installation) if you need a reminder.
  637. | Installation | Uninstall command |
  638. |---------------------------|------------------------------------------------------------------|
  639. | [Manual](#manual) | `rm -rf ~/powerlevel10k` |
  640. | [Oh My Zsh](#oh-my-zsh) | `rm -rf -- ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k` |
  641. | [Prezto](#prezto) | n/a |
  642. | [Zim](#zim) | `zimfw uninstall` |
  643. | [Antigen](#antigen) | `antigen purge romkatv/powerlevel10k` |
  644. | [Zplug](#zplug) | `zplug clean` |
  645. | [Zgen](#zgen) | `zgen reset` |
  646. | [Zplugin](#zplugin) | `zplugin delete romkatv/powerlevel10k` |
  647. | [Zinit](#zinit) | `zinit delete romkatv/powerlevel10k` |
  648. | [Homebrew](#homebrew) | `brew uninstall powerlevel10k; brew untap romkatv/powerlevel10k` |
  649. | [Arch Linux](#arch-linux) | `yay -R --noconfirm zsh-theme-powerlevel10k-git` |
  650. 6. Restart Zsh. [Do not use `source ~/.zshrc`](#weird-things-happen-after-typing-source-zshrc).
  651. 7. Delete Powerlevel10k cache files.
  652. ```zsh
  653. rm -rf -- "${XDG_CACHE_HOME:-$HOME/.cache}"/p10k-*(N) "${XDG_CACHE_HOME:-$HOME/.cache}"/gitstatus
  654. ```
  655. ### How do I install Powerlevel10k on a machine without Internet access?
  656. 1. Run this command on the machine without Internet access:
  657. ```sh
  658. uname -sm | tr '[A-Z]' '[a-z]'
  659. ```
  660. 2. Run these commands on a machine connected to the Internet after replacing the value of
  661. `target_uname` with the output of the previous command:
  662. ```sh
  663. target_uname="replace this with the output of the previous command"
  664. git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
  665. GITSTATUS_CACHE_DIR="$HOME"/powerlevel10k/gitstatus/usrbin ~/powerlevel10k/gitstatus/install -f -s "${target_uname% *}" -m "${target_uname#* }"
  666. ```
  667. 3. Copy `~/powerlevel10k` from the machine connected to the Internet to the one without Internet
  668. access.
  669. 4. Add `source ~/powerlevel10k/powerlevel10k.zsh-theme` to `~/.zshrc` on the machine without
  670. Internet access:
  671. ```zsh
  672. echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
  673. ```
  674. 5. If `~/.zshrc` on the machine without Internet access sets `ZSH_THEME`, remove that line.
  675. ```zsh
  676. sed -i.bak '/^ZSH_THEME=/d' ~/.zshrc
  677. ```
  678. To update, remove `~/powerlevel10k` on both machines and repeat steps 1-3.
  679. ### Where can I ask for help and report bugs?
  680. The best way to ask for help and to report bugs is to [open an issue](
  681. https://github.com/romkatv/powerlevel10k/issues).
  682. [Gitter](
  683. https://gitter.im/powerlevel10k/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
  684. is another option.
  685. If all else fails, email [email protected].
  686. If necessary, encrypt your communication with [this PGP key](
  687. https://api.github.com/users/romkatv/gpg_keys).
  688. ### Which aspects of shell and terminal does Powerlevel10k affect?
  689. Powerlevel10k defines prompt and nothing else. It sets [prompt-related options](
  690. http://zsh.sourceforge.net/Doc/Release/Options.html#Prompting), and parameters `PS1` and `RPS1`.
  691. ![Prompt Highlight](
  692. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/prompt-highlight.png)
  693. Everything within the highlighted areas on the screenshot is produced by Powerlevel10k.
  694. Powerlevel10k has no control over the terminal content or colors outside these areas.
  695. Powerlevel10k does not affect:
  696. - Terminal window/tab title.
  697. - Colors used by `ls`.
  698. - The behavior of `git` command.
  699. - The content and style of <kbd>Tab</kbd> completions.
  700. - Command line colors (syntax highlighting, autosuggestions, etc.).
  701. - Key bindings.
  702. - Aliases.
  703. - Prompt parameters other than `PS1` and `RPS1`.
  704. - Zsh options other than those [related to prompt](
  705. http://zsh.sourceforge.net/Doc/Release/Options.html#Prompting).
  706. ### I'm using Powerlevel9k with Oh My Zsh. How do I migrate?
  707. 1. Run this command:
  708. ```zsh
  709. # Add powerlevel10k to the list of Oh My Zsh themes.
  710. git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
  711. # Replace ZSH_THEME="powerlevel9k/powerlevel9k" with ZSH_THEME="powerlevel10k/powerlevel10k".
  712. sed -i.bak 's/powerlevel9k/powerlevel10k/g' ~/.zshrc
  713. # Restart Zsh.
  714. exec zsh
  715. ```
  716. 2. *Optional but highly recommended:*
  717. 1. Install [the recommended font](#meslo-nerd-font-patched-for-powerlevel10k).
  718. 1. Type `p10k configure` and choose your favorite prompt style.
  719. *Related:*
  720. - [Powerlevel9k compatibility.](#powerlevel9k-compatibility)
  721. - [Does Powerlevel10k always render exactly the same prompt as Powerlevel9k given the same config?](
  722. #does-powerlevel10k-always-render-exactly-the-same-prompt-as-powerlevel9k-given-the-same-config)
  723. - [Extra or missing spaces in prompt compared to Powerlevel9k.](
  724. #extra-or-missing-spaces-in-prompt-compared-to-powerlevel9k)
  725. - [Configuration wizard.](#configuration-wizard)
  726. ### Is it really fast?
  727. Yes. See [zsh-bench](https://github.com/romkatv/zsh-bench) or a direct comparison with
  728. [Powerlevel9k](https://asciinema.org/a/NHRjK3BMePw66jtRVY2livHwZ) and
  729. [Spaceship](https://asciinema.org/a/253094).
  730. ### <a name='how-do-i-enable-instant-prompt'></a>How do I configure instant prompt?
  731. See [instant prompt](#instant-prompt) to learn about instant prompt. This section explains how you
  732. can enable and configure it and lists caveats that you should be aware of.
  733. Instant prompt can be enabled either through `p10k configure` or by manually adding the following
  734. code snippet at the top of `~/.zshrc`:
  735. ```zsh
  736. # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
  737. # Initialization code that may require console input (password prompts, [y/n]
  738. # confirmations, etc.) must go above this block; everything else may go below.
  739. if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  740. source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
  741. fi
  742. ```
  743. It's important that you copy the lines verbatim. Don't replace `source` with something else, don't
  744. call `zcompile`, don't redirect output, etc.
  745. When instant prompt is enabled, for the duration of Zsh initialization standard input is redirected
  746. to `/dev/null` and standard output with standard error are redirected to a temporary file. Once Zsh
  747. is fully initialized, standard file descriptors are restored and the content of the temporary file
  748. is printed out.
  749. When using instant prompt, you should carefully check any output that appears on Zsh startup as it
  750. may indicate that initialization has been altered, or perhaps even broken, by instant prompt.
  751. Initialization code that may require console input, such as asking for a keyring password or for a
  752. *[y/n]* confirmation, must be moved above the instant prompt preamble in `~/.zshrc`. Initialization
  753. code that merely prints to console but never reads from it will work correctly with instant prompt,
  754. although output that normally has colors may appear uncolored. You can either leave it be, suppress
  755. the output, or move it above the instant prompt preamble.
  756. Here's an example of `~/.zshrc` that breaks when instant prompt is enabled:
  757. ```zsh
  758. if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  759. source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
  760. fi
  761. keychain id_rsa --agents ssh # asks for password
  762. chatty-script # spams to stdout even when everything is fine
  763. # ...
  764. ```
  765. Fixed version:
  766. ```zsh
  767. keychain id_rsa --agents ssh # moved before instant prompt
  768. # OK to perform console I/O before this point.
  769. if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  770. source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
  771. fi
  772. # From this point on, until zsh is fully initialized, console input won't work and
  773. # console output may appear uncolored.
  774. chatty-script >/dev/null # spam output suppressed
  775. # ...
  776. ```
  777. If `POWERLEVEL9K_INSTANT_PROMPT` is unset or set to `verbose`, Powerlevel10k will print a warning
  778. when it detects console output during initialization to bring attention to potential issues. You can
  779. silence this warning (without suppressing console output) with `POWERLEVEL9K_INSTANT_PROMPT=quiet`.
  780. This is recommended if some initialization code in `~/.zshrc` prints to console and it's infeasible
  781. to move it above the instant prompt preamble or to suppress its output. You can completely disable
  782. instant prompt with `POWERLEVEL9K_INSTANT_PROMPT=off`. Do this if instant prompt breaks Zsh
  783. initialization and you don't know how to fix it.
  784. The value of `POWERLEVEL9K_INSTANT_PROMPT` can be changed by running `p10k configure` and selecting
  785. the appropriate option on the *Instant Prompt* screen. Alternatively, you can search for
  786. `POWERLEVEL9K_INSTANT_PROMPT` in the existing `~/.p10k.zsh` and change its value there.
  787. *Note*: Instant prompt requires Zsh >= 5.4. It's OK to enable it even when using an older version of
  788. Zsh but it won't do anything.
  789. *FAQ*:
  790. - [How do I initialize direnv when using instant prompt?](
  791. #how-do-i-initialize-direnv-when-using-instant-prompt)
  792. - [How do I export GPG_TTY when using instant prompt?](
  793. #how-do-i-export-gpg_tty-when-using-instant-prompt)
  794. ### How do I initialize direnv when using instant prompt?
  795. If you've enabled [instant prompt](#instant-prompt), you should have these lines at the top of
  796. `~/.zshrc`:
  797. ```zsh
  798. if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  799. source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
  800. fi
  801. ```
  802. To initialize direnv you need to add one line above that block and one line below it.
  803. ```zsh
  804. (( ${+commands[direnv]} )) && emulate zsh -c "$(direnv export zsh)"
  805. if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  806. source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
  807. fi
  808. (( ${+commands[direnv]} )) && emulate zsh -c "$(direnv hook zsh)"
  809. ```
  810. *Related*: [How do I export GPG_TTY when using instant prompt?](
  811. #how-do-i-export-gpg_tty-when-using-instant-prompt)
  812. ### How do I export GPG_TTY when using instant prompt?
  813. You can export `GPG_TTY` like this anywhere in `~/.zshrc`:
  814. ```zsh
  815. export GPG_TTY=$TTY
  816. ```
  817. This works whether you are using [instant prompt](#instant-prompt) or not. It works even if you
  818. aren't using powerlevel10k. As an extra bonus, it's much faster than the commonly used
  819. `export GPG_TTY=$(tty)`.
  820. *Related*: [How do I initialize direnv when using instant prompt?](
  821. #how-do-i-initialize-direnv-when-using-instant-prompt)
  822. ### What do different symbols in Git status mean?
  823. When using Lean, Classic or Rainbow style, Git status may look like this:
  824. ```text
  825. feature:master wip ⇣42⇡42 ⇠42⇢42 *42 merge ~42 +42 !42 ?42
  826. ```
  827. | Symbol | Meaning | Source |
  828. | --------- | -------------------------------------------------------------------- | ------------------------------------------------------ |
  829. | `feature` | current branch; replaced with `#tag` or `@commit` if not on a branch | `git status --ignore-submodules=dirty` |
  830. | `master` | remote tracking branch; only shown if different from local branch | `git rev-parse --abbrev-ref --symbolic-full-name @{upstream}` |
  831. | `wip` | the latest commit's summary contains "wip" or "WIP" | `git show --pretty=%s --no-patch HEAD` |
  832. | `⇣42` | this many commits behind the remote | `git rev-list --right-only --count HEAD...@{upstream}` |
  833. | `⇡42` | this many commits ahead of the remote | `git rev-list --left-only --count HEAD...@{upstream}` |
  834. | `⇠42` | this many commits behind the push remote | `git rev-list --right-only --count HEAD...@{push}` |
  835. | `⇢42` | this many commits ahead of the push remote | `git rev-list --left-only --count HEAD...@{push}` |
  836. | `*42` | this many stashes | `git stash list` |
  837. | `merge` | repository state | `git status --ignore-submodules=dirty` |
  838. | `~42` | this many merge conflicts | `git status --ignore-submodules=dirty` |
  839. | `+42` | this many staged changes | `git status --ignore-submodules=dirty` |
  840. | `!42` | this many unstaged changes | `git status --ignore-submodules=dirty` |
  841. | `?42` | this many untracked files | `git status --ignore-submodules=dirty` |
  842. | `─` | the number of staged, unstaged or untracked files is unknown | `echo $POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY` or `git config --get bash.showDirtyState` |
  843. *Related*: [How do I change the format of Git status?](#how-do-i-change-the-format-of-git-status)
  844. ### How do I change the format of Git status?
  845. To change the format of Git status, open `~/.p10k.zsh`, search for `my_git_formatter` and edit its
  846. source code.
  847. *Related*: [What do different symbols in Git status mean?](
  848. #what-do-different-symbols-in-git-status-mean)
  849. ### Why is Git status from `$HOME/.git` not displayed in prompt?
  850. When using Lean, Classic or Rainbow style, `~/.p10k.zsh` contains the following parameter:
  851. ```zsh
  852. # Don't show Git status in prompt for repositories whose workdir matches this pattern.
  853. # For example, if set to '~', the Git repository at $HOME/.git will be ignored.
  854. # Multiple patterns can be combined with '|': '~(|/foo)|/bar/baz/*'.
  855. typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~'
  856. ```
  857. To see Git status for `$HOME/.git` in prompt, open `~/.p10k.zsh` and remove
  858. `POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN`.
  859. ### Why does Git status sometimes appear grey and then gets colored after a short period of time?
  860. tl;dr: When Git status in prompt is greyed out, it means Powerlevel10k is currently computing
  861. up-to-date Git status in the background. Prompt will get automatically refreshed when this
  862. computation completes.
  863. When your current directory is within a Git repository, Powerlevel10k computes up-to-date Git
  864. status after every command. If the repository is large, or the machine is slow, this computation
  865. can take quite a bit of time. If it takes longer than 10 milliseconds (configurable via
  866. `POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS`), Powerlevel10k displays the last known Git status in
  867. grey and continues to compute up-to-date Git status in the background. When the computation
  868. completes, Powerlevel10k refreshes prompt with new information, this time with colored Git status.
  869. When using *Rainbow* style, Git status is displayed as black on grey while it's still being
  870. computed. Depending on the terminal color palette, this may be difficult to read. In this case you
  871. might want to change the background color to something ligher for more contrast. To do that, open
  872. `~/.p10k.zsh`, search for `POWERLEVEL9K_VCS_LOADING_BACKGROUND`, uncomment it if it's commented out,
  873. and change the value.
  874. ```zsh
  875. typeset -g POWERLEVEL9K_VCS_LOADING_BACKGROUND=244
  876. ```
  877. Type `source ~/.p10k.zsh` to apply your changes to the current Zsh session.
  878. *Related*: [How do I change prompt colors?](#how-do-i-change-prompt-colors)
  879. ### How do I add username and/or hostname to prompt?
  880. When using Lean, Classic or Rainbow style, prompt shows `username@hostname` when you are logged in
  881. as root or via SSH. There is little value in showing `username` or `hostname` when you are logged in
  882. to your local machine as a normal user. So the absence of `username@hostname` in your prompt is an
  883. indication that you are working locally and that you aren't root. You can change it, however.
  884. Open `~/.p10k.zsh`. Close to the top you can see the most important parameters that define which
  885. segments are shown in your prompt. All generally useful prompt segments are listed in there. Some of
  886. them are enabled, others are commented out. One of them is of interest to you.
  887. ```zsh
  888. typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
  889. ...
  890. context # user@hostname
  891. ...
  892. )
  893. ```
  894. Search for `context` to find the section in the config that lists parameters specific to this prompt
  895. segment. You should see the following lines:
  896. ```zsh
  897. # Don't show context unless running with privileges or in SSH.
  898. # Tip: Remove the next line to always show context.
  899. typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION=
  900. ```
  901. If you follow the tip and remove (or comment out) the last line, you'll always see
  902. `username@hostname` in prompt. You can change the format to just `username`, or change the color, by
  903. adjusting the values of parameters nearby. There are plenty of comments to help you navigate.
  904. You can also move `context` to a different position in `POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS` or even
  905. to `POWERLEVEL9K_LEFT_PROMPT_ELEMENTS`.
  906. ### Why some prompt segments appear and disappear as I'm typing?
  907. Prompt segments can be configured to be shown only when the current command you are typing invokes
  908. a relevant tool.
  909. ```zsh
  910. # Show prompt segment "kubecontext" only when the command you are typing
  911. # invokes kubectl, helm, kubens, kubectx, oc, istioctl, kogito, k9s, helmfile, flux, fluxctl or stern.
  912. typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile|flux|fluxctl|stern'
  913. ```
  914. Configs created by `p10k configure` may contain parameters of this kind. To customize when different
  915. prompt segments are shown, open `~/.p10k.zsh`, search for `SHOW_ON_COMMAND` and either remove these
  916. parameters or change their values.
  917. You can also define a function in `~/.zshrc` to toggle the display of a prompt segment between
  918. *always* and *on command*. This is similar to `kubeon`/`kubeoff` from
  919. [kube-ps1](https://github.com/jonmosco/kube-ps1).
  920. ```zsh
  921. function kube-toggle() {
  922. if (( ${+POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND} )); then
  923. unset POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND
  924. else
  925. POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile|flux|fluxctl|stern'
  926. fi
  927. p10k reload
  928. if zle; then
  929. zle push-input
  930. zle accept-line
  931. fi
  932. }
  933. ```
  934. Invoke this function by typing `kube-toggle`. You can also bind it to a key by adding two more lines
  935. to `~/.zshrc`:
  936. ```zsh
  937. zle -N kube-toggle
  938. bindkey '^]' kube-toggle # ctrl-] to toggle kubecontext in powerlevel10k prompt
  939. ```
  940. ### How do I change prompt colors?
  941. You can either [change the color palette used by your terminal](
  942. #change-the-color-palette-used-by-your-terminal) or
  943. [set colors through Powerlevel10k configuration parameters](
  944. #set-colors-through-Powerlevel10k-configuration-parameters).
  945. #### Change the color palette used by your terminal
  946. How exactly you change the terminal color palette (a.k.a. color scheme, or theme) depends on the
  947. kind of terminal you are using. Look around in terminal's settings/preferences or consult
  948. documentation.
  949. When you change the terminal color palette, it usually affects only the first 16 colors, numbered
  950. from 0 to 15. In order to see any effect on Powerlevel10k prompt, you need to use prompt style that
  951. utilizes these low-numbered colors. Type `p10k configure` and select *Rainbow*, *Lean**8 colors*
  952. or *Pure**Original*. Other styles use higher-numbered colors, so they look the same in any
  953. terminal color palette.
  954. #### Set colors through Powerlevel10k configuration parameters
  955. Open `~/.p10k.zsh`, search for "color", "foreground" and "background" and change values of
  956. appropriate parameters. For example, here's how you can set the foreground of `time` prompt segment
  957. to bright red:
  958. ```zsh
  959. typeset -g POWERLEVEL9K_TIME_FOREGROUND=160
  960. ```
  961. Colors are specified using numbers from 0 to 255. Colors from 0 to 15 look differently in different
  962. terminals. Many terminals also support customization of these colors through color palettes
  963. (a.k.a. color schemes, or themes). Colors from 16 to 255 always look the same.
  964. Type `source ~/.p10k.zsh` to apply your changes to the current Zsh session.
  965. To see how different colors look in your terminal, run the following command:
  966. ```zsh
  967. for i in {0..255}; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done
  968. ```
  969. *Related:*
  970. - [Directory is difficult to see in prompt when using Rainbow style.](
  971. #directory-is-difficult-to-see-in-prompt-when-using-rainbow-style)
  972. ### Why does Powerlevel10k spawn extra processes?
  973. Powerlevel10k uses [gitstatus](https://github.com/romkatv/gitstatus) as the backend behind `vcs`
  974. prompt; gitstatus spawns `gitstatusd` and `zsh`. See
  975. [gitstatus](https://github.com/romkatv/gitstatus) for details. Powerlevel10k may also spawn `zsh`
  976. to perform computation without blocking prompt. To avoid security hazard, these background processes
  977. aren't shared by different interactive shells. They terminate automatically when the parent `zsh`
  978. process terminates or runs `exec(3)`.
  979. ### Are there configuration options that make Powerlevel10k slow?
  980. No, Powerlevel10k is always fast, with any configuration you throw at it. If you have noticeable
  981. prompt latency when using Powerlevel10k, please
  982. [open an issue](https://github.com/romkatv/powerlevel10k/issues).
  983. ### Is Powerlevel10k fast to load?
  984. Yes. See [zsh-bench](https://github.com/romkatv/zsh-bench).
  985. ### What is the relationship between Powerlevel9k and Powerlevel10k?
  986. Powerlevel10k was forked from Powerlevel9k in March 2019 after a week-long discussion in
  987. [powerlevel9k#1170](https://github.com/Powerlevel9k/powerlevel9k/issues/1170). Powerlevel9k was
  988. already a mature project with a large user base and a release cycle measured in months. Powerlevel10k
  989. was spun off to iterate on performance improvements and new features at much higher pace.
  990. Powerlevel9k and Powerlevel10k are independent projects. When using one, you shouldn't install the
  991. other. Issues should be filed against the project that you actually use. There are no individuals
  992. that have commit rights in both repositories. All bug fixes and new features committed to
  993. Powerlevel9k repository get ported to Powerlevel10k.
  994. Over time, virtually all code in Powerlevel10k has been rewritten. There is currently no meaningful
  995. overlap between the implementations of Powerlevel9k and Powerlevel10k.
  996. Powerlevel10k is committed to maintaining backward compatibility with all configs indefinitely. This
  997. commitment covers all configuration parameters recognized by Powerlevel9k (see
  998. [Powerlevel9k compatibility](#powerlevel9k-compatibility)) and additional parameters that only
  999. Powerlevel10k understands. Names of all parameters in Powerlevel10k start with `POWERLEVEL9K_` for
  1000. consistency.
  1001. ### Does Powerlevel10k always render exactly the same prompt as Powerlevel9k given the same config?
  1002. Almost. There are a few differences.
  1003. - By default only `git` vcs backend is enabled in Powerlevel10k. If you need `svn` and `hg`, add
  1004. them to `POWERLEVEL9K_VCS_BACKENDS`. These backends aren't yet optimized in Powerlevel10k, so
  1005. enabling them will make prompt *very slow*.
  1006. - Powerlevel10k doesn't support `POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY=true`.
  1007. - Powerlevel10k strives to be bug-compatible with Powerlevel9k but not when it comes to egregious
  1008. bugs. If you accidentally rely on these bugs, your prompt will differ between Powerlevel9k and
  1009. Powerlevel10k. Some examples:
  1010. - Powerlevel9k ignores some options that are set after the theme is sourced while Powerlevel10k
  1011. respects all options. If you see different icons in Powerlevel9k and Powerlevel10k, you've
  1012. probably defined `POWERLEVEL9K_MODE` before sourcing the theme. This parameter gets ignored
  1013. by Powerlevel9k but honored by Powerlevel10k. If you want your prompt to look in Powerlevel10k
  1014. the same as in Powerlevel9k, remove `POWERLEVEL9K_MODE`.
  1015. - Powerlevel9k doesn't respect `ZLE_RPROMPT_INDENT`. As a result, right prompt in Powerlevel10k
  1016. can have an extra space at the end compared to Powerlevel9k. Set `ZLE_RPROMPT_INDENT=0` if you
  1017. don't want that space. More details in
  1018. [troubleshooting](#extra-space-without-background-on-the-right-side-of-right-prompt).
  1019. - Powerlevel9k has inconsistent spacing around icons. This was fixed in Powerlevel10k. Set
  1020. `POWERLEVEL9K_LEGACY_ICON_SPACING=true` to get the same spacing as in Powerlevel9k. More
  1021. details in [troubleshooting](#extra-or-missing-spaces-around-icons).
  1022. - There are dozens more bugs in Powerlevel9k that don't exist in Powerlevel10k.
  1023. If you notice any other changes in prompt appearance when switching from Powerlevel9k to
  1024. Powerlevel10k, please [open an issue](https://github.com/romkatv/powerlevel10k/issues).
  1025. ### What is the best prompt style in the configuration wizard?
  1026. There are as many opinions on what constitutes the best prompt as there are people. It mostly comes
  1027. down to personal preference. There are, however, a few hidden implications of different choices.
  1028. Pure style is an exact replication of [Pure Zsh theme](https://github.com/sindresorhus/pure). It
  1029. exists to ease the migration for users of this theme. Unless you are one of them, choose Lean
  1030. style over Pure.
  1031. If you want to confine prompt colors to the selected terminal color palette (say, *Solarized Dark*),
  1032. use *Rainbow*, *Lean**8 colors* or *Pure**Original*. Other styles use fixed colors and thus
  1033. look the same in any terminal color palette.
  1034. All styles except Pure have an option to use *ASCII* charset. Prompt will look less pretty but will
  1035. render correctly with all fonts and in all locales.
  1036. If you enable transient prompt, take advantage of two-line prompt. You'll get the benefit of
  1037. extra space for typing commands without the usual drawback of reduced scrollback density. Having
  1038. all commands start from the same offset is also nice.
  1039. Similarly, if you enable transient prompt, sparse prompt (with an empty line before prompt) is a
  1040. great choice.
  1041. If you are using vi keymap, choose prompt with `prompt_char` in it (shown as green `❯` in the
  1042. wizard). This symbol changes depending on vi mode: `❯`, `❮`, `V`, `▶` for insert, command, visual
  1043. and replace mode respectively. When a command fails, the symbol turns red. *Lean* style always has
  1044. `prompt_char` in it. *Rainbow* and *Classic* styles have it only in the two-line configuration
  1045. without left frame.
  1046. If you value horizontal space or prefer minimalist aesthetics:
  1047. - Use a monospace font, such as [the recommended font](#meslo-nerd-font-patched-for-powerlevel10k).
  1048. Non-monospace fonts require extra space after icons that are larger than a single column.
  1049. - Use Lean style. Compared to Classic and Rainbow, it saves two characters per prompt segment.
  1050. - Disable *current time* and *frame*.
  1051. - Use *few icons*. The extra icons enabled by the *many icons* option primarily serve decorative
  1052. function. Informative icons, such as background job indicator, will be shown either way.
  1053. *Note*: You can run configuration wizard as many times as you like. Type `p10k configure` to try new
  1054. prompt style.
  1055. ### How to make Powerlevel10k look like robbyrussell Oh My Zsh theme?
  1056. Use [this config](
  1057. https://github.com/romkatv/powerlevel10k/blob/master/config/p10k-robbyrussell.zsh).
  1058. You can either download it, save as `~/.p10k.zsh` and `source ~/.p10k.zsh` from `~/.zshrc`, or
  1059. source `p10k-robbyrussell.zsh` directly from your cloned `powerlevel10k` repository.
  1060. ### Can prompts for completed commands display error status for *those* commands instead of the commands preceding them?
  1061. No. When you hit *ENTER* and the command you've typed starts running, its error status isn't yet
  1062. known, so it cannot be shown in prompt. When the command completes, the error status gets known but
  1063. it's no longer possible to update prompt for *that* command. This is why the error status for every
  1064. command is reflected in the *next* prompt.
  1065. For details, see [this post on /r/zsh](
  1066. https://www.reddit.com/r/zsh/comments/eg49ff/powerlevel10k_prompt_history_exit_code_colors/fc5huku).
  1067. ### What is the minimum supported Zsh version?
  1068. Zsh 5.3 or newer should work. Fast startup requires Zsh >= 5.4.
  1069. ### How were these screenshots and animated gifs created?
  1070. All screenshots and animated gifs were recorded in GNOME Terminal with
  1071. [the recommended font](#meslo-nerd-font-patched-for-powerlevel10k) and Tango Dark color palette with
  1072. custom background color (`#171A1B` instead of `#2E3436` -- twice as dark).
  1073. ![GNOME Terminal Color Settings](
  1074. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/gnome-terminal-colors.png)
  1075. Syntax highlighting, where present, was provided by [zsh-syntax-highlighting](
  1076. https://github.com/zsh-users/zsh-syntax-highlighting).
  1077. ### How was the recommended font created?
  1078. [The recommended font](#meslo-nerd-font-patched-for-powerlevel10k) is the product of many
  1079. individuals. Its origin is *Bitstream Vera Sans Mono*, which has given birth to *Menlo*, which in
  1080. turn has spawned *Meslo*. Finally, extra glyphs have been added to *Meslo* with scripts forked
  1081. from Nerd Fonts. The final font is released under the terms of
  1082. [Apache License](
  1083. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/MesloLGS%20NF%20License.txt).
  1084. MesloLGS NF font can be recreated with the following command (requires `git` and `docker`):
  1085. ```zsh
  1086. git clone --depth=1 https://github.com/romkatv/nerd-fonts.git
  1087. cd nerd-fonts
  1088. ./build 'Meslo/S/*'
  1089. ```
  1090. If everything goes well, four `ttf` files will appear in `./out`.
  1091. ### How to package Powerlevel10k for distribution?
  1092. It's currently neither easy nor recommended to package and distribute Powerlevel10k. There are no
  1093. instructions you can follow that would allow you to easily update your package when new versions of
  1094. Powerlevel10k are released. This may change in the future but not soon.
  1095. ## Troubleshooting
  1096. - [Question mark in prompt](#question-mark-in-prompt)
  1097. - [Icons, glyphs or powerline symbols don't render](#icons-glyphs-or-powerline-symbols-dont-render)
  1098. - [Sub-pixel imperfections around powerline symbols](#sub-pixel-imperfections-around-powerline-symbols)
  1099. - [Error: character not in range](#error-character-not-in-range)
  1100. - [Cursor is in the wrong place](#cursor-is-in-the-wrong-place)
  1101. - [Prompt wrapping around in a weird way](#prompt-wrapping-around-in-a-weird-way)
  1102. - [Right prompt is in the wrong place](#right-prompt-is-in-the-wrong-place)
  1103. - [Configuration wizard runs automatically every time Zsh is started](#configuration-wizard-runs-automatically-every-time-zsh-is-started)
  1104. - [Some prompt styles are missing from the configuration wizard](#some-prompt-styles-are-missing-from-the-configuration-wizard)
  1105. - [Cannot install the recommended font](#cannot-install-the-recommended-font)
  1106. - [Extra or missing spaces in prompt compared to Powerlevel9k](#extra-or-missing-spaces-in-prompt-compared-to-powerlevel9k)
  1107. - [Extra space without background on the right side of right prompt](#extra-space-without-background-on-the-right-side-of-right-prompt)
  1108. - [Extra or missing spaces around icons](#extra-or-missing-spaces-around-icons)
  1109. - [Weird things happen after typing `source ~/.zshrc`](#weird-things-happen-after-typing-source-zshrc)
  1110. - [Transient prompt stops working after some time](#transient-prompt-stops-working-after-some-time)
  1111. - [Cannot make Powerlevel10k work with my plugin manager](#cannot-make-powerlevel10k-work-with-my-plugin-manager)
  1112. - [Directory is difficult to see in prompt when using Rainbow style](#directory-is-difficult-to-see-in-prompt-when-using-rainbow-style)
  1113. - [Horrific mess when resizing terminal window](#horrific-mess-when-resizing-terminal-window)
  1114. - [Icons cut off in Konsole](#icons-cut-off-in-konsole)
  1115. - [Arch Linux logo has a dot in the bottom right corner](#arch-linux-logo-has-a-dot-in-the-bottom-right-corner)
  1116. ### Question mark in prompt
  1117. If it looks like a regular `?`, that's normal. It means you have untracked files in the current Git
  1118. repository. Type `git status` to see these files. You can change this symbol or disable the display
  1119. of untracked files altogether. Search for `untracked files` in `~/.p10k.zsh`.
  1120. *FAQ*: [What do different symbols in Git status mean?](
  1121. #what-do-different-symbols-in-git-status-mean)
  1122. You can also get a weird-looking question mark in your prompt if your terminal's font is missing
  1123. some glyphs. See [icons, glyphs or powerline symbols don't render](
  1124. #icons-glyphs-or-powerline-symbols-dont-render).
  1125. ### Icons, glyphs or powerline symbols don't render
  1126. Restart your terminal, [install the recommended font](#meslo-nerd-font-patched-for-powerlevel10k)
  1127. and run `p10k configure`.
  1128. ### Sub-pixel imperfections around powerline symbols
  1129. ![Powerline Prompt Imperfections](
  1130. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/powerline-imperfections.png)
  1131. There are three imperfections on the screenshot. From left to right:
  1132. 1. A thin blue line (a sub-pixel gap) between the content of a prompt segment and the following
  1133. powerline connection.
  1134. 1. Incorrect alignment of a powerline connection and the following prompt segment. The connection
  1135. appears shifted to the right.
  1136. 1. A thin red line below a powerline connection. The connection appears shifted up.
  1137. Zsh themes don't have down-to-pixel control over the terminal content. Everything you see on the
  1138. screen is made of monospace characters. A white powerline prompt segment is made of text on white
  1139. background followed by U+E0B0 (a right-pointing triangle).
  1140. ![Powerline Prompt Imperfections](
  1141. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/powerline-anatomy.png)
  1142. If Powerlevel10k prompt has imperfections around powerline symbols, you'll see exactly the same
  1143. imperfections with all powerline themes (Agnoster, Powerlevel9k, Powerline, etc.)
  1144. There are several things you can try to deal with these imperfections:
  1145. - Try [the recommended font](#meslo-nerd-font-patched-for-powerlevel10k). If you are already using
  1146. it, switching to another font may help but is unlikely.
  1147. - Change terminal font size one point up or down. For example, in iTerm2 powerline prompt looks
  1148. perfect at font sizes 11 and 13 but breaks down at 12.
  1149. - Enable builtin powerline glyphs in terminal settings if your terminal supports it (iTerm2 does).
  1150. - Change font hinting and/or anti-aliasing mode in the terminal settings.
  1151. - Shift all text one pixel up/down/left/right if your terminal has an option to do so.
  1152. - Try a different terminal.
  1153. A more radical solution is to switch to prompt style without background. Type `p10k configure` and
  1154. select *Lean*. This style has a modern lightweight look. As a bonus, it doesn't suffer from
  1155. rendering imperfections that afflict powerline-style prompt.
  1156. ### Error: character not in range
  1157. Type `echo '\u276F'`. If you get an error saying "zsh: character not in range", your locale
  1158. doesn't support UTF-8. You need to fix it. If you are running Zsh over SSH, see
  1159. [this](https://github.com/romkatv/powerlevel10k/issues/153#issuecomment-518347833). If you are
  1160. running Zsh locally, Google "set UTF-8 locale in *your OS*".
  1161. ### Cursor is in the wrong place
  1162. Type `echo '\u276F'`. If you get an error saying "zsh: character not in range", see the
  1163. [previous section](#zsh-character-not-in-range).
  1164. If the `echo` command prints `❯` but the cursor is still in the wrong place, install
  1165. [the recommended font](#meslo-nerd-font-patched-for-powerlevel10k) and run
  1166. `p10k configure`.
  1167. If this doesn't help, add `unset ZLE_RPROMPT_INDENT` at the bottom of `~/.zshrc`.
  1168. Still having issues? Run the following command to diagnose the problem:
  1169. ```zsh
  1170. () {
  1171. emulate -L zsh
  1172. setopt err_return no_unset
  1173. local text
  1174. print -rl -- 'Select a part of your prompt from the terminal window and paste it below.' ''
  1175. read -r '?Prompt: ' text
  1176. local -i len=${(m)#text}
  1177. local frame="+-${(pl.$len..-.):-}-+"
  1178. print -lr -- $frame "| $text |" $frame
  1179. }
  1180. ```
  1181. #### If the prompt line aligns with the frame
  1182. ```text
  1183. +------------------------------+
  1184. | romka@adam ✓ ~/powerlevel10k |
  1185. +------------------------------+
  1186. ```
  1187. If the output of the command is aligned for every part of your prompt (left and right), this
  1188. indicates a bug in the theme or your config. Use this command to diagnose it:
  1189. ```zsh
  1190. print -rl -- ${(eq+)PROMPT} ${(eq+)RPROMPT}
  1191. ```
  1192. Look for `%{...%}` and backslash escapes in the output. If there are any, they are the likely
  1193. culprits. Open an issue if you get stuck.
  1194. #### If the prompt line is longer than the frame
  1195. ```text
  1196. +-----------------------------+
  1197. | romka@adam ✓ ~/powerlevel10k |
  1198. +-----------------------------+
  1199. ```
  1200. This is usually caused by a terminal bug or misconfiguration that makes it print ambiguous-width
  1201. characters as double-width instead of single width. For example,
  1202. [this issue](https://github.com/romkatv/powerlevel10k/issues/165).
  1203. #### If the prompt line is shorter than the frame and is mangled
  1204. ```text
  1205. +------------------------------+
  1206. | romka@adam ✓~/powerlevel10k |
  1207. +------------------------------+
  1208. ```
  1209. Note that this prompt is different from the original as it's missing a space after the check mark.
  1210. This can be caused by a low-level bug in macOS. See
  1211. [this issue](https://github.com/romkatv/powerlevel10k/issues/241).
  1212. This can also happen if prompt contains glyphs designated as "wide" in the Unicode standard and your
  1213. terminal incorrectly displays them as non-wide. Terminals suffering from this limitation include
  1214. Konsole, Hyper and the integrated VSCode Terminal. The solution is to use a different terminal or
  1215. remove all wide glyphs from prompt.
  1216. #### If the prompt line is shorter than the frame and is not mangled
  1217. ```text
  1218. +--------------------------------+
  1219. | romka@adam ✓ ~/powerlevel10k |
  1220. +--------------------------------+
  1221. ```
  1222. This can be caused by misconfigured locale. See
  1223. [this issue](https://github.com/romkatv/powerlevel10k/issues/251).
  1224. ### Prompt wrapping around in a weird way
  1225. See [cursor is in the wrong place](#cursor-is-in-the-wrong-place).
  1226. ### Right prompt is in the wrong place
  1227. See [cursor is in the wrong place](#cursor-is-in-the-wrong-place).
  1228. ### Configuration wizard runs automatically every time Zsh is started
  1229. When Powerlevel10k starts, it automatically runs `p10k configure` if no `POWERLEVEL9K_*`
  1230. parameters are defined. Based on your prompt style choices, the configuration wizard creates
  1231. `~/.p10k.zsh` with a bunch of `POWERLEVEL9K_*` parameters in it and adds a line to `~/.zshrc` to
  1232. source this file. The next time you start Zsh, the configuration wizard shouldn't run automatically.
  1233. If it does, this means the evaluation of `~/.zshrc` terminates prematurely before it reaches the
  1234. line that sources `~/.p10k.zsh`. This most often happens due to syntax errors in `~/.zshrc`. These
  1235. errors get hidden by the configuration wizard screen, so you don't notice them. When you exit
  1236. configuration wizard, look for error messages. You can also use
  1237. `POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true zsh` to start Zsh without automatically running the
  1238. configuration wizard. Once you can see the errors, fix `~/.zshrc` to get rid of them.
  1239. ### Some prompt styles are missing from the configuration wizard
  1240. If Zsh version is below 5.7.1 or `COLORTERM` environment variable is neither `24bit` nor
  1241. `truecolor`, configuration wizard won't offer Pure style with Snazzy color scheme. *Fix*: Install
  1242. Zsh >= 5.7.1 and use a terminal with truecolor support. Verify with `print -P '%F{#ff0000}red%f'`.
  1243. If the terminal can display fewer than 256 colors, configuration wizard preselects Lean style with
  1244. 8 colors. All other styles require at least 256 colors. *Fix*: Use a terminal with 256 color support
  1245. and make sure that `TERM` environment variable is set correctly. Verify with
  1246. `print $terminfo[colors]`.
  1247. If there is no UTF-8 locale on the system, configuration wizard won't offer prompt styles that use
  1248. Unicode characters. *Fix*: Install a UTF-8 locale. Verify with `locale -a`.
  1249. When a UTF-8 locale is available, the first few questions asked by the configuration wizard assess
  1250. capabilities of the terminal font. If your answers indicate that some glyphs don't render correctly,
  1251. configuration wizard won't offer prompt styles that use them. *Fix*: Restart your terminal and
  1252. install [the recommended font](#meslo-nerd-font-patched-for-powerlevel10k). Verify by running
  1253. `p10k configure` and checking that all glyphs render correctly.
  1254. ### Cannot install the recommended font
  1255. Once you download [the recommended font](#meslo-nerd-font-patched-for-powerlevel10k),
  1256. you can install it just like any other font. Google "how to install fonts on *your OS*".
  1257. ### Extra or missing spaces in prompt compared to Powerlevel9k
  1258. tl;dr: Add `ZLE_RPROMPT_INDENT=0` and `POWERLEVEL9K_LEGACY_ICON_SPACING=true` to `~/.zshrc` to get
  1259. the same prompt spacing as in Powerlevel9k.
  1260. When using Powerlevel10k with a Powerlevel9k config, you might get additional spaces in prompt here
  1261. and there. These come in two flavors.
  1262. #### Extra space without background on the right side of right prompt
  1263. tl;dr: Add `ZLE_RPROMPT_INDENT=0` to `~/.zshrc` to get rid of that space.
  1264. From [Zsh documentation](
  1265. http://zsh.sourceforge.net/Doc/Release/Parameters.html#index-ZLE_005fRPROMPT_005fINDENT):
  1266. > `ZLE_RPROMPT_INDENT <S>`
  1267. >
  1268. > If set, used to give the indentation between the right hand side of the right prompt in the line
  1269. > editor as given by `RPS1` or `RPROMPT` and the right hand side of the screen. If not set, the
  1270. > value `1` is used.
  1271. >
  1272. > Typically this will be used to set the value to `0` so that the prompt appears flush with the
  1273. > right hand side of the screen.
  1274. Powerlevel10k respects this parameter. If you set `ZLE_RPROMPT_INDENT=1` (or leave it unset, which
  1275. is the same thing as setting it to `1`), you'll get an empty space to the right of right prompt. If
  1276. you set `ZLE_RPROMPT_INDENT=0`, your prompt will go to the edge of the terminal. This is how it
  1277. works in every theme except Powerlevel9k.
  1278. ![ZLE_RPROMPT_INDENT: Powerlevel10k vs Powerlevel9k](
  1279. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/p9k-vs-p10k-zle-rprompt-indent.png)
  1280. Powerlevel9k issue: [powerlevel9k#1292](https://github.com/Powerlevel9k/powerlevel9k/issues/1292).
  1281. It's been fixed in the development branch of Powerlevel9k but the fix hasn't yet made it to
  1282. `master`.
  1283. Add `ZLE_RPROMPT_INDENT=0` to `~/.zshrc` to get the same spacing on the right edge of prompt as in
  1284. Powerlevel9k.
  1285. *Note:* Several versions of Zsh have bugs that get triggered when you set `ZLE_RPROMPT_INDENT=0`.
  1286. Powerlevel10k can work around these bugs when using powerline prompt style. If you notice visual
  1287. artifacts in prompt, or wrong cursor position, try removing `ZLE_RPROMPT_INDENT` from `~/.zshrc`.
  1288. #### Extra or missing spaces around icons
  1289. tl;dr: Add `POWERLEVEL9K_LEGACY_ICON_SPACING=true` to `~/.zshrc` to get the same spacing around
  1290. icons as in Powerlevel9k.
  1291. Spacing around icons in Powerlevel9k is inconsistent.
  1292. ![ZLE_RPROMPT_INDENT: Powerlevel10k vs Powerlevel9k](
  1293. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/p9k-vs-p10k-icon-spacing.png)
  1294. This inconsistency is a constant source of annoyance, so it was fixed in Powerlevel10k. You can add
  1295. `POWERLEVEL9K_LEGACY_ICON_SPACING=true` to `~/.zshrc` to get the same spacing around icons as in
  1296. Powerlevel9k.
  1297. *Note:* It's not a good idea to define `POWERLEVEL9K_LEGACY_ICON_SPACING` when using
  1298. `p10k configure`.
  1299. ### Weird things happen after typing `source ~/.zshrc`
  1300. It's almost always a bad idea to run `source ~/.zshrc`, whether you are using Powerlevel10k or not.
  1301. This command may result in random errors, misbehaving code and progressive slowdown of Zsh.
  1302. If you've made changes to `~/.zshrc` or to files sourced by it, restart Zsh to apply them. The most
  1303. reliable way to do this is to type `exit` and then start a new Zsh session. You can also use
  1304. `exec zsh`. While not exactly equivalent to complete Zsh restart, this command is much more reliable
  1305. than `source ~/.zshrc`.
  1306. ### Transient prompt stops working after some time
  1307. See [weird things happen after typing `source ~/.zshrc`](
  1308. #weird-things-happen-after-typing-source-zshrc).
  1309. ### Cannot make Powerlevel10k work with my plugin manager
  1310. If the [installation instructions](#installation) didn't work for you, try disabling your current
  1311. theme (so that you end up with no theme) and then installing Powerlevel10k manually.
  1312. 1. Disable the current theme in your framework / plugin manager.
  1313. - **oh-my-zsh:** Open `~/.zshrc` and remove the line that sets `ZSH_THEME`. It might look like this:
  1314. `ZSH_THEME="powerlevel9k/powerlevel9k"`.
  1315. - **zplug:** Open `~/.zshrc` and remove the `zplug` command that refers to your current theme. For
  1316. example, if you are currently using Powerlevel9k, look for
  1317. `zplug bhilburn/powerlevel9k, use:powerlevel9k.zsh-theme`.
  1318. - **prezto:** Open `~/.zpreztorc` and put `zstyle :prezto:module:prompt theme off` in it. Remove
  1319. any other command that sets `theme` such as `zstyle :prezto:module:prompt theme powerlevel9k`.
  1320. - **antigen:** Open `~/.zshrc` and remove the line that sets `antigen theme`. It might look like
  1321. this: `antigen theme powerlevel9k/powerlevel9k`.
  1322. 2. Install Powerlevel10k manually.
  1323. ```zsh
  1324. git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
  1325. echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
  1326. ```
  1327. This method of installation won't make anything slower or otherwise sub-par.
  1328. ### Directory is difficult to see in prompt when using Rainbow style
  1329. In Rainbow style the current working directory is shown with bright white text on blue background.
  1330. The white is fixed and always looks the same but the appearance of "blue" is defined by your
  1331. terminal color palette. If it's very light, it may be difficult to see white text on it.
  1332. There are several ways to fix this.
  1333. - Type `p10k configure` and choose a more readable prompt style.
  1334. - [Change terminal color palette](#change-the-color-palette-used-by-your-terminal). Try Tango Dark
  1335. or Solarized Dark, or change just the "blue" color.
  1336. - [Change directory background and/or foreground color](#set-colors-through-Powerlevel10k-configuration-parameters).
  1337. The parameters you are looking for are called `POWERLEVEL9K_DIR_BACKGROUND`,
  1338. `POWERLEVEL9K_DIR_FOREGROUND`, `POWERLEVEL9K_DIR_SHORTENED_FOREGROUND`,
  1339. `POWERLEVEL9K_DIR_ANCHOR_FOREGROUND` and `POWERLEVEL9K_DIR_ANCHOR_BOLD`. You can find them in
  1340. `~/.p10k.zsh`.
  1341. ### Horrific mess when resizing terminal window
  1342. When you resize a terminal window horizontally back and forth a few times, you might see this ugly
  1343. picture.
  1344. ![Powerlevel10k Resizing Mess](
  1345. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/resizing-mess.png)
  1346. tl;dr: This issue arises when a terminal reflows Zsh prompt upon resizing. It isn't specific to
  1347. Powerlevel10k. See [mitigation](#mitigation).
  1348. *Note: This section [used to say](
  1349. https://github.com/romkatv/powerlevel10k/blob/dce00cdb5daaa8a519df234a7012ba3257b644d4/README.md#horrific-mess-when-resizing-terminal-window)
  1350. that the problem is caused by a bug in Zsh. While it's true that it's possible to avoid the problem
  1351. in many circumstances by modifying Zsh, it cannot be completely resolved this way. Thus it's unfair
  1352. to pin the blame on Zsh.*
  1353. #### The anatomy of the problem
  1354. The issue is manifested when the vertical distance between the start of the current prompt and the
  1355. cursor (henceforth `VD`) changes when the terminal window is resized.
  1356. When a terminal window gets shrunk horizontally, there are two ways for a terminal to handle long
  1357. lines that no longer fit: *reflow* or *truncate*.
  1358. Terminal content before shrinking:
  1359. ![Terminal Content Before Shrinking](
  1360. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/resize-original.png)
  1361. Terminal reflows text when shrinking:
  1362. ![Terminal Reflows Text When Shrinking](
  1363. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/resize-reflow.png)
  1364. Terminal truncates text when shrinking:
  1365. ![Terminal Truncates Text When Shrinking](
  1366. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/resize-truncate.png)
  1367. Reflowing strategy can change the height of terminal content. If such content happens to be between
  1368. the start of the current prompt and the cursor, Zsh will print prompt on the wrong line. Truncation
  1369. strategy never changes the height of terminal content, so it doesn't trigger this issue.
  1370. Let's see how the issue plays out in slow motion. We'll start by launching `zsh -f` and pasting
  1371. the following code:
  1372. ```zsh
  1373. function pause() { read -s }
  1374. functions -M pause 0
  1375. reset
  1376. print -l {1..3}
  1377. setopt prompt_subst
  1378. PROMPT=$'${$((pause()))+}left>${(pl.$((COLUMNS-12))..-.)}<right\n> '
  1379. ```
  1380. When `PROMPT` gets expanded, it calls `pause` to let us observe the state of the terminal. Here's
  1381. the initial state:
  1382. ![Terminal Resizing Bug 1](
  1383. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/resize-bug-1.png)
  1384. Zsh keeps track of the cursor position relative to the start of the current prompt. In this case it
  1385. knows that the cursor is one line below. When we shrink the terminal window, it looks like this:
  1386. ![Terminal Resizing Bug 2](
  1387. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/resize-bug-2.png)
  1388. At this point the terminal sends `SIGWINCH` to Zsh to notify it about changes in the terminal
  1389. dimensions. Note that this signal is sent *after* the content of the terminal has been reflown.
  1390. When Zsh receives `SIGWINCH`, it attempts to erase the current prompt and print it anew. It goes to
  1391. the position where it *thinks* the current prompt is -- one line above the cursor (!) -- erases all
  1392. terminal content that follows and prints reexpanded prompt there. However, after resizing prompt is
  1393. no longer one line above the cursor. It's two lines above! Zsh ends up printing new prompt one line
  1394. too low.
  1395. ![Terminal Resizing Bug 3](
  1396. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/resize-bug-3.png)
  1397. In this case we ended up with unwanted junk content because `VD` has *increased*. When you make
  1398. terminal window wider, `VD` can also *decrease*, which would result in the new prompt being printed
  1399. higher than intended, potentially erasing useful content in the process.
  1400. Here are a few more examples where shrinking terminal window increased `VD`.
  1401. - Simple one-line left prompt with right prompt. No `prompt_subst`. Note that the cursor is below
  1402. the prompt line (hit *ESC-ENTER* to get it there).
  1403. ![Zsh Prompt That Breaks on Terminal Shrinking 1](
  1404. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/resize-breakable-1.png)
  1405. - Simple one-line left prompt. No `prompt_subst`, no right prompt. Here `VD` is bound to increase
  1406. upon terminal shrinking due to the command line wrapping around.
  1407. ![Zsh Prompt That Breaks on Terminal Shrinking 2](
  1408. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/resize-breakable-2.png)
  1409. #### Zsh patch
  1410. [This Zsh patch](https://github.com/romkatv/zsh/tree/fix-winchanged) fixes the issue on some
  1411. terminals. The idea behind the patch is to use `sc` (save cursor) terminal capability before
  1412. printing prompt and `rc` (restore cursor) to move cursor back to the original position when prompt
  1413. needs to be refreshed.
  1414. The patch works only on terminals that reflow saved cursor position together with text when the
  1415. terminal window is resized. The patch has no observable effect on terminals that don't reflow text
  1416. on resize (both patched and unpatched Zsh behave correctly) and on terminals that reflow text but
  1417. not the saved cursor position (both patched and unpatched Zsh redraw prompt at the same incorrect
  1418. position). In other words, the patch fixes the resizing issue on some terminals while keeping the
  1419. behavior unchanged on others.
  1420. There are two alternative approaches to patching Zsh that may seem to work at first glance but in
  1421. fact don't:
  1422. - Instead of `sc`, use `u7` terminal capability to query the current cursor position and then `cup`
  1423. to go back to it. This doesn't work because the absolute position of the start of the current
  1424. prompt changes when text gets reflown.
  1425. - Recompute `VD` based on new terminal dimensions before attempting to refresh prompt. This doesn't
  1426. work because Zsh doesn't know whether terminal reflows text or truncates it. If Zsh could somehow
  1427. know that the terminal reflows text, this approach still wouldn't work on terminals that
  1428. continuously reflow text and rapid-fire `SIGWINCH` when the window is being resized. In such
  1429. environment real terminal dimensions go out of sync with what Zsh thinks the dimensions are.
  1430. There is no ETA for the patch making its way into upstream Zsh. See [discussion](
  1431. https://www.zsh.org/mla/workers//2019/msg00561.html).
  1432. #### Mitigation
  1433. There are a few mitigation options for this issue.
  1434. - Use [kitty](https://sw.kovidgoyal.net/kitty/) terminal version >= 0.24.0 and enable terminal-shell
  1435. integration in Powerlevel10k by defining `POWERLEVEL9K_TERM_SHELL_INTEGRATION=true` in
  1436. `~/.p10k.zsh`.
  1437. - Apply [the patch](#zsh-patch) and [rebuild Zsh from source](
  1438. https://github.com/zsh-users/zsh/blob/master/INSTALL). It won't help if you are using Alacritty,
  1439. kitty or some other terminal that reflows text on resize but doesn't reflow saved cursor position.
  1440. On such terminals the patch will have no visible effect.
  1441. - Disable text reflowing on window resize in terminal settings. If your terminal doesn't have this
  1442. setting, try a different terminal.
  1443. - Avoid long lines between the start of prompt and cursor.
  1444. 1. Disable ruler with `POWERLEVEL9K_SHOW_RULER=false`.
  1445. 2. Disable prompt connection with `POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' '`.
  1446. 3. Disable right frame with `POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX=''`,
  1447. `POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX=''` and
  1448. `POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX=''`.
  1449. 4. Set `POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()`. Right prompt on the last prompt line will cause
  1450. resizing issues only when the cursor is below it. This isn't very common, so you might want to
  1451. keep some elements in `POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS` provided that none of them are
  1452. succeeded by `newline`.
  1453. ### Icons cut off in Konsole
  1454. When using Konsole with a non-monospace font, icons may be cut off on the right side. Here
  1455. "non-monospace" refers to any font with glyphs wider than a single column, or wider than two columns
  1456. for glyphs designated as "wide" in the Unicode standard.
  1457. ![Icons cut off in Konsole](
  1458. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/konsole-non-monospace-font.png)
  1459. The last line on the screenshot shows a cut off Arch Linux logo.
  1460. There are several mitigation options for this issue.
  1461. 1. Use a different terminal. Konsole is the only terminal that exhibits this behavior.
  1462. 2. Use a monospace font.
  1463. 3. Manually add an extra space after the icon that gets cut off. For example, if the content of
  1464. `os_icon` prompt segment gets cut off, open `~/.p10k.zsh`, search for
  1465. `POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION` and change it as follows:
  1466. ```zsh
  1467. typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='${P9K_CONTENT} ' # extra space at the end
  1468. ```
  1469. 4. Use a different icon that is monospace. For example, if Arch Linux logo gets cut off, add
  1470. the following parameter to `~/.p10k.zsh`:
  1471. ```zsh
  1472. typeset -g POWERLEVEL9K_LINUX_ARCH_ICON='Arch' # plain "Arch" in place of a logo
  1473. ```
  1474. 5. Disable the display of the icon that gets cut off. For example, if the content of
  1475. `os_icon` prompt segment gets cut off, open `~/.p10k.zsh` and remove `os_icon` from
  1476. `POWERLEVEL9K_LEFT_PROMPT_ELEMENTS` and `POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS`.
  1477. *Note*: [Non-monospace fonts are not officially supported by Konsole](
  1478. https://bugs.kde.org/show_bug.cgi?id=418553#c5).
  1479. ### Arch Linux logo has a dot in the bottom right corner
  1480. ![Arch Linux Logo with a dot](
  1481. https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/arch-linux-logo-dot.png)
  1482. Some fonts have this incorrect dotted icon in bold typeface. There are two ways to fix this issue.
  1483. 1. Use a font with a correct Arch Linux logo in bold typeface. For example,
  1484. [the recommended Powerlevel10k font](#meslo-nerd-font-patched-for-powerlevel10k).
  1485. 2. Display the icon in regular (non-bold) typeface. To do this, open `~/.p10k.zsh`, search for
  1486. `POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION` and remove `%B` from its value.
  1487. ```zsh
  1488. typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='${P9K_CONTENT}' # not bold
  1489. ```