On the first run, Powerlevel10k configuration wizard will ask you a few
+questions and configure your prompt. If it doesn't trigger automatically, type p10k configure.
+Configuration wizard creates ~/.p10k.zsh based on your preferences. Additional prompt
+customization can be done by editing this file. It has plenty of comments to help you navigate
+through configuration options.
If you've been using Powerlevel9k before, do not remove the configuration options. Powerlevel10k
+will pick them up and provide you with the same prompt UI you are used to. See
+Powerlevel9k compatibility.
Remove all references to "powerlevel10k" from ~/.zshrc, ~/.zpreztorc and ~/.zimrc (some
+of these files may be missing -- this is normal). These references have been added manually by
+yourself when installing Powerlevel10k. Refer to the installation instructions
+if you need a reminder.
+Verify that all references to "p10k" and "powerlevel10k" are gone from ~/.zshrc, ~/.zpreztorc
+and ~/.zimrc.
If this command produces output, there are still references to "p10k" or "powerlevel10k". You
+need to remove them.
+
Delete Powerlevel10k configuration file. This file is created by the
+configuration wizard and may contain manual edits by yourself.
+
rm -f ~/.p10k.zsh
+
+
+
Delete Powerlevel10k source files. These files have been downloaded when you've installed
+Powerlevel10k. The command to delete them depends on which installation method you'd chosen.
+Refer to the installation instructions if you need a reminder.
How do I install Powerlevel10k on a machine without Internet access?
+
Run this command on the machine without Internet access:
+
uname -sm | tr '[A-Z]' '[a-z]'
+
+
+
Run these commands on a machine connected to the Internet after replacing the value of target_uname with the output of the previous command:
+
target_uname="replace this with the output of the previous command"
+git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
+GITSTATUS_CACHE_DIR="$HOME"/powerlevel10k/gitstatus/usrbin ~/powerlevel10k/gitstatus/install -f -s "${target_uname% *}" -m "${target_uname#* }"
+
+
+
Copy ~/powerlevel10k from the machine connected to the Internet to the one without Internet access.
+Add source ~/powerlevel10k/powerlevel10k.zsh-theme to ~/.zshrc on the machine without Internet access:
If all else fails, email roman.perepelitsa@gmail.com.
+
If necessary, encrypt your communication with this PGP key.
+
Which aspects of shell and terminal does Powerlevel10k affect?
+
Powerlevel10k defines prompt and nothing else. It sets prompt-related options, and parameters PS1 and RPS1.
+
+
Everything within the highlighted areas on the screenshot is produced by Powerlevel10k.
+Powerlevel10k has no control over the terminal content or colors outside these areas.
+
Powerlevel10k does not affect:
+
+
Terminal window/tab title.
+
Colors used by ls.
+
The behavior of git command.
+
The content and style of Tab completions.
+
Command line colors (syntax highlighting, autosuggestions, etc.).
Benchmark results obtained with
+zsh-prompt-benchmark on an Intel i9-7900X
+running Ubuntu 18.04 with the config from the demo.
+
+
+
+
Theme
+
Prompt Latency
+
+
+
+
+
powerlevel9k/master
+
1046 ms
+
+
+
powerlevel9k/next
+
1005 ms
+
+
+
powerlevel10k
+
8.7 ms
+
+
+
+
Powerlevel10k is over 100 times faster than Powerlevel9k in this benchmark.
+
In fairness, Powerlevel9k has acceptable latency when given a spartan configuration. If all you need
+is the current directory without truncation or shortening, Powerlevel9k can render it for you in
+17 ms. Powerlevel10k can do the same 30 times faster but it won't matter in practice because 17 ms
+is fast enough (the threshold where latency becomes noticeable is around 50 ms). You have to be
+careful with Powerlevel9k configuration as it's all too easy to make prompt frustratingly slow.
+Powerlevel10k, on the other hand, doesn't require trading latency for utility -- it's virtually
+instant with any configuration. It stays well below the 50 ms mark, leaving most of the latency
+budget for other plugins you might install.
+
How do I enable instant prompt?
+
See instant prompt to learn about instant prompt. This section explains how you
+can enable it and lists caveats that you should be aware of.
+
Instant prompt can be enabled either through p10k configure or by manually adding the following
+code snippet at the top of ~/.zshrc:
+
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
+# Initialization code that may require console input (password prompts, [y/n]
+# confirmations, etc.) must go above this block; everything else may go below.
+if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
+ source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
+fi
+
+
+
It's important that you copy the lines verbatim. Don't replace source with something else, don't
+call zcompile, don't redirect output, etc.
+
When instant prompt is enabled, for the duration of Zsh initialization standard input is redirected
+to /dev/null and standard output with standard error are redirected to a temporary file. Once Zsh
+is fully initialized, standard file descriptors are restored and the content of the temporary file
+is printed out.
+
When using instant prompt, you should carefully check any output that appears on Zsh startup as it
+may indicate that initialization has been altered, or perhaps even broken, by instant prompt.
+Initialization code that may require console input, such as asking for a keyring password or for a
+[y/n] confirmation, must be moved above the instant prompt preamble in ~/.zshrc. Initialization
+code that merely prints to console but never reads from it will work correctly with instant prompt,
+although output that normally has colors may appear uncolored. You can either leave it be, suppress
+the output, or move it above the instant prompt preamble.
+
Here's an example of ~/.zshrc that breaks when instant prompt is enabled:
+
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
+ source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
+fi
+
+keychain id_rsa --agents ssh # asks for password
+chatty-script # spams to stdout even when everything is fine
+# ...
+
+
+
Fixed version:
+
keychain id_rsa --agents ssh # moved before instant prompt
+
+# OK to perform console I/O before this point.
+if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
+ source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
+fi
+# From this point on, until zsh is fully initialized, console input won't work and
+# console output may appear uncolored.
+
+chatty-script >/dev/null # spam output suppressed
+# ...
+
+
+
If POWERLEVEL9K_INSTANT_PROMPT is unset or set to verbose, Powerlevel10k will print a warning
+when it detects console output during initialization to bring attention to potential issues. You can
+silence this warning (without suppressing console output) with POWERLEVEL9K_INSTANT_PROMPT=quiet.
+This is recommended if some initialization code in ~/.zshrc prints to console and it's infeasible
+to move it above the instant prompt preamble or to suppress its output. You can completely disable
+instant prompt with POWERLEVEL9K_INSTANT_PROMPT=off. Do this if instant prompt breaks Zsh
+initialization and you don't know how to fix it.
+
Note: Instant prompt requires Zsh >= 5.4. It's OK to enable it even when using an older version of
+Zsh but it won't do anything.
+
What do different symbols in Git status mean?
+
When using Lean, Classic or Rainbow style, Git status may look like this:
Why is Git status from $HOME/.git not displayed in prompt?
+
When using Lean, Classic or Rainbow style, ~/.p10k.zsh contains the following parameter:
+
# Don't show Git status in prompt for repositories whose workdir matches this pattern.
+# For example, if set to '~', the Git repository at $HOME/.git will be ignored.
+# Multiple patterns can be combined with '|': '~(|/foo)|/bar/baz/*'.
+typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~'
+
+
+
To see Git status for $HOME/.git in prompt, open ~/.p10k.zsh and remove
+POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN.
+
Why does Git status sometimes appear grey and then gets colored after a short period of time?
+
tl;dr: When Git status in prompt is greyed out, it means Powerlevel10k is currently computing
+up-to-date Git status in the background. Prompt will get automatically refreshed when this
+computation completes.
+
When your current directory is within a Git repository, Powerlevel10k computes up-to-date Git
+status after every command. If the repository is large, or the machine is slow, this computation
+can take quite a bit of time. If it takes longer than 20 milliseconds (configurable via
+POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS), Powerlevel10k displays the last known Git status in
+grey and continues to compute up-to-date Git status in the background. When the computation
+completes, Powerlevel10k refreshes prompt with new information, this time with colored Git status.
+
How do I add username and/or hostname to prompt?
+
When using Lean, Classic or Rainbow style, prompt shows username@hostname when you are logged in
+as root or via SSH. There is little value in showing username or hostname when you are logged in
+to your local machine as a normal user. So the absence of username@hostname in your prompt is an
+indication that you are working locally and that you aren't root. You can change it, however.
+
Open ~/.p10k.zsh. Close to the top you can see the most important parameters that define which
+segments are shown in your prompt. All generally useful prompt segments are listed in there. Some of
+them are enabled, others are commented out. One of them is of interest to you.
Search for context to find the section in the config that lists parameters specific to this prompt
+segment. You should see the following lines:
+
# Don't show context unless running with privileges or in SSH.
+# Tip: Remove the next line to always show context.
+typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION=
+
+
+
If you follow the tip and remove (or comment out) the last line, you'll always see
+username@hostname in prompt. You can change the format to just username, or change the color, by
+adjusting the values of parameters nearby. There are plenty of comments to help you navigate.
+
You can also move context to a different position in POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS or even
+to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS.
+
Why some prompt segments appear and disappear as I'm typing?
+
Prompt segments can be configured to be shown only when the current command you are typing invokes
+a relevant tool.
+
# Show prompt segment "kubecontext" only when the command you are typing
+# invokes kubectl, helm, kubens, kubectx, oc, istioctl, kogito, k9s or helmfile.
+typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile'
+
+
+
Configs created by p10k configure may contain parameters of this kind. To customize when different
+prompt segments are shown, open ~/.p10k.zsh, search for SHOW_ON_COMMAND and either remove these
+parameters or change their values.
+
You can also define a function in ~/.zshrc to toggle the display of a prompt segment between
+always and on command. This is similar to kubeon/kubeoff from
+kube-ps1.
+
function kube-toggle() {
+ if (( ${+POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND} )); then
+ unset POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND
+ else
+ POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile'
+ fi
+ p10k reload
+ if zle; then
+ zle push-input
+ zle accept-line
+ fi
+}
+
+
+
Invoke this function by typing kube-toggle. You can also bind it to a key by adding two more lines
+to ~/.zshrc:
+
zle -N kube-toggle
+bindkey '^]' kube-toggle # ctrl-] to toggle kubecontext in powerlevel10k prompt
+
How exactly you change the terminal color palette (a.k.a. color scheme, or theme) depends on the
+kind of terminal you are using. Look around in terminal's settings/preferences or consult
+documentation.
+
When you change the terminal color palette, it usually affects only the first 16 colors, numbered
+from 0 to 15. In order to see any effect on Powerlevel10k prompt, you need to use prompt style that
+utilizes these low-numbered colors. Type p10k configure and select Rainbow, Lean → 8 colors
+or Pure → Original. Other styles use higher-numbered colors, so they look the same in any
+terminal color palette.
+
Set colors through Powerlevel10k configuration parameters
+
Open ~/.p10k.zsh, search for "color", "foreground" and "background" and change values of
+appropriate parameters. For example, here's how you can set the foreground of time prompt segment
+to bright red:
+
typeset -g POWERLEVEL9K_TIME_FOREGROUND=160
+
+
+
Colors are specified using numbers from 0 to 255. Colors from 0 to 15 look differently in different
+terminals. Many terminals also support customization of these colors through color palettes
+(a.k.a. color schemes, or themes). Colors from 16 to 255 always look the same.
+
Type source ~/.p10k.zsh to apply your changes to the current Zsh session.
+
To see how different colors look in your terminal, run the following command:
+
for i in {0..255}; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done
+
+
+
Why does Powerlevel10k spawn extra processes?
+
Powerlevel10k uses gitstatus as the backend behind vcs
+prompt; gitstatus spawns gitstatusd and zsh. See
+gitstatus for details. Powerlevel10k may also spawn zsh
+to perform computation without blocking prompt. To avoid security hazard, these background processes
+aren't shared by different interactive shells. They terminate automatically when the parent zsh
+process terminates or runs exec(3).
+
Are there configuration options that make Powerlevel10k slow?
+
No, Powerlevel10k is always fast, with any configuration you throw at it. If you have noticeable
+prompt latency when using Powerlevel10k, please
+open an issue.
+
Is Powerlevel10k fast to load?
+
Yes, provided that you are using Zsh >= 5.4.
+
Loading time, or time to first prompt, can be measured with the following benchmark:
+
time (repeat 1000 zsh -dfis <<< 'source ~/powerlevel10k/powerlevel10k.zsh-theme')
+
+
+
Note: This measures time to first complete prompt. Powerlevel10k can also display a
+limited prompt before the full-featured prompt is ready.
+
Running this command with ~/powerlevel10k as the current directory on the same machine as in the
+prompt benchmark takes 29 seconds (29 ms per invocation). This is about 6
+times faster than powerlevel9k/master and 17 times faster than powerlevel9k/next.
+
What is the relationship between Powerlevel9k and Powerlevel10k?
+
Powerlevel10k was forked from Powerlevel9k in March 2019 after a week-long discussion in
+powerlevel9k#1170. Powerlevel9k was
+already a mature project with large user base and release cycle measured in months. Powerlevel10k
+was spun off to iterate on performance improvements and new features at much higher pace.
+
Powerlevel9k and Powerlevel10k are independent projects. When using one, you shouldn't install the
+other. Issues should be filed against the project that you actually use. There are no individuals
+that have commit rights in both repositories. All bug fixes and new features committed to
+Powerlevel9k repository get ported to Powerlevel10k.
+
Over time, virtually all code in Powerlevel10k has been rewritten. There is currently no meaningful
+overlap between the implementations of Powerlevel9k and Powerlevel10k.
+
Powerlevel10k is committed to maintaining backward compatibility with all configs indefinitely. This
+commitment covers all configuration parameters recognized by Powerlevel9k (see
+Powerlevel9k compatibility) and additional parameters that only
+Powerlevel10k understands. Names of all parameters in Powerlevel10k start with POWERLEVEL9K_ for
+consistency.
+
Does Powerlevel10k always render exactly the same prompt as Powerlevel9k given the same config?
+
Almost. There are a few differences.
+
+
By default only git vcs backend is enabled in Powerlevel10k. If you need svn and hg, add
+ them to POWERLEVEL9K_VCS_BACKENDS. These backends aren't yet optimized in Powerlevel10k, so
+ enabling them will make prompt very slow.
+
Powerlevel10k doesn't support POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY=true.
+
Powerlevel10k strives to be bug-compatible with Powerlevel9k but not when it comes to egregious
+ bugs. If you accidentally rely on these bugs, your prompt will differ between Powerlevel9k and
+ Powerlevel10k. Some examples:
+
Powerlevel9k ignores some options that are set after the theme is sourced while Powerlevel10k
+ respects all options. If you see different icons in Powerlevel9k and Powerlevel10k, you've
+ probably defined POWERLEVEL9K_MODE before sourcing the theme. This parameter gets ignored
+ by Powerlevel9k but honored by Powerlevel10k. If you want your prompt to look in Powerlevel10k
+ the same as in Powerlevel9k, remove POWERLEVEL9K_MODE.
+
Powerlevel9k doesn't respect ZLE_RPROMPT_INDENT. As a result, right prompt in Powerlevel10k
+ can have an extra space at the end compared to Powerlevel9k. Set ZLE_RPROMPT_INDENT=0 if you
+ don't want that space. More details in
+ troubleshooting.
+
Powerlevel9k has inconsistent spacing around icons. This was fixed in Powerlevel10k. Set
+ POWERLEVEL9K_LEGACY_ICON_SPACING=true to get the same spacing as in Powerlevel9k. More
+ details in troubleshooting.
+
There are dozens more bugs in Powerlevel9k that don't exist in Powerlevel10k.
+
+
If you notice any other changes in prompt appearance when switching from Powerlevel9k to
+Powerlevel10k, please open an issue.
+
What is the best prompt style in the configuration wizard?
+
There are as many opinions on what constitutes the best prompt as there are people. It mostly comes
+down to personal preference. There are, however, a few hidden implications of different choices.
+
Pure style is an exact replication of Pure Zsh theme. It
+exists to ease the migration for users of this theme. Unless you are one of them, choose Lean
+style over Pure.
+
If you want to confine prompt colors to the selected terminal color palette (say, Solarized Dark),
+use Rainbow, Lean → 8 colors or Pure → Original. Other styles use fixed colors and thus
+look the same in any terminal color palette.
+
All styles except Pure have an option to use ASCII charset. Prompt will look less pretty but will
+render correctly with all fonts and in all locales.
+
If you enable transient prompt, take advantage of two-line prompt. You'll get the benefit of
+extra space for typing commands without the usual drawback of reduced scrollback density. Having
+all commands start from the same offset is also nice.
+
Similarly, if you enable transient prompt, sparse prompt (with an empty line before prompt) is a
+great choice.
+
If you are using vi keymap, choose prompt with prompt_char in it (shown as green ❯ in the
+wizard). This symbol changes depending on vi mode: ❯, ❮, V, ▶ for insert, command, visual
+and replace mode respectively. When a command fails, the symbol turns red. Lean style always has
+prompt_char in it. Rainbow and Classic styles have it only in the two-line configuration
+without left frame.
+
If you value horizontal space or prefer minimalist aesthetics:
+
+
Use a monospace font, such as the recommended font.
+ Non-monospace fonts require extra space after icons that are larger than a single column.
+
Use Lean style. Compared to Classic and Rainbow, it saves two characters per prompt segment.
+
Disable current time and frame.
+
Use few icons. The extra icons enabled by the many icons option primarily serve decorative
+ function. Informative icons, such as background job indicator, will be shown either way.
+
+
Note: You can run configuration wizard as many times as you like. Type p10k configure to try new
+prompt style.
+
How to make Powerlevel10k look like robbyrussell Oh My Zsh theme?
You can either download it, save as ~/.p10k.zsh and source ~/.p10k.zsh from ~/.zshrc, or
+source p10k-robbyrussell.zsh directly from your cloned powerlevel10k repository.
+
Can prompts for completed commands display error status for those commands instead of the commands preceding them?
+
No. When you hit ENTER and the command you've typed starts running, its error status isn't yet
+known, so it cannot be shown in prompt. When the command completes, the error status gets known but
+it's no longer possible to update prompt for that command. This is why the error status for every
+command is reflected in the next prompt.
Zsh 5.1 or newer should work. Fast startup requires Zsh >= 5.4.
+
How were these screenshots and animated gifs created?
+
All screenshots and animated gifs were recorded in GNOME Terminal with
+the recommended font and Tango Dark color palette with
+custom background color (#171A1B instead of #2E3436 -- twice as dark).
The recommended font is the product of many
+individuals. Its origin is Bitstream Vera Sans Mono, which has given birth to Menlo, which in
+turn has spawned Meslo. Finally, extra glyphs have been added to Meslo with scripts forked
+from Nerd Fonts. The final font is released under the terms of
+Apache License.
+
MesloLGS NF font can be recreated with the following command (requires git and docker):
If everything goes well, four ttf files will appear in ./out.
+
How to package Powerlevel10k for distribution?
+
It's currently neither easy nor recommended to package and distribute Powerlevel10k. There are no
+instructions you can follow that would allow you to easily update your package when new versions of
+Powerlevel10k are released. This may change in the future but not soon.
+
+
+
+
+
+
+
+
+
+
+
+
+
Search
+
+
+
+
+ From here you can search these documents. Enter
+ your search terms below.
+
Powerlevel10k comes with dozens of built-in high quality segments. When you run p10k configure
+and choose any style except Pure, many of these segments get enabled by
+default while others be manually enabled by opening ~/.p10k.zsh and uncommenting them. You can
+enable as many segments as you like. It won't slow down your prompt or Zsh startup.
+
+
+
+
Segment
+
Meaning
+
+
+
+
+
os_icon
+
your OS logo (apple for macOS, swirl for debian, etc.)
+
+
+
dir
+
current working directory
+
+
+
vcs
+
Git repository status
+
+
+
prompt_char
+
multi-functional prompt symbol; changes depending on vi mode: ❯, ❮, V, ▶ for insert, command, visual and replace mode respectively; turns red on error
The current working directory is perhaps the most important prompt segment. Powerlevel10k goes to
+great length to highlight its important parts and to truncate it with the least loss of information
+when horizontal space gets scarce.
+
+
When the full directory doesn't fit, the leftmost segment gets truncated to its shortest unique
+prefix. In the screencast, ~/work becomes ~/wo. It couldn't be truncated to ~/w because it
+would be ambiguous (there was ~/wireguard when the session was recorded). The next segment --
+projects -- turns into p as there was nothing else that started with p in ~/work/.
+
Directory segments are shown in one of three colors:
+
+
Truncated segments are bleak.
+
Important segments are bright and never truncated. These include the first and the last segment,
+ roots of Git repositories, etc.
+
Regular segments (not truncated but can be) use in-between color.
+
+
Tip: If you copy-paste a truncated directory and hit TAB, it'll complete to the original.
Powerlevel10k can be configured to look like any other Zsh theme out there.
+
+
Pure, Powerlevel9k and robbyrussell emulations are built-in.
+To emulate the appearance of other themes, you'll need to write a suitable configuration file. The
+best way to go about it is to run p10k configure, select the style that is the closest to your
+goal and then edit ~/.p10k.zsh.
+
The full range of Powerlevel10k appearance spans from spartan:
+
+
To ~~ridiculous~~ extravagant:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Search
+
+
+
+
+ From here you can search these documents. Enter
+ your search terms below.
+
If there is no prompt segment that does what you need, implement your own. Powerlevel10k provides
+public API for defining segments that are as fast and as flexible as built-in ones.
+
+
On Linux you can fetch current CPU temperature by reading /sys/class/thermal/thermal_zone0/temp.
+The screencast shows how to define a prompt segment to display this value. Once the segment is
+defined, you can use it like any other segment. All standard customization parameters will work for
+it out of the box.
+
Type p10k help segment for reference.
+
Tip: Prefix names of your own segments with my_ to avoid clashes with future versions of
+Powerlevel10k.
+
+
+
+
+
+
+
+
+
+
+
+
+
Search
+
+
+
+
+ From here you can search these documents. Enter
+ your search terms below.
+
If your ~/.zshrc loads many plugins, or perhaps just a few slow ones
+(for example, pyenv or nvm), you
+may have noticed that it takes some time for Zsh to start.
+
+
Powerlevel10k can remove Zsh startup lag even if it's not caused by a theme.
+
+
This feature is called Instant Prompt. You need to explicitly enable it through p10k configure
+or manually. It does what it says on the tin -- prints prompt
+instantly upon Zsh startup allowing you to start typing while plugins are still loading.
+
Other themes increase Zsh startup lag -- some by a lot, others by a just a little. Powerlevel10k
+removes it outright.
Powerlevel10k understands all Powerlevel9k
+configuration parameters.
+
+
Migration from Powerlevel9k to Powerlevel10k is a straightforward process. All
+your POWERLEVEL9K configuration parameters will still work. Prompt will look the same as before
+(almost)
+but it will be much faster (certainly).
To customize prompt, edit ~/.p10k.zsh. Powerlevel10k doesn't recognize Pure configuration
+parameters, so you'll need to use POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3 instead of
+PURE_CMD_MAX_EXEC_TIME=3, etc. All relevant parameters are in ~/.p10k.zsh. This file has
+plenty of comments to help you navigate through it.
The behavior of some commands depends on global environment. For example, kubectl run ... runs an
+image on the cluster defined by the current kubernetes context. If you frequently change context
+between "prod" and "testing", you might want to display the current context in Zsh prompt. If you do
+likewise for AWS, Azure and Google Cloud credentials, prompt will get pretty crowded.
+
Enter Show On Command. This feature makes prompt segments appear only when they are relevant to
+the command you are currently typing.
+
+
Configs created by p10k configure enable show on command for several prompt segments by default.
+Here's the relevant parameter for kubernetes context:
+
# Show prompt segment "kubecontext" only when the command you are typing
+# invokes kubectl, helm, kubens, kubectx, oc, istioctl, kogito, k9s or helmfile.
+typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile'
+
+
+
To customize when different prompt segments are shown, open ~/.p10k.zsh, search for
+SHOW_ON_COMMAND and either remove these parameters to display affected segments unconditionally,
+or change their values.
+
+
+
+
+
+
+
+
+
+
+
+
+
Search
+
+
+
+
+ From here you can search these documents. Enter
+ your search terms below.
+
When Transient Prompt is enabled through p10k configure, Powerlevel10k will trim down every
+prompt when accepting a command line.
+
+
Transient prompt makes it much easier to copy-paste series of commands from the terminal scrollback.
+
Tip: If you enable transient prompt, take advantage of two-line prompt. You'll get the benefit of
+extra space for typing commands without the usual drawback of reduced scrollback density. Sparse
+prompt (with an empty line before prompt) also works great in combination with transient prompt.
+
+
+
+
+
+
+
+
+
+
+
+
+
Search
+
+
+
+
+ From here you can search these documents. Enter
+ your search terms below.
+
When you hit ENTER, the next prompt appears instantly. With Powerlevel10k there is no prompt lag.
+If you install Cygwin on Raspberry Pi, cd into a Linux Git repository and activate enough prompt
+segments to fill four prompt lines on both sides of the screen... wait, that's just crazy and no
+one ever does that. Probably impossible, too. The point is, Powerlevel10k prompt is always fast, no
+matter what you do!
+
+
Note how the effect of every command is instantly reflected by the very next prompt.
Other Zsh themes capable of displaying the same information either produce prompt lag or print
+prompt that doesn't reflect the current state of the system and then refresh it later. With
+Powerlevel10k you get fast prompt and up-to-date information.
Type p10k configure to access the builtin configuration wizard right from your terminal.
+
+
All styles except Pure are functionally equivalent. They display the same
+information and differ only in presentation.
+
Configuration wizard creates ~/.p10k.zsh based on your preferences. Additional prompt
+customization can be done by editing this file. It has plenty of comments to help you navigate
+through configuration options.
+
Tip: Install the recommended font before
+running p10k configure to unlock all prompt styles.
Recommended font: Meslo Nerd Font patched for Powerlevel10k
+
Gorgeous monospace font designed by Jim Lyles for Bitstream, customized by the same for Apple,
+further customized by André Berg, and finally patched by yours truly with customized scripts
+originally developed by Ryan L McIntyre of Nerd Fonts. Contains all glyphs and symbols that
+Powerlevel10k may need. Battle-tested in dozens of different terminals on all major operating
+systems.
If you are using iTerm2 or Termux, p10k configure can install the recommended font for you.
+Simply answer Yes when asked whether to install Meslo Nerd Font.
+
If you are using a different terminal, proceed with manual font installation. 👇
Double-click on each file and click "Install". This will make MesloLGS NF font available to all
+applications on your system. Configure your terminal to use this font:
+
+
iTerm2: Open iTerm2 → Preferences → Profiles → Text and set Font to MesloLGS NF.
+ Alternatively, type p10k configure and answer Yes when asked whether to install
+ Meslo Nerd Font.
+
Apple Terminal Open Terminal → Preferences → Profiles → Text, click Change under Font
+ and select MesloLGS NF family.
+
Hyper: Open Hyper → Edit → Preferences and change the value of fontFamily under
+ module.exports.config to MesloLGS NF.
+
Visual Studio Code: Open File → Preferences → Settings, enter
+ terminal.integrated.fontFamily in the search box and set the value to MesloLGS NF.
+
GNOME Terminal (the default Ubuntu terminal): Open Terminal → Preferences and click on the
+ selected profile under Profiles. Check Custom font under Text Appearance and select
+ MesloLGS NF Regular.
+
Konsole: Open Settings → Edit Current Profile → Appearance, click Select Font and select
+ MesloLGS NF Regular.
+
Tilix: Open Tilix → Preferences and click on the selected profile under Profiles. Check
+ Custom font under Text Appearance and select MesloLGS NF Regular.
+
Windows Console Host (the old thing): Click the icon in the top left corner, then
+ Properties → Font and set Font to MesloLGS NF.
+
Windows Terminal (the new thing): Open Settings (Ctrl+,), search for fontFace and set
+ value to MesloLGS NF for every profile.
+
Termux: Type p10k configure and answer Yes when asked whether to install
+ Meslo Nerd Font.
+
Blink Type config, go to Appearance, tap Add a new font, tap Open Gallery, select
+ MesloLGS NF.css, tap import and type exit in the home view to reload the font.
+
Terminus: Open Settings → Appearance and set Font to MesloLGS NF.
+
Terminator: Open Preferences using the context menu. Under Profiles select the General
+ tab (should be selected already), uncheck Use the system fixed width font (if not already)
+ and select MesloLGS NF Regular. Exit the Preferences dialog by clicking Close.
+
Guake: Right Click on an open terminal and open Preferences. Under Appearance
+ tab, uncheck Use the system fixed width font (if not already) and select MesloLGS NF Regular.
+ Exit the Preferences dialog by clicking Close.
+
Alacritty: Create or open ~/.config/alacritty/alacritty.yml and add the following section
+ to it:
+
+
font:
+ normal:
+ family: 'MesloLGS NF'
+
+
+
+
Kitty: Create or open ~/.config/kitty/kitty.conf and add the following line to it:
+
+
font_family MesloLGS NF
+
+
+
Restart Kitty by closing all sessions and opening a new session.
+
IMPORTANT: Run p10k configure after changing terminal font. The old ~/.p10k.zsh may work
+incorrectly with the new font.
+
Using a different terminal and know how to set the font for it? Share your knowledge by sending a
+PR to expand the list!
+
+
+
+
+
+
+
+
+
+
+
+
+
Search
+
+
+
+
+ From here you can search these documents. Enter
+ your search terms below.
+
This is the simplest kind of installation and it works even if you are using a plugin manager. Just
+make sure to disable the current theme in your plugin manager. See
+troubleshooting for help.
a",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="
").append(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Cn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,x.ajaxSettings),t):_n(x.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v={},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=x.trim(p.dataType||"*").toLowerCase().match(T)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(mn[3]||("http:"===mn[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),qn(An,p,n,C),2===b)return C;l=p.global,l&&0===x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(x.lastModified[o]&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)C.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b))return C.abort();w="abort";for(i in{success:1,error:1,complete:1})C[i](p[i]);if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try{b=1,u.send(y,k)}catch(N){if(!(2>b))throw N;k(-1,N)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in l)if(l[s]&&l[s].test(o)){u.unshift(s);break}if(u[0]in r)a=u[0];else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a)for(i in u)if(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i){n=a.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Fn=[],Bn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Fn.push(o)),s&&x.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}x.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr(),x.support.cors=!!Rn&&"withCredentials"in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState))if(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i)4!==l.readyState&&l.abort();else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do s=s||".5",a/=s,x.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++)if(r=i[o].call(n,t,e))return r}function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;for(;l>a;a++)u.tweens[a].run(o);return s.notifyWith(e,[u,o,n]),1>o&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)u.tweens[n].run(1);return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr(c,u.opts.specialEasing);a>o;o++)if(r=Gn[o].call(u,e,c,u.opts))return r;return x.map(c,Zn,u),x.isFunction(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t){var n,r,i,o,a;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=x.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(er,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function(){u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show"))continue;c[r]=d&&d[r]||x.style(e,r)}if(!x.isEmptyObject(c)){d?"hidden"in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}x.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);(i||x._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=x.timers,a=x._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,x.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using"in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window);
diff --git a/docs/search/lunr.js b/docs/search/lunr.js
new file mode 100644
index 00000000..c3537658
--- /dev/null
+++ b/docs/search/lunr.js
@@ -0,0 +1,3475 @@
+/**
+ * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.8
+ * Copyright (C) 2019 Oliver Nightingale
+ * @license MIT
+ */
+
+;(function(){
+
+/**
+ * A convenience function for configuring and constructing
+ * a new lunr Index.
+ *
+ * A lunr.Builder instance is created and the pipeline setup
+ * with a trimmer, stop word filter and stemmer.
+ *
+ * This builder object is yielded to the configuration function
+ * that is passed as a parameter, allowing the list of fields
+ * and other builder parameters to be customised.
+ *
+ * All documents _must_ be added within the passed config function.
+ *
+ * @example
+ * var idx = lunr(function () {
+ * this.field('title')
+ * this.field('body')
+ * this.ref('id')
+ *
+ * documents.forEach(function (doc) {
+ * this.add(doc)
+ * }, this)
+ * })
+ *
+ * @see {@link lunr.Builder}
+ * @see {@link lunr.Pipeline}
+ * @see {@link lunr.trimmer}
+ * @see {@link lunr.stopWordFilter}
+ * @see {@link lunr.stemmer}
+ * @namespace {function} lunr
+ */
+var lunr = function (config) {
+ var builder = new lunr.Builder
+
+ builder.pipeline.add(
+ lunr.trimmer,
+ lunr.stopWordFilter,
+ lunr.stemmer
+ )
+
+ builder.searchPipeline.add(
+ lunr.stemmer
+ )
+
+ config.call(builder, builder)
+ return builder.build()
+}
+
+lunr.version = "2.3.8"
+/*!
+ * lunr.utils
+ * Copyright (C) 2019 Oliver Nightingale
+ */
+
+/**
+ * A namespace containing utils for the rest of the lunr library
+ * @namespace lunr.utils
+ */
+lunr.utils = {}
+
+/**
+ * Print a warning message to the console.
+ *
+ * @param {String} message The message to be printed.
+ * @memberOf lunr.utils
+ * @function
+ */
+lunr.utils.warn = (function (global) {
+ /* eslint-disable no-console */
+ return function (message) {
+ if (global.console && console.warn) {
+ console.warn(message)
+ }
+ }
+ /* eslint-enable no-console */
+})(this)
+
+/**
+ * Convert an object to a string.
+ *
+ * In the case of `null` and `undefined` the function returns
+ * the empty string, in all other cases the result of calling
+ * `toString` on the passed object is returned.
+ *
+ * @param {Any} obj The object to convert to a string.
+ * @return {String} string representation of the passed object.
+ * @memberOf lunr.utils
+ */
+lunr.utils.asString = function (obj) {
+ if (obj === void 0 || obj === null) {
+ return ""
+ } else {
+ return obj.toString()
+ }
+}
+
+/**
+ * Clones an object.
+ *
+ * Will create a copy of an existing object such that any mutations
+ * on the copy cannot affect the original.
+ *
+ * Only shallow objects are supported, passing a nested object to this
+ * function will cause a TypeError.
+ *
+ * Objects with primitives, and arrays of primitives are supported.
+ *
+ * @param {Object} obj The object to clone.
+ * @return {Object} a clone of the passed object.
+ * @throws {TypeError} when a nested object is passed.
+ * @memberOf Utils
+ */
+lunr.utils.clone = function (obj) {
+ if (obj === null || obj === undefined) {
+ return obj
+ }
+
+ var clone = Object.create(null),
+ keys = Object.keys(obj)
+
+ for (var i = 0; i < keys.length; i++) {
+ var key = keys[i],
+ val = obj[key]
+
+ if (Array.isArray(val)) {
+ clone[key] = val.slice()
+ continue
+ }
+
+ if (typeof val === 'string' ||
+ typeof val === 'number' ||
+ typeof val === 'boolean') {
+ clone[key] = val
+ continue
+ }
+
+ throw new TypeError("clone is not deep and does not support nested objects")
+ }
+
+ return clone
+}
+lunr.FieldRef = function (docRef, fieldName, stringValue) {
+ this.docRef = docRef
+ this.fieldName = fieldName
+ this._stringValue = stringValue
+}
+
+lunr.FieldRef.joiner = "/"
+
+lunr.FieldRef.fromString = function (s) {
+ var n = s.indexOf(lunr.FieldRef.joiner)
+
+ if (n === -1) {
+ throw "malformed field ref string"
+ }
+
+ var fieldRef = s.slice(0, n),
+ docRef = s.slice(n + 1)
+
+ return new lunr.FieldRef (docRef, fieldRef, s)
+}
+
+lunr.FieldRef.prototype.toString = function () {
+ if (this._stringValue == undefined) {
+ this._stringValue = this.fieldName + lunr.FieldRef.joiner + this.docRef
+ }
+
+ return this._stringValue
+}
+/*!
+ * lunr.Set
+ * Copyright (C) 2019 Oliver Nightingale
+ */
+
+/**
+ * A lunr set.
+ *
+ * @constructor
+ */
+lunr.Set = function (elements) {
+ this.elements = Object.create(null)
+
+ if (elements) {
+ this.length = elements.length
+
+ for (var i = 0; i < this.length; i++) {
+ this.elements[elements[i]] = true
+ }
+ } else {
+ this.length = 0
+ }
+}
+
+/**
+ * A complete set that contains all elements.
+ *
+ * @static
+ * @readonly
+ * @type {lunr.Set}
+ */
+lunr.Set.complete = {
+ intersect: function (other) {
+ return other
+ },
+
+ union: function (other) {
+ return other
+ },
+
+ contains: function () {
+ return true
+ }
+}
+
+/**
+ * An empty set that contains no elements.
+ *
+ * @static
+ * @readonly
+ * @type {lunr.Set}
+ */
+lunr.Set.empty = {
+ intersect: function () {
+ return this
+ },
+
+ union: function (other) {
+ return other
+ },
+
+ contains: function () {
+ return false
+ }
+}
+
+/**
+ * Returns true if this set contains the specified object.
+ *
+ * @param {object} object - Object whose presence in this set is to be tested.
+ * @returns {boolean} - True if this set contains the specified object.
+ */
+lunr.Set.prototype.contains = function (object) {
+ return !!this.elements[object]
+}
+
+/**
+ * Returns a new set containing only the elements that are present in both
+ * this set and the specified set.
+ *
+ * @param {lunr.Set} other - set to intersect with this set.
+ * @returns {lunr.Set} a new set that is the intersection of this and the specified set.
+ */
+
+lunr.Set.prototype.intersect = function (other) {
+ var a, b, elements, intersection = []
+
+ if (other === lunr.Set.complete) {
+ return this
+ }
+
+ if (other === lunr.Set.empty) {
+ return other
+ }
+
+ if (this.length < other.length) {
+ a = this
+ b = other
+ } else {
+ a = other
+ b = this
+ }
+
+ elements = Object.keys(a.elements)
+
+ for (var i = 0; i < elements.length; i++) {
+ var element = elements[i]
+ if (element in b.elements) {
+ intersection.push(element)
+ }
+ }
+
+ return new lunr.Set (intersection)
+}
+
+/**
+ * Returns a new set combining the elements of this and the specified set.
+ *
+ * @param {lunr.Set} other - set to union with this set.
+ * @return {lunr.Set} a new set that is the union of this and the specified set.
+ */
+
+lunr.Set.prototype.union = function (other) {
+ if (other === lunr.Set.complete) {
+ return lunr.Set.complete
+ }
+
+ if (other === lunr.Set.empty) {
+ return this
+ }
+
+ return new lunr.Set(Object.keys(this.elements).concat(Object.keys(other.elements)))
+}
+/**
+ * A function to calculate the inverse document frequency for
+ * a posting. This is shared between the builder and the index
+ *
+ * @private
+ * @param {object} posting - The posting for a given term
+ * @param {number} documentCount - The total number of documents.
+ */
+lunr.idf = function (posting, documentCount) {
+ var documentsWithTerm = 0
+
+ for (var fieldName in posting) {
+ if (fieldName == '_index') continue // Ignore the term index, its not a field
+ documentsWithTerm += Object.keys(posting[fieldName]).length
+ }
+
+ var x = (documentCount - documentsWithTerm + 0.5) / (documentsWithTerm + 0.5)
+
+ return Math.log(1 + Math.abs(x))
+}
+
+/**
+ * A token wraps a string representation of a token
+ * as it is passed through the text processing pipeline.
+ *
+ * @constructor
+ * @param {string} [str=''] - The string token being wrapped.
+ * @param {object} [metadata={}] - Metadata associated with this token.
+ */
+lunr.Token = function (str, metadata) {
+ this.str = str || ""
+ this.metadata = metadata || {}
+}
+
+/**
+ * Returns the token string that is being wrapped by this object.
+ *
+ * @returns {string}
+ */
+lunr.Token.prototype.toString = function () {
+ return this.str
+}
+
+/**
+ * A token update function is used when updating or optionally
+ * when cloning a token.
+ *
+ * @callback lunr.Token~updateFunction
+ * @param {string} str - The string representation of the token.
+ * @param {Object} metadata - All metadata associated with this token.
+ */
+
+/**
+ * Applies the given function to the wrapped string token.
+ *
+ * @example
+ * token.update(function (str, metadata) {
+ * return str.toUpperCase()
+ * })
+ *
+ * @param {lunr.Token~updateFunction} fn - A function to apply to the token string.
+ * @returns {lunr.Token}
+ */
+lunr.Token.prototype.update = function (fn) {
+ this.str = fn(this.str, this.metadata)
+ return this
+}
+
+/**
+ * Creates a clone of this token. Optionally a function can be
+ * applied to the cloned token.
+ *
+ * @param {lunr.Token~updateFunction} [fn] - An optional function to apply to the cloned token.
+ * @returns {lunr.Token}
+ */
+lunr.Token.prototype.clone = function (fn) {
+ fn = fn || function (s) { return s }
+ return new lunr.Token (fn(this.str, this.metadata), this.metadata)
+}
+/*!
+ * lunr.tokenizer
+ * Copyright (C) 2019 Oliver Nightingale
+ */
+
+/**
+ * A function for splitting a string into tokens ready to be inserted into
+ * the search index. Uses `lunr.tokenizer.separator` to split strings, change
+ * the value of this property to change how strings are split into tokens.
+ *
+ * This tokenizer will convert its parameter to a string by calling `toString` and
+ * then will split this string on the character in `lunr.tokenizer.separator`.
+ * Arrays will have their elements converted to strings and wrapped in a lunr.Token.
+ *
+ * Optional metadata can be passed to the tokenizer, this metadata will be cloned and
+ * added as metadata to every token that is created from the object to be tokenized.
+ *
+ * @static
+ * @param {?(string|object|object[])} obj - The object to convert into tokens
+ * @param {?object} metadata - Optional metadata to associate with every token
+ * @returns {lunr.Token[]}
+ * @see {@link lunr.Pipeline}
+ */
+lunr.tokenizer = function (obj, metadata) {
+ if (obj == null || obj == undefined) {
+ return []
+ }
+
+ if (Array.isArray(obj)) {
+ return obj.map(function (t) {
+ return new lunr.Token(
+ lunr.utils.asString(t).toLowerCase(),
+ lunr.utils.clone(metadata)
+ )
+ })
+ }
+
+ var str = obj.toString().toLowerCase(),
+ len = str.length,
+ tokens = []
+
+ for (var sliceEnd = 0, sliceStart = 0; sliceEnd <= len; sliceEnd++) {
+ var char = str.charAt(sliceEnd),
+ sliceLength = sliceEnd - sliceStart
+
+ if ((char.match(lunr.tokenizer.separator) || sliceEnd == len)) {
+
+ if (sliceLength > 0) {
+ var tokenMetadata = lunr.utils.clone(metadata) || {}
+ tokenMetadata["position"] = [sliceStart, sliceLength]
+ tokenMetadata["index"] = tokens.length
+
+ tokens.push(
+ new lunr.Token (
+ str.slice(sliceStart, sliceEnd),
+ tokenMetadata
+ )
+ )
+ }
+
+ sliceStart = sliceEnd + 1
+ }
+
+ }
+
+ return tokens
+}
+
+/**
+ * The separator used to split a string into tokens. Override this property to change the behaviour of
+ * `lunr.tokenizer` behaviour when tokenizing strings. By default this splits on whitespace and hyphens.
+ *
+ * @static
+ * @see lunr.tokenizer
+ */
+lunr.tokenizer.separator = /[\s\-]+/
+/*!
+ * lunr.Pipeline
+ * Copyright (C) 2019 Oliver Nightingale
+ */
+
+/**
+ * lunr.Pipelines maintain an ordered list of functions to be applied to all
+ * tokens in documents entering the search index and queries being ran against
+ * the index.
+ *
+ * An instance of lunr.Index created with the lunr shortcut will contain a
+ * pipeline with a stop word filter and an English language stemmer. Extra
+ * functions can be added before or after either of these functions or these
+ * default functions can be removed.
+ *
+ * When run the pipeline will call each function in turn, passing a token, the
+ * index of that token in the original list of all tokens and finally a list of
+ * all the original tokens.
+ *
+ * The output of functions in the pipeline will be passed to the next function
+ * in the pipeline. To exclude a token from entering the index the function
+ * should return undefined, the rest of the pipeline will not be called with
+ * this token.
+ *
+ * For serialisation of pipelines to work, all functions used in an instance of
+ * a pipeline should be registered with lunr.Pipeline. Registered functions can
+ * then be loaded. If trying to load a serialised pipeline that uses functions
+ * that are not registered an error will be thrown.
+ *
+ * If not planning on serialising the pipeline then registering pipeline functions
+ * is not necessary.
+ *
+ * @constructor
+ */
+lunr.Pipeline = function () {
+ this._stack = []
+}
+
+lunr.Pipeline.registeredFunctions = Object.create(null)
+
+/**
+ * A pipeline function maps lunr.Token to lunr.Token. A lunr.Token contains the token
+ * string as well as all known metadata. A pipeline function can mutate the token string
+ * or mutate (or add) metadata for a given token.
+ *
+ * A pipeline function can indicate that the passed token should be discarded by returning
+ * null, undefined or an empty string. This token will not be passed to any downstream pipeline
+ * functions and will not be added to the index.
+ *
+ * Multiple tokens can be returned by returning an array of tokens. Each token will be passed
+ * to any downstream pipeline functions and all will returned tokens will be added to the index.
+ *
+ * Any number of pipeline functions may be chained together using a lunr.Pipeline.
+ *
+ * @interface lunr.PipelineFunction
+ * @param {lunr.Token} token - A token from the document being processed.
+ * @param {number} i - The index of this token in the complete list of tokens for this document/field.
+ * @param {lunr.Token[]} tokens - All tokens for this document/field.
+ * @returns {(?lunr.Token|lunr.Token[])}
+ */
+
+/**
+ * Register a function with the pipeline.
+ *
+ * Functions that are used in the pipeline should be registered if the pipeline
+ * needs to be serialised, or a serialised pipeline needs to be loaded.
+ *
+ * Registering a function does not add it to a pipeline, functions must still be
+ * added to instances of the pipeline for them to be used when running a pipeline.
+ *
+ * @param {lunr.PipelineFunction} fn - The function to check for.
+ * @param {String} label - The label to register this function with
+ */
+lunr.Pipeline.registerFunction = function (fn, label) {
+ if (label in this.registeredFunctions) {
+ lunr.utils.warn('Overwriting existing registered function: ' + label)
+ }
+
+ fn.label = label
+ lunr.Pipeline.registeredFunctions[fn.label] = fn
+}
+
+/**
+ * Warns if the function is not registered as a Pipeline function.
+ *
+ * @param {lunr.PipelineFunction} fn - The function to check for.
+ * @private
+ */
+lunr.Pipeline.warnIfFunctionNotRegistered = function (fn) {
+ var isRegistered = fn.label && (fn.label in this.registeredFunctions)
+
+ if (!isRegistered) {
+ lunr.utils.warn('Function is not registered with pipeline. This may cause problems when serialising the index.\n', fn)
+ }
+}
+
+/**
+ * Loads a previously serialised pipeline.
+ *
+ * All functions to be loaded must already be registered with lunr.Pipeline.
+ * If any function from the serialised data has not been registered then an
+ * error will be thrown.
+ *
+ * @param {Object} serialised - The serialised pipeline to load.
+ * @returns {lunr.Pipeline}
+ */
+lunr.Pipeline.load = function (serialised) {
+ var pipeline = new lunr.Pipeline
+
+ serialised.forEach(function (fnName) {
+ var fn = lunr.Pipeline.registeredFunctions[fnName]
+
+ if (fn) {
+ pipeline.add(fn)
+ } else {
+ throw new Error('Cannot load unregistered function: ' + fnName)
+ }
+ })
+
+ return pipeline
+}
+
+/**
+ * Adds new functions to the end of the pipeline.
+ *
+ * Logs a warning if the function has not been registered.
+ *
+ * @param {lunr.PipelineFunction[]} functions - Any number of functions to add to the pipeline.
+ */
+lunr.Pipeline.prototype.add = function () {
+ var fns = Array.prototype.slice.call(arguments)
+
+ fns.forEach(function (fn) {
+ lunr.Pipeline.warnIfFunctionNotRegistered(fn)
+ this._stack.push(fn)
+ }, this)
+}
+
+/**
+ * Adds a single function after a function that already exists in the
+ * pipeline.
+ *
+ * Logs a warning if the function has not been registered.
+ *
+ * @param {lunr.PipelineFunction} existingFn - A function that already exists in the pipeline.
+ * @param {lunr.PipelineFunction} newFn - The new function to add to the pipeline.
+ */
+lunr.Pipeline.prototype.after = function (existingFn, newFn) {
+ lunr.Pipeline.warnIfFunctionNotRegistered(newFn)
+
+ var pos = this._stack.indexOf(existingFn)
+ if (pos == -1) {
+ throw new Error('Cannot find existingFn')
+ }
+
+ pos = pos + 1
+ this._stack.splice(pos, 0, newFn)
+}
+
+/**
+ * Adds a single function before a function that already exists in the
+ * pipeline.
+ *
+ * Logs a warning if the function has not been registered.
+ *
+ * @param {lunr.PipelineFunction} existingFn - A function that already exists in the pipeline.
+ * @param {lunr.PipelineFunction} newFn - The new function to add to the pipeline.
+ */
+lunr.Pipeline.prototype.before = function (existingFn, newFn) {
+ lunr.Pipeline.warnIfFunctionNotRegistered(newFn)
+
+ var pos = this._stack.indexOf(existingFn)
+ if (pos == -1) {
+ throw new Error('Cannot find existingFn')
+ }
+
+ this._stack.splice(pos, 0, newFn)
+}
+
+/**
+ * Removes a function from the pipeline.
+ *
+ * @param {lunr.PipelineFunction} fn The function to remove from the pipeline.
+ */
+lunr.Pipeline.prototype.remove = function (fn) {
+ var pos = this._stack.indexOf(fn)
+ if (pos == -1) {
+ return
+ }
+
+ this._stack.splice(pos, 1)
+}
+
+/**
+ * Runs the current list of functions that make up the pipeline against the
+ * passed tokens.
+ *
+ * @param {Array} tokens The tokens to run through the pipeline.
+ * @returns {Array}
+ */
+lunr.Pipeline.prototype.run = function (tokens) {
+ var stackLength = this._stack.length
+
+ for (var i = 0; i < stackLength; i++) {
+ var fn = this._stack[i]
+ var memo = []
+
+ for (var j = 0; j < tokens.length; j++) {
+ var result = fn(tokens[j], j, tokens)
+
+ if (result === null || result === void 0 || result === '') continue
+
+ if (Array.isArray(result)) {
+ for (var k = 0; k < result.length; k++) {
+ memo.push(result[k])
+ }
+ } else {
+ memo.push(result)
+ }
+ }
+
+ tokens = memo
+ }
+
+ return tokens
+}
+
+/**
+ * Convenience method for passing a string through a pipeline and getting
+ * strings out. This method takes care of wrapping the passed string in a
+ * token and mapping the resulting tokens back to strings.
+ *
+ * @param {string} str - The string to pass through the pipeline.
+ * @param {?object} metadata - Optional metadata to associate with the token
+ * passed to the pipeline.
+ * @returns {string[]}
+ */
+lunr.Pipeline.prototype.runString = function (str, metadata) {
+ var token = new lunr.Token (str, metadata)
+
+ return this.run([token]).map(function (t) {
+ return t.toString()
+ })
+}
+
+/**
+ * Resets the pipeline by removing any existing processors.
+ *
+ */
+lunr.Pipeline.prototype.reset = function () {
+ this._stack = []
+}
+
+/**
+ * Returns a representation of the pipeline ready for serialisation.
+ *
+ * Logs a warning if the function has not been registered.
+ *
+ * @returns {Array}
+ */
+lunr.Pipeline.prototype.toJSON = function () {
+ return this._stack.map(function (fn) {
+ lunr.Pipeline.warnIfFunctionNotRegistered(fn)
+
+ return fn.label
+ })
+}
+/*!
+ * lunr.Vector
+ * Copyright (C) 2019 Oliver Nightingale
+ */
+
+/**
+ * A vector is used to construct the vector space of documents and queries. These
+ * vectors support operations to determine the similarity between two documents or
+ * a document and a query.
+ *
+ * Normally no parameters are required for initializing a vector, but in the case of
+ * loading a previously dumped vector the raw elements can be provided to the constructor.
+ *
+ * For performance reasons vectors are implemented with a flat array, where an elements
+ * index is immediately followed by its value. E.g. [index, value, index, value]. This
+ * allows the underlying array to be as sparse as possible and still offer decent
+ * performance when being used for vector calculations.
+ *
+ * @constructor
+ * @param {Number[]} [elements] - The flat list of element index and element value pairs.
+ */
+lunr.Vector = function (elements) {
+ this._magnitude = 0
+ this.elements = elements || []
+}
+
+
+/**
+ * Calculates the position within the vector to insert a given index.
+ *
+ * This is used internally by insert and upsert. If there are duplicate indexes then
+ * the position is returned as if the value for that index were to be updated, but it
+ * is the callers responsibility to check whether there is a duplicate at that index
+ *
+ * @param {Number} insertIdx - The index at which the element should be inserted.
+ * @returns {Number}
+ */
+lunr.Vector.prototype.positionForIndex = function (index) {
+ // For an empty vector the tuple can be inserted at the beginning
+ if (this.elements.length == 0) {
+ return 0
+ }
+
+ var start = 0,
+ end = this.elements.length / 2,
+ sliceLength = end - start,
+ pivotPoint = Math.floor(sliceLength / 2),
+ pivotIndex = this.elements[pivotPoint * 2]
+
+ while (sliceLength > 1) {
+ if (pivotIndex < index) {
+ start = pivotPoint
+ }
+
+ if (pivotIndex > index) {
+ end = pivotPoint
+ }
+
+ if (pivotIndex == index) {
+ break
+ }
+
+ sliceLength = end - start
+ pivotPoint = start + Math.floor(sliceLength / 2)
+ pivotIndex = this.elements[pivotPoint * 2]
+ }
+
+ if (pivotIndex == index) {
+ return pivotPoint * 2
+ }
+
+ if (pivotIndex > index) {
+ return pivotPoint * 2
+ }
+
+ if (pivotIndex < index) {
+ return (pivotPoint + 1) * 2
+ }
+}
+
+/**
+ * Inserts an element at an index within the vector.
+ *
+ * Does not allow duplicates, will throw an error if there is already an entry
+ * for this index.
+ *
+ * @param {Number} insertIdx - The index at which the element should be inserted.
+ * @param {Number} val - The value to be inserted into the vector.
+ */
+lunr.Vector.prototype.insert = function (insertIdx, val) {
+ this.upsert(insertIdx, val, function () {
+ throw "duplicate index"
+ })
+}
+
+/**
+ * Inserts or updates an existing index within the vector.
+ *
+ * @param {Number} insertIdx - The index at which the element should be inserted.
+ * @param {Number} val - The value to be inserted into the vector.
+ * @param {function} fn - A function that is called for updates, the existing value and the
+ * requested value are passed as arguments
+ */
+lunr.Vector.prototype.upsert = function (insertIdx, val, fn) {
+ this._magnitude = 0
+ var position = this.positionForIndex(insertIdx)
+
+ if (this.elements[position] == insertIdx) {
+ this.elements[position + 1] = fn(this.elements[position + 1], val)
+ } else {
+ this.elements.splice(position, 0, insertIdx, val)
+ }
+}
+
+/**
+ * Calculates the magnitude of this vector.
+ *
+ * @returns {Number}
+ */
+lunr.Vector.prototype.magnitude = function () {
+ if (this._magnitude) return this._magnitude
+
+ var sumOfSquares = 0,
+ elementsLength = this.elements.length
+
+ for (var i = 1; i < elementsLength; i += 2) {
+ var val = this.elements[i]
+ sumOfSquares += val * val
+ }
+
+ return this._magnitude = Math.sqrt(sumOfSquares)
+}
+
+/**
+ * Calculates the dot product of this vector and another vector.
+ *
+ * @param {lunr.Vector} otherVector - The vector to compute the dot product with.
+ * @returns {Number}
+ */
+lunr.Vector.prototype.dot = function (otherVector) {
+ var dotProduct = 0,
+ a = this.elements, b = otherVector.elements,
+ aLen = a.length, bLen = b.length,
+ aVal = 0, bVal = 0,
+ i = 0, j = 0
+
+ while (i < aLen && j < bLen) {
+ aVal = a[i], bVal = b[j]
+ if (aVal < bVal) {
+ i += 2
+ } else if (aVal > bVal) {
+ j += 2
+ } else if (aVal == bVal) {
+ dotProduct += a[i + 1] * b[j + 1]
+ i += 2
+ j += 2
+ }
+ }
+
+ return dotProduct
+}
+
+/**
+ * Calculates the similarity between this vector and another vector.
+ *
+ * @param {lunr.Vector} otherVector - The other vector to calculate the
+ * similarity with.
+ * @returns {Number}
+ */
+lunr.Vector.prototype.similarity = function (otherVector) {
+ return this.dot(otherVector) / this.magnitude() || 0
+}
+
+/**
+ * Converts the vector to an array of the elements within the vector.
+ *
+ * @returns {Number[]}
+ */
+lunr.Vector.prototype.toArray = function () {
+ var output = new Array (this.elements.length / 2)
+
+ for (var i = 1, j = 0; i < this.elements.length; i += 2, j++) {
+ output[j] = this.elements[i]
+ }
+
+ return output
+}
+
+/**
+ * A JSON serializable representation of the vector.
+ *
+ * @returns {Number[]}
+ */
+lunr.Vector.prototype.toJSON = function () {
+ return this.elements
+}
+/* eslint-disable */
+/*!
+ * lunr.stemmer
+ * Copyright (C) 2019 Oliver Nightingale
+ * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt
+ */
+
+/**
+ * lunr.stemmer is an english language stemmer, this is a JavaScript
+ * implementation of the PorterStemmer taken from http://tartarus.org/~martin
+ *
+ * @static
+ * @implements {lunr.PipelineFunction}
+ * @param {lunr.Token} token - The string to stem
+ * @returns {lunr.Token}
+ * @see {@link lunr.Pipeline}
+ * @function
+ */
+lunr.stemmer = (function(){
+ var step2list = {
+ "ational" : "ate",
+ "tional" : "tion",
+ "enci" : "ence",
+ "anci" : "ance",
+ "izer" : "ize",
+ "bli" : "ble",
+ "alli" : "al",
+ "entli" : "ent",
+ "eli" : "e",
+ "ousli" : "ous",
+ "ization" : "ize",
+ "ation" : "ate",
+ "ator" : "ate",
+ "alism" : "al",
+ "iveness" : "ive",
+ "fulness" : "ful",
+ "ousness" : "ous",
+ "aliti" : "al",
+ "iviti" : "ive",
+ "biliti" : "ble",
+ "logi" : "log"
+ },
+
+ step3list = {
+ "icate" : "ic",
+ "ative" : "",
+ "alize" : "al",
+ "iciti" : "ic",
+ "ical" : "ic",
+ "ful" : "",
+ "ness" : ""
+ },
+
+ c = "[^aeiou]", // consonant
+ v = "[aeiouy]", // vowel
+ C = c + "[^aeiouy]*", // consonant sequence
+ V = v + "[aeiou]*", // vowel sequence
+
+ mgr0 = "^(" + C + ")?" + V + C, // [C]VC... is m>0
+ meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$", // [C]VC[V] is m=1
+ mgr1 = "^(" + C + ")?" + V + C + V + C, // [C]VCVC... is m>1
+ s_v = "^(" + C + ")?" + v; // vowel in stem
+
+ var re_mgr0 = new RegExp(mgr0);
+ var re_mgr1 = new RegExp(mgr1);
+ var re_meq1 = new RegExp(meq1);
+ var re_s_v = new RegExp(s_v);
+
+ var re_1a = /^(.+?)(ss|i)es$/;
+ var re2_1a = /^(.+?)([^s])s$/;
+ var re_1b = /^(.+?)eed$/;
+ var re2_1b = /^(.+?)(ed|ing)$/;
+ var re_1b_2 = /.$/;
+ var re2_1b_2 = /(at|bl|iz)$/;
+ var re3_1b_2 = new RegExp("([^aeiouylsz])\\1$");
+ var re4_1b_2 = new RegExp("^" + C + v + "[^aeiouwxy]$");
+
+ var re_1c = /^(.+?[^aeiou])y$/;
+ var re_2 = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
+
+ var re_3 = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
+
+ var re_4 = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
+ var re2_4 = /^(.+?)(s|t)(ion)$/;
+
+ var re_5 = /^(.+?)e$/;
+ var re_5_1 = /ll$/;
+ var re3_5 = new RegExp("^" + C + v + "[^aeiouwxy]$");
+
+ var porterStemmer = function porterStemmer(w) {
+ var stem,
+ suffix,
+ firstch,
+ re,
+ re2,
+ re3,
+ re4;
+
+ if (w.length < 3) { return w; }
+
+ firstch = w.substr(0,1);
+ if (firstch == "y") {
+ w = firstch.toUpperCase() + w.substr(1);
+ }
+
+ // Step 1a
+ re = re_1a
+ re2 = re2_1a;
+
+ if (re.test(w)) { w = w.replace(re,"$1$2"); }
+ else if (re2.test(w)) { w = w.replace(re2,"$1$2"); }
+
+ // Step 1b
+ re = re_1b;
+ re2 = re2_1b;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ re = re_mgr0;
+ if (re.test(fp[1])) {
+ re = re_1b_2;
+ w = w.replace(re,"");
+ }
+ } else if (re2.test(w)) {
+ var fp = re2.exec(w);
+ stem = fp[1];
+ re2 = re_s_v;
+ if (re2.test(stem)) {
+ w = stem;
+ re2 = re2_1b_2;
+ re3 = re3_1b_2;
+ re4 = re4_1b_2;
+ if (re2.test(w)) { w = w + "e"; }
+ else if (re3.test(w)) { re = re_1b_2; w = w.replace(re,""); }
+ else if (re4.test(w)) { w = w + "e"; }
+ }
+ }
+
+ // Step 1c - replace suffix y or Y by i if preceded by a non-vowel which is not the first letter of the word (so cry -> cri, by -> by, say -> say)
+ re = re_1c;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ stem = fp[1];
+ w = stem + "i";
+ }
+
+ // Step 2
+ re = re_2;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ stem = fp[1];
+ suffix = fp[2];
+ re = re_mgr0;
+ if (re.test(stem)) {
+ w = stem + step2list[suffix];
+ }
+ }
+
+ // Step 3
+ re = re_3;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ stem = fp[1];
+ suffix = fp[2];
+ re = re_mgr0;
+ if (re.test(stem)) {
+ w = stem + step3list[suffix];
+ }
+ }
+
+ // Step 4
+ re = re_4;
+ re2 = re2_4;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ stem = fp[1];
+ re = re_mgr1;
+ if (re.test(stem)) {
+ w = stem;
+ }
+ } else if (re2.test(w)) {
+ var fp = re2.exec(w);
+ stem = fp[1] + fp[2];
+ re2 = re_mgr1;
+ if (re2.test(stem)) {
+ w = stem;
+ }
+ }
+
+ // Step 5
+ re = re_5;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ stem = fp[1];
+ re = re_mgr1;
+ re2 = re_meq1;
+ re3 = re3_5;
+ if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) {
+ w = stem;
+ }
+ }
+
+ re = re_5_1;
+ re2 = re_mgr1;
+ if (re.test(w) && re2.test(w)) {
+ re = re_1b_2;
+ w = w.replace(re,"");
+ }
+
+ // and turn initial Y back to y
+
+ if (firstch == "y") {
+ w = firstch.toLowerCase() + w.substr(1);
+ }
+
+ return w;
+ };
+
+ return function (token) {
+ return token.update(porterStemmer);
+ }
+})();
+
+lunr.Pipeline.registerFunction(lunr.stemmer, 'stemmer')
+/*!
+ * lunr.stopWordFilter
+ * Copyright (C) 2019 Oliver Nightingale
+ */
+
+/**
+ * lunr.generateStopWordFilter builds a stopWordFilter function from the provided
+ * list of stop words.
+ *
+ * The built in lunr.stopWordFilter is built using this generator and can be used
+ * to generate custom stopWordFilters for applications or non English languages.
+ *
+ * @function
+ * @param {Array} token The token to pass through the filter
+ * @returns {lunr.PipelineFunction}
+ * @see lunr.Pipeline
+ * @see lunr.stopWordFilter
+ */
+lunr.generateStopWordFilter = function (stopWords) {
+ var words = stopWords.reduce(function (memo, stopWord) {
+ memo[stopWord] = stopWord
+ return memo
+ }, {})
+
+ return function (token) {
+ if (token && words[token.toString()] !== token.toString()) return token
+ }
+}
+
+/**
+ * lunr.stopWordFilter is an English language stop word list filter, any words
+ * contained in the list will not be passed through the filter.
+ *
+ * This is intended to be used in the Pipeline. If the token does not pass the
+ * filter then undefined will be returned.
+ *
+ * @function
+ * @implements {lunr.PipelineFunction}
+ * @params {lunr.Token} token - A token to check for being a stop word.
+ * @returns {lunr.Token}
+ * @see {@link lunr.Pipeline}
+ */
+lunr.stopWordFilter = lunr.generateStopWordFilter([
+ 'a',
+ 'able',
+ 'about',
+ 'across',
+ 'after',
+ 'all',
+ 'almost',
+ 'also',
+ 'am',
+ 'among',
+ 'an',
+ 'and',
+ 'any',
+ 'are',
+ 'as',
+ 'at',
+ 'be',
+ 'because',
+ 'been',
+ 'but',
+ 'by',
+ 'can',
+ 'cannot',
+ 'could',
+ 'dear',
+ 'did',
+ 'do',
+ 'does',
+ 'either',
+ 'else',
+ 'ever',
+ 'every',
+ 'for',
+ 'from',
+ 'get',
+ 'got',
+ 'had',
+ 'has',
+ 'have',
+ 'he',
+ 'her',
+ 'hers',
+ 'him',
+ 'his',
+ 'how',
+ 'however',
+ 'i',
+ 'if',
+ 'in',
+ 'into',
+ 'is',
+ 'it',
+ 'its',
+ 'just',
+ 'least',
+ 'let',
+ 'like',
+ 'likely',
+ 'may',
+ 'me',
+ 'might',
+ 'most',
+ 'must',
+ 'my',
+ 'neither',
+ 'no',
+ 'nor',
+ 'not',
+ 'of',
+ 'off',
+ 'often',
+ 'on',
+ 'only',
+ 'or',
+ 'other',
+ 'our',
+ 'own',
+ 'rather',
+ 'said',
+ 'say',
+ 'says',
+ 'she',
+ 'should',
+ 'since',
+ 'so',
+ 'some',
+ 'than',
+ 'that',
+ 'the',
+ 'their',
+ 'them',
+ 'then',
+ 'there',
+ 'these',
+ 'they',
+ 'this',
+ 'tis',
+ 'to',
+ 'too',
+ 'twas',
+ 'us',
+ 'wants',
+ 'was',
+ 'we',
+ 'were',
+ 'what',
+ 'when',
+ 'where',
+ 'which',
+ 'while',
+ 'who',
+ 'whom',
+ 'why',
+ 'will',
+ 'with',
+ 'would',
+ 'yet',
+ 'you',
+ 'your'
+])
+
+lunr.Pipeline.registerFunction(lunr.stopWordFilter, 'stopWordFilter')
+/*!
+ * lunr.trimmer
+ * Copyright (C) 2019 Oliver Nightingale
+ */
+
+/**
+ * lunr.trimmer is a pipeline function for trimming non word
+ * characters from the beginning and end of tokens before they
+ * enter the index.
+ *
+ * This implementation may not work correctly for non latin
+ * characters and should either be removed or adapted for use
+ * with languages with non-latin characters.
+ *
+ * @static
+ * @implements {lunr.PipelineFunction}
+ * @param {lunr.Token} token The token to pass through the filter
+ * @returns {lunr.Token}
+ * @see lunr.Pipeline
+ */
+lunr.trimmer = function (token) {
+ return token.update(function (s) {
+ return s.replace(/^\W+/, '').replace(/\W+$/, '')
+ })
+}
+
+lunr.Pipeline.registerFunction(lunr.trimmer, 'trimmer')
+/*!
+ * lunr.TokenSet
+ * Copyright (C) 2019 Oliver Nightingale
+ */
+
+/**
+ * A token set is used to store the unique list of all tokens
+ * within an index. Token sets are also used to represent an
+ * incoming query to the index, this query token set and index
+ * token set are then intersected to find which tokens to look
+ * up in the inverted index.
+ *
+ * A token set can hold multiple tokens, as in the case of the
+ * index token set, or it can hold a single token as in the
+ * case of a simple query token set.
+ *
+ * Additionally token sets are used to perform wildcard matching.
+ * Leading, contained and trailing wildcards are supported, and
+ * from this edit distance matching can also be provided.
+ *
+ * Token sets are implemented as a minimal finite state automata,
+ * where both common prefixes and suffixes are shared between tokens.
+ * This helps to reduce the space used for storing the token set.
+ *
+ * @constructor
+ */
+lunr.TokenSet = function () {
+ this.final = false
+ this.edges = {}
+ this.id = lunr.TokenSet._nextId
+ lunr.TokenSet._nextId += 1
+}
+
+/**
+ * Keeps track of the next, auto increment, identifier to assign
+ * to a new tokenSet.
+ *
+ * TokenSets require a unique identifier to be correctly minimised.
+ *
+ * @private
+ */
+lunr.TokenSet._nextId = 1
+
+/**
+ * Creates a TokenSet instance from the given sorted array of words.
+ *
+ * @param {String[]} arr - A sorted array of strings to create the set from.
+ * @returns {lunr.TokenSet}
+ * @throws Will throw an error if the input array is not sorted.
+ */
+lunr.TokenSet.fromArray = function (arr) {
+ var builder = new lunr.TokenSet.Builder
+
+ for (var i = 0, len = arr.length; i < len; i++) {
+ builder.insert(arr[i])
+ }
+
+ builder.finish()
+ return builder.root
+}
+
+/**
+ * Creates a token set from a query clause.
+ *
+ * @private
+ * @param {Object} clause - A single clause from lunr.Query.
+ * @param {string} clause.term - The query clause term.
+ * @param {number} [clause.editDistance] - The optional edit distance for the term.
+ * @returns {lunr.TokenSet}
+ */
+lunr.TokenSet.fromClause = function (clause) {
+ if ('editDistance' in clause) {
+ return lunr.TokenSet.fromFuzzyString(clause.term, clause.editDistance)
+ } else {
+ return lunr.TokenSet.fromString(clause.term)
+ }
+}
+
+/**
+ * Creates a token set representing a single string with a specified
+ * edit distance.
+ *
+ * Insertions, deletions, substitutions and transpositions are each
+ * treated as an edit distance of 1.
+ *
+ * Increasing the allowed edit distance will have a dramatic impact
+ * on the performance of both creating and intersecting these TokenSets.
+ * It is advised to keep the edit distance less than 3.
+ *
+ * @param {string} str - The string to create the token set from.
+ * @param {number} editDistance - The allowed edit distance to match.
+ * @returns {lunr.Vector}
+ */
+lunr.TokenSet.fromFuzzyString = function (str, editDistance) {
+ var root = new lunr.TokenSet
+
+ var stack = [{
+ node: root,
+ editsRemaining: editDistance,
+ str: str
+ }]
+
+ while (stack.length) {
+ var frame = stack.pop()
+
+ // no edit
+ if (frame.str.length > 0) {
+ var char = frame.str.charAt(0),
+ noEditNode
+
+ if (char in frame.node.edges) {
+ noEditNode = frame.node.edges[char]
+ } else {
+ noEditNode = new lunr.TokenSet
+ frame.node.edges[char] = noEditNode
+ }
+
+ if (frame.str.length == 1) {
+ noEditNode.final = true
+ }
+
+ stack.push({
+ node: noEditNode,
+ editsRemaining: frame.editsRemaining,
+ str: frame.str.slice(1)
+ })
+ }
+
+ if (frame.editsRemaining == 0) {
+ continue
+ }
+
+ // insertion
+ if ("*" in frame.node.edges) {
+ var insertionNode = frame.node.edges["*"]
+ } else {
+ var insertionNode = new lunr.TokenSet
+ frame.node.edges["*"] = insertionNode
+ }
+
+ if (frame.str.length == 0) {
+ insertionNode.final = true
+ }
+
+ stack.push({
+ node: insertionNode,
+ editsRemaining: frame.editsRemaining - 1,
+ str: frame.str
+ })
+
+ // deletion
+ // can only do a deletion if we have enough edits remaining
+ // and if there are characters left to delete in the string
+ if (frame.str.length > 1) {
+ stack.push({
+ node: frame.node,
+ editsRemaining: frame.editsRemaining - 1,
+ str: frame.str.slice(1)
+ })
+ }
+
+ // deletion
+ // just removing the last character from the str
+ if (frame.str.length == 1) {
+ frame.node.final = true
+ }
+
+ // substitution
+ // can only do a substitution if we have enough edits remaining
+ // and if there are characters left to substitute
+ if (frame.str.length >= 1) {
+ if ("*" in frame.node.edges) {
+ var substitutionNode = frame.node.edges["*"]
+ } else {
+ var substitutionNode = new lunr.TokenSet
+ frame.node.edges["*"] = substitutionNode
+ }
+
+ if (frame.str.length == 1) {
+ substitutionNode.final = true
+ }
+
+ stack.push({
+ node: substitutionNode,
+ editsRemaining: frame.editsRemaining - 1,
+ str: frame.str.slice(1)
+ })
+ }
+
+ // transposition
+ // can only do a transposition if there are edits remaining
+ // and there are enough characters to transpose
+ if (frame.str.length > 1) {
+ var charA = frame.str.charAt(0),
+ charB = frame.str.charAt(1),
+ transposeNode
+
+ if (charB in frame.node.edges) {
+ transposeNode = frame.node.edges[charB]
+ } else {
+ transposeNode = new lunr.TokenSet
+ frame.node.edges[charB] = transposeNode
+ }
+
+ if (frame.str.length == 1) {
+ transposeNode.final = true
+ }
+
+ stack.push({
+ node: transposeNode,
+ editsRemaining: frame.editsRemaining - 1,
+ str: charA + frame.str.slice(2)
+ })
+ }
+ }
+
+ return root
+}
+
+/**
+ * Creates a TokenSet from a string.
+ *
+ * The string may contain one or more wildcard characters (*)
+ * that will allow wildcard matching when intersecting with
+ * another TokenSet.
+ *
+ * @param {string} str - The string to create a TokenSet from.
+ * @returns {lunr.TokenSet}
+ */
+lunr.TokenSet.fromString = function (str) {
+ var node = new lunr.TokenSet,
+ root = node
+
+ /*
+ * Iterates through all characters within the passed string
+ * appending a node for each character.
+ *
+ * When a wildcard character is found then a self
+ * referencing edge is introduced to continually match
+ * any number of any characters.
+ */
+ for (var i = 0, len = str.length; i < len; i++) {
+ var char = str[i],
+ final = (i == len - 1)
+
+ if (char == "*") {
+ node.edges[char] = node
+ node.final = final
+
+ } else {
+ var next = new lunr.TokenSet
+ next.final = final
+
+ node.edges[char] = next
+ node = next
+ }
+ }
+
+ return root
+}
+
+/**
+ * Converts this TokenSet into an array of strings
+ * contained within the TokenSet.
+ *
+ * This is not intended to be used on a TokenSet that
+ * contains wildcards, in these cases the results are
+ * undefined and are likely to cause an infinite loop.
+ *
+ * @returns {string[]}
+ */
+lunr.TokenSet.prototype.toArray = function () {
+ var words = []
+
+ var stack = [{
+ prefix: "",
+ node: this
+ }]
+
+ while (stack.length) {
+ var frame = stack.pop(),
+ edges = Object.keys(frame.node.edges),
+ len = edges.length
+
+ if (frame.node.final) {
+ /* In Safari, at this point the prefix is sometimes corrupted, see:
+ * https://github.com/olivernn/lunr.js/issues/279 Calling any
+ * String.prototype method forces Safari to "cast" this string to what
+ * it's supposed to be, fixing the bug. */
+ frame.prefix.charAt(0)
+ words.push(frame.prefix)
+ }
+
+ for (var i = 0; i < len; i++) {
+ var edge = edges[i]
+
+ stack.push({
+ prefix: frame.prefix.concat(edge),
+ node: frame.node.edges[edge]
+ })
+ }
+ }
+
+ return words
+}
+
+/**
+ * Generates a string representation of a TokenSet.
+ *
+ * This is intended to allow TokenSets to be used as keys
+ * in objects, largely to aid the construction and minimisation
+ * of a TokenSet. As such it is not designed to be a human
+ * friendly representation of the TokenSet.
+ *
+ * @returns {string}
+ */
+lunr.TokenSet.prototype.toString = function () {
+ // NOTE: Using Object.keys here as this.edges is very likely
+ // to enter 'hash-mode' with many keys being added
+ //
+ // avoiding a for-in loop here as it leads to the function
+ // being de-optimised (at least in V8). From some simple
+ // benchmarks the performance is comparable, but allowing
+ // V8 to optimize may mean easy performance wins in the future.
+
+ if (this._str) {
+ return this._str
+ }
+
+ var str = this.final ? '1' : '0',
+ labels = Object.keys(this.edges).sort(),
+ len = labels.length
+
+ for (var i = 0; i < len; i++) {
+ var label = labels[i],
+ node = this.edges[label]
+
+ str = str + label + node.id
+ }
+
+ return str
+}
+
+/**
+ * Returns a new TokenSet that is the intersection of
+ * this TokenSet and the passed TokenSet.
+ *
+ * This intersection will take into account any wildcards
+ * contained within the TokenSet.
+ *
+ * @param {lunr.TokenSet} b - An other TokenSet to intersect with.
+ * @returns {lunr.TokenSet}
+ */
+lunr.TokenSet.prototype.intersect = function (b) {
+ var output = new lunr.TokenSet,
+ frame = undefined
+
+ var stack = [{
+ qNode: b,
+ output: output,
+ node: this
+ }]
+
+ while (stack.length) {
+ frame = stack.pop()
+
+ // NOTE: As with the #toString method, we are using
+ // Object.keys and a for loop instead of a for-in loop
+ // as both of these objects enter 'hash' mode, causing
+ // the function to be de-optimised in V8
+ var qEdges = Object.keys(frame.qNode.edges),
+ qLen = qEdges.length,
+ nEdges = Object.keys(frame.node.edges),
+ nLen = nEdges.length
+
+ for (var q = 0; q < qLen; q++) {
+ var qEdge = qEdges[q]
+
+ for (var n = 0; n < nLen; n++) {
+ var nEdge = nEdges[n]
+
+ if (nEdge == qEdge || qEdge == '*') {
+ var node = frame.node.edges[nEdge],
+ qNode = frame.qNode.edges[qEdge],
+ final = node.final && qNode.final,
+ next = undefined
+
+ if (nEdge in frame.output.edges) {
+ // an edge already exists for this character
+ // no need to create a new node, just set the finality
+ // bit unless this node is already final
+ next = frame.output.edges[nEdge]
+ next.final = next.final || final
+
+ } else {
+ // no edge exists yet, must create one
+ // set the finality bit and insert it
+ // into the output
+ next = new lunr.TokenSet
+ next.final = final
+ frame.output.edges[nEdge] = next
+ }
+
+ stack.push({
+ qNode: qNode,
+ output: next,
+ node: node
+ })
+ }
+ }
+ }
+ }
+
+ return output
+}
+lunr.TokenSet.Builder = function () {
+ this.previousWord = ""
+ this.root = new lunr.TokenSet
+ this.uncheckedNodes = []
+ this.minimizedNodes = {}
+}
+
+lunr.TokenSet.Builder.prototype.insert = function (word) {
+ var node,
+ commonPrefix = 0
+
+ if (word < this.previousWord) {
+ throw new Error ("Out of order word insertion")
+ }
+
+ for (var i = 0; i < word.length && i < this.previousWord.length; i++) {
+ if (word[i] != this.previousWord[i]) break
+ commonPrefix++
+ }
+
+ this.minimize(commonPrefix)
+
+ if (this.uncheckedNodes.length == 0) {
+ node = this.root
+ } else {
+ node = this.uncheckedNodes[this.uncheckedNodes.length - 1].child
+ }
+
+ for (var i = commonPrefix; i < word.length; i++) {
+ var nextNode = new lunr.TokenSet,
+ char = word[i]
+
+ node.edges[char] = nextNode
+
+ this.uncheckedNodes.push({
+ parent: node,
+ char: char,
+ child: nextNode
+ })
+
+ node = nextNode
+ }
+
+ node.final = true
+ this.previousWord = word
+}
+
+lunr.TokenSet.Builder.prototype.finish = function () {
+ this.minimize(0)
+}
+
+lunr.TokenSet.Builder.prototype.minimize = function (downTo) {
+ for (var i = this.uncheckedNodes.length - 1; i >= downTo; i--) {
+ var node = this.uncheckedNodes[i],
+ childKey = node.child.toString()
+
+ if (childKey in this.minimizedNodes) {
+ node.parent.edges[node.char] = this.minimizedNodes[childKey]
+ } else {
+ // Cache the key for this node since
+ // we know it can't change anymore
+ node.child._str = childKey
+
+ this.minimizedNodes[childKey] = node.child
+ }
+
+ this.uncheckedNodes.pop()
+ }
+}
+/*!
+ * lunr.Index
+ * Copyright (C) 2019 Oliver Nightingale
+ */
+
+/**
+ * An index contains the built index of all documents and provides a query interface
+ * to the index.
+ *
+ * Usually instances of lunr.Index will not be created using this constructor, instead
+ * lunr.Builder should be used to construct new indexes, or lunr.Index.load should be
+ * used to load previously built and serialized indexes.
+ *
+ * @constructor
+ * @param {Object} attrs - The attributes of the built search index.
+ * @param {Object} attrs.invertedIndex - An index of term/field to document reference.
+ * @param {Object} attrs.fieldVectors - Field vectors
+ * @param {lunr.TokenSet} attrs.tokenSet - An set of all corpus tokens.
+ * @param {string[]} attrs.fields - The names of indexed document fields.
+ * @param {lunr.Pipeline} attrs.pipeline - The pipeline to use for search terms.
+ */
+lunr.Index = function (attrs) {
+ this.invertedIndex = attrs.invertedIndex
+ this.fieldVectors = attrs.fieldVectors
+ this.tokenSet = attrs.tokenSet
+ this.fields = attrs.fields
+ this.pipeline = attrs.pipeline
+}
+
+/**
+ * A result contains details of a document matching a search query.
+ * @typedef {Object} lunr.Index~Result
+ * @property {string} ref - The reference of the document this result represents.
+ * @property {number} score - A number between 0 and 1 representing how similar this document is to the query.
+ * @property {lunr.MatchData} matchData - Contains metadata about this match including which term(s) caused the match.
+ */
+
+/**
+ * Although lunr provides the ability to create queries using lunr.Query, it also provides a simple
+ * query language which itself is parsed into an instance of lunr.Query.
+ *
+ * For programmatically building queries it is advised to directly use lunr.Query, the query language
+ * is best used for human entered text rather than program generated text.
+ *
+ * At its simplest queries can just be a single term, e.g. `hello`, multiple terms are also supported
+ * and will be combined with OR, e.g `hello world` will match documents that contain either 'hello'
+ * or 'world', though those that contain both will rank higher in the results.
+ *
+ * Wildcards can be included in terms to match one or more unspecified characters, these wildcards can
+ * be inserted anywhere within the term, and more than one wildcard can exist in a single term. Adding
+ * wildcards will increase the number of documents that will be found but can also have a negative
+ * impact on query performance, especially with wildcards at the beginning of a term.
+ *
+ * Terms can be restricted to specific fields, e.g. `title:hello`, only documents with the term
+ * hello in the title field will match this query. Using a field not present in the index will lead
+ * to an error being thrown.
+ *
+ * Modifiers can also be added to terms, lunr supports edit distance and boost modifiers on terms. A term
+ * boost will make documents matching that term score higher, e.g. `foo^5`. Edit distance is also supported
+ * to provide fuzzy matching, e.g. 'hello~2' will match documents with hello with an edit distance of 2.
+ * Avoid large values for edit distance to improve query performance.
+ *
+ * Each term also supports a presence modifier. By default a term's presence in document is optional, however
+ * this can be changed to either required or prohibited. For a term's presence to be required in a document the
+ * term should be prefixed with a '+', e.g. `+foo bar` is a search for documents that must contain 'foo' and
+ * optionally contain 'bar'. Conversely a leading '-' sets the terms presence to prohibited, i.e. it must not
+ * appear in a document, e.g. `-foo bar` is a search for documents that do not contain 'foo' but may contain 'bar'.
+ *
+ * To escape special characters the backslash character '\' can be used, this allows searches to include
+ * characters that would normally be considered modifiers, e.g. `foo\~2` will search for a term "foo~2" instead
+ * of attempting to apply a boost of 2 to the search term "foo".
+ *
+ * @typedef {string} lunr.Index~QueryString
+ * @example
Simple single term query
+ * hello
+ * @example
Multiple term query
+ * hello world
+ * @example
term scoped to a field
+ * title:hello
+ * @example
term with a boost of 10
+ * hello^10
+ * @example
term with an edit distance of 2
+ * hello~2
+ * @example
terms with presence modifiers
+ * -foo +bar baz
+ */
+
+/**
+ * Performs a search against the index using lunr query syntax.
+ *
+ * Results will be returned sorted by their score, the most relevant results
+ * will be returned first. For details on how the score is calculated, please see
+ * the {@link https://lunrjs.com/guides/searching.html#scoring|guide}.
+ *
+ * For more programmatic querying use lunr.Index#query.
+ *
+ * @param {lunr.Index~QueryString} queryString - A string containing a lunr query.
+ * @throws {lunr.QueryParseError} If the passed query string cannot be parsed.
+ * @returns {lunr.Index~Result[]}
+ */
+lunr.Index.prototype.search = function (queryString) {
+ return this.query(function (query) {
+ var parser = new lunr.QueryParser(queryString, query)
+ parser.parse()
+ })
+}
+
+/**
+ * A query builder callback provides a query object to be used to express
+ * the query to perform on the index.
+ *
+ * @callback lunr.Index~queryBuilder
+ * @param {lunr.Query} query - The query object to build up.
+ * @this lunr.Query
+ */
+
+/**
+ * Performs a query against the index using the yielded lunr.Query object.
+ *
+ * If performing programmatic queries against the index, this method is preferred
+ * over lunr.Index#search so as to avoid the additional query parsing overhead.
+ *
+ * A query object is yielded to the supplied function which should be used to
+ * express the query to be run against the index.
+ *
+ * Note that although this function takes a callback parameter it is _not_ an
+ * asynchronous operation, the callback is just yielded a query object to be
+ * customized.
+ *
+ * @param {lunr.Index~queryBuilder} fn - A function that is used to build the query.
+ * @returns {lunr.Index~Result[]}
+ */
+lunr.Index.prototype.query = function (fn) {
+ // for each query clause
+ // * process terms
+ // * expand terms from token set
+ // * find matching documents and metadata
+ // * get document vectors
+ // * score documents
+
+ var query = new lunr.Query(this.fields),
+ matchingFields = Object.create(null),
+ queryVectors = Object.create(null),
+ termFieldCache = Object.create(null),
+ requiredMatches = Object.create(null),
+ prohibitedMatches = Object.create(null)
+
+ /*
+ * To support field level boosts a query vector is created per
+ * field. An empty vector is eagerly created to support negated
+ * queries.
+ */
+ for (var i = 0; i < this.fields.length; i++) {
+ queryVectors[this.fields[i]] = new lunr.Vector
+ }
+
+ fn.call(query, query)
+
+ for (var i = 0; i < query.clauses.length; i++) {
+ /*
+ * Unless the pipeline has been disabled for this term, which is
+ * the case for terms with wildcards, we need to pass the clause
+ * term through the search pipeline. A pipeline returns an array
+ * of processed terms. Pipeline functions may expand the passed
+ * term, which means we may end up performing multiple index lookups
+ * for a single query term.
+ */
+ var clause = query.clauses[i],
+ terms = null,
+ clauseMatches = lunr.Set.complete
+
+ if (clause.usePipeline) {
+ terms = this.pipeline.runString(clause.term, {
+ fields: clause.fields
+ })
+ } else {
+ terms = [clause.term]
+ }
+
+ for (var m = 0; m < terms.length; m++) {
+ var term = terms[m]
+
+ /*
+ * Each term returned from the pipeline needs to use the same query
+ * clause object, e.g. the same boost and or edit distance. The
+ * simplest way to do this is to re-use the clause object but mutate
+ * its term property.
+ */
+ clause.term = term
+
+ /*
+ * From the term in the clause we create a token set which will then
+ * be used to intersect the indexes token set to get a list of terms
+ * to lookup in the inverted index
+ */
+ var termTokenSet = lunr.TokenSet.fromClause(clause),
+ expandedTerms = this.tokenSet.intersect(termTokenSet).toArray()
+
+ /*
+ * If a term marked as required does not exist in the tokenSet it is
+ * impossible for the search to return any matches. We set all the field
+ * scoped required matches set to empty and stop examining any further
+ * clauses.
+ */
+ if (expandedTerms.length === 0 && clause.presence === lunr.Query.presence.REQUIRED) {
+ for (var k = 0; k < clause.fields.length; k++) {
+ var field = clause.fields[k]
+ requiredMatches[field] = lunr.Set.empty
+ }
+
+ break
+ }
+
+ for (var j = 0; j < expandedTerms.length; j++) {
+ /*
+ * For each term get the posting and termIndex, this is required for
+ * building the query vector.
+ */
+ var expandedTerm = expandedTerms[j],
+ posting = this.invertedIndex[expandedTerm],
+ termIndex = posting._index
+
+ for (var k = 0; k < clause.fields.length; k++) {
+ /*
+ * For each field that this query term is scoped by (by default
+ * all fields are in scope) we need to get all the document refs
+ * that have this term in that field.
+ *
+ * The posting is the entry in the invertedIndex for the matching
+ * term from above.
+ */
+ var field = clause.fields[k],
+ fieldPosting = posting[field],
+ matchingDocumentRefs = Object.keys(fieldPosting),
+ termField = expandedTerm + "/" + field,
+ matchingDocumentsSet = new lunr.Set(matchingDocumentRefs)
+
+ /*
+ * if the presence of this term is required ensure that the matching
+ * documents are added to the set of required matches for this clause.
+ *
+ */
+ if (clause.presence == lunr.Query.presence.REQUIRED) {
+ clauseMatches = clauseMatches.union(matchingDocumentsSet)
+
+ if (requiredMatches[field] === undefined) {
+ requiredMatches[field] = lunr.Set.complete
+ }
+ }
+
+ /*
+ * if the presence of this term is prohibited ensure that the matching
+ * documents are added to the set of prohibited matches for this field,
+ * creating that set if it does not yet exist.
+ */
+ if (clause.presence == lunr.Query.presence.PROHIBITED) {
+ if (prohibitedMatches[field] === undefined) {
+ prohibitedMatches[field] = lunr.Set.empty
+ }
+
+ prohibitedMatches[field] = prohibitedMatches[field].union(matchingDocumentsSet)
+
+ /*
+ * Prohibited matches should not be part of the query vector used for
+ * similarity scoring and no metadata should be extracted so we continue
+ * to the next field
+ */
+ continue
+ }
+
+ /*
+ * The query field vector is populated using the termIndex found for
+ * the term and a unit value with the appropriate boost applied.
+ * Using upsert because there could already be an entry in the vector
+ * for the term we are working with. In that case we just add the scores
+ * together.
+ */
+ queryVectors[field].upsert(termIndex, clause.boost, function (a, b) { return a + b })
+
+ /**
+ * If we've already seen this term, field combo then we've already collected
+ * the matching documents and metadata, no need to go through all that again
+ */
+ if (termFieldCache[termField]) {
+ continue
+ }
+
+ for (var l = 0; l < matchingDocumentRefs.length; l++) {
+ /*
+ * All metadata for this term/field/document triple
+ * are then extracted and collected into an instance
+ * of lunr.MatchData ready to be returned in the query
+ * results
+ */
+ var matchingDocumentRef = matchingDocumentRefs[l],
+ matchingFieldRef = new lunr.FieldRef (matchingDocumentRef, field),
+ metadata = fieldPosting[matchingDocumentRef],
+ fieldMatch
+
+ if ((fieldMatch = matchingFields[matchingFieldRef]) === undefined) {
+ matchingFields[matchingFieldRef] = new lunr.MatchData (expandedTerm, field, metadata)
+ } else {
+ fieldMatch.add(expandedTerm, field, metadata)
+ }
+
+ }
+
+ termFieldCache[termField] = true
+ }
+ }
+ }
+
+ /**
+ * If the presence was required we need to update the requiredMatches field sets.
+ * We do this after all fields for the term have collected their matches because
+ * the clause terms presence is required in _any_ of the fields not _all_ of the
+ * fields.
+ */
+ if (clause.presence === lunr.Query.presence.REQUIRED) {
+ for (var k = 0; k < clause.fields.length; k++) {
+ var field = clause.fields[k]
+ requiredMatches[field] = requiredMatches[field].intersect(clauseMatches)
+ }
+ }
+ }
+
+ /**
+ * Need to combine the field scoped required and prohibited
+ * matching documents into a global set of required and prohibited
+ * matches
+ */
+ var allRequiredMatches = lunr.Set.complete,
+ allProhibitedMatches = lunr.Set.empty
+
+ for (var i = 0; i < this.fields.length; i++) {
+ var field = this.fields[i]
+
+ if (requiredMatches[field]) {
+ allRequiredMatches = allRequiredMatches.intersect(requiredMatches[field])
+ }
+
+ if (prohibitedMatches[field]) {
+ allProhibitedMatches = allProhibitedMatches.union(prohibitedMatches[field])
+ }
+ }
+
+ var matchingFieldRefs = Object.keys(matchingFields),
+ results = [],
+ matches = Object.create(null)
+
+ /*
+ * If the query is negated (contains only prohibited terms)
+ * we need to get _all_ fieldRefs currently existing in the
+ * index. This is only done when we know that the query is
+ * entirely prohibited terms to avoid any cost of getting all
+ * fieldRefs unnecessarily.
+ *
+ * Additionally, blank MatchData must be created to correctly
+ * populate the results.
+ */
+ if (query.isNegated()) {
+ matchingFieldRefs = Object.keys(this.fieldVectors)
+
+ for (var i = 0; i < matchingFieldRefs.length; i++) {
+ var matchingFieldRef = matchingFieldRefs[i]
+ var fieldRef = lunr.FieldRef.fromString(matchingFieldRef)
+ matchingFields[matchingFieldRef] = new lunr.MatchData
+ }
+ }
+
+ for (var i = 0; i < matchingFieldRefs.length; i++) {
+ /*
+ * Currently we have document fields that match the query, but we
+ * need to return documents. The matchData and scores are combined
+ * from multiple fields belonging to the same document.
+ *
+ * Scores are calculated by field, using the query vectors created
+ * above, and combined into a final document score using addition.
+ */
+ var fieldRef = lunr.FieldRef.fromString(matchingFieldRefs[i]),
+ docRef = fieldRef.docRef
+
+ if (!allRequiredMatches.contains(docRef)) {
+ continue
+ }
+
+ if (allProhibitedMatches.contains(docRef)) {
+ continue
+ }
+
+ var fieldVector = this.fieldVectors[fieldRef],
+ score = queryVectors[fieldRef.fieldName].similarity(fieldVector),
+ docMatch
+
+ if ((docMatch = matches[docRef]) !== undefined) {
+ docMatch.score += score
+ docMatch.matchData.combine(matchingFields[fieldRef])
+ } else {
+ var match = {
+ ref: docRef,
+ score: score,
+ matchData: matchingFields[fieldRef]
+ }
+ matches[docRef] = match
+ results.push(match)
+ }
+ }
+
+ /*
+ * Sort the results objects by score, highest first.
+ */
+ return results.sort(function (a, b) {
+ return b.score - a.score
+ })
+}
+
+/**
+ * Prepares the index for JSON serialization.
+ *
+ * The schema for this JSON blob will be described in a
+ * separate JSON schema file.
+ *
+ * @returns {Object}
+ */
+lunr.Index.prototype.toJSON = function () {
+ var invertedIndex = Object.keys(this.invertedIndex)
+ .sort()
+ .map(function (term) {
+ return [term, this.invertedIndex[term]]
+ }, this)
+
+ var fieldVectors = Object.keys(this.fieldVectors)
+ .map(function (ref) {
+ return [ref, this.fieldVectors[ref].toJSON()]
+ }, this)
+
+ return {
+ version: lunr.version,
+ fields: this.fields,
+ fieldVectors: fieldVectors,
+ invertedIndex: invertedIndex,
+ pipeline: this.pipeline.toJSON()
+ }
+}
+
+/**
+ * Loads a previously serialized lunr.Index
+ *
+ * @param {Object} serializedIndex - A previously serialized lunr.Index
+ * @returns {lunr.Index}
+ */
+lunr.Index.load = function (serializedIndex) {
+ var attrs = {},
+ fieldVectors = {},
+ serializedVectors = serializedIndex.fieldVectors,
+ invertedIndex = Object.create(null),
+ serializedInvertedIndex = serializedIndex.invertedIndex,
+ tokenSetBuilder = new lunr.TokenSet.Builder,
+ pipeline = lunr.Pipeline.load(serializedIndex.pipeline)
+
+ if (serializedIndex.version != lunr.version) {
+ lunr.utils.warn("Version mismatch when loading serialised index. Current version of lunr '" + lunr.version + "' does not match serialized index '" + serializedIndex.version + "'")
+ }
+
+ for (var i = 0; i < serializedVectors.length; i++) {
+ var tuple = serializedVectors[i],
+ ref = tuple[0],
+ elements = tuple[1]
+
+ fieldVectors[ref] = new lunr.Vector(elements)
+ }
+
+ for (var i = 0; i < serializedInvertedIndex.length; i++) {
+ var tuple = serializedInvertedIndex[i],
+ term = tuple[0],
+ posting = tuple[1]
+
+ tokenSetBuilder.insert(term)
+ invertedIndex[term] = posting
+ }
+
+ tokenSetBuilder.finish()
+
+ attrs.fields = serializedIndex.fields
+
+ attrs.fieldVectors = fieldVectors
+ attrs.invertedIndex = invertedIndex
+ attrs.tokenSet = tokenSetBuilder.root
+ attrs.pipeline = pipeline
+
+ return new lunr.Index(attrs)
+}
+/*!
+ * lunr.Builder
+ * Copyright (C) 2019 Oliver Nightingale
+ */
+
+/**
+ * lunr.Builder performs indexing on a set of documents and
+ * returns instances of lunr.Index ready for querying.
+ *
+ * All configuration of the index is done via the builder, the
+ * fields to index, the document reference, the text processing
+ * pipeline and document scoring parameters are all set on the
+ * builder before indexing.
+ *
+ * @constructor
+ * @property {string} _ref - Internal reference to the document reference field.
+ * @property {string[]} _fields - Internal reference to the document fields to index.
+ * @property {object} invertedIndex - The inverted index maps terms to document fields.
+ * @property {object} documentTermFrequencies - Keeps track of document term frequencies.
+ * @property {object} documentLengths - Keeps track of the length of documents added to the index.
+ * @property {lunr.tokenizer} tokenizer - Function for splitting strings into tokens for indexing.
+ * @property {lunr.Pipeline} pipeline - The pipeline performs text processing on tokens before indexing.
+ * @property {lunr.Pipeline} searchPipeline - A pipeline for processing search terms before querying the index.
+ * @property {number} documentCount - Keeps track of the total number of documents indexed.
+ * @property {number} _b - A parameter to control field length normalization, setting this to 0 disabled normalization, 1 fully normalizes field lengths, the default value is 0.75.
+ * @property {number} _k1 - A parameter to control how quickly an increase in term frequency results in term frequency saturation, the default value is 1.2.
+ * @property {number} termIndex - A counter incremented for each unique term, used to identify a terms position in the vector space.
+ * @property {array} metadataWhitelist - A list of metadata keys that have been whitelisted for entry in the index.
+ */
+lunr.Builder = function () {
+ this._ref = "id"
+ this._fields = Object.create(null)
+ this._documents = Object.create(null)
+ this.invertedIndex = Object.create(null)
+ this.fieldTermFrequencies = {}
+ this.fieldLengths = {}
+ this.tokenizer = lunr.tokenizer
+ this.pipeline = new lunr.Pipeline
+ this.searchPipeline = new lunr.Pipeline
+ this.documentCount = 0
+ this._b = 0.75
+ this._k1 = 1.2
+ this.termIndex = 0
+ this.metadataWhitelist = []
+}
+
+/**
+ * Sets the document field used as the document reference. Every document must have this field.
+ * The type of this field in the document should be a string, if it is not a string it will be
+ * coerced into a string by calling toString.
+ *
+ * The default ref is 'id'.
+ *
+ * The ref should _not_ be changed during indexing, it should be set before any documents are
+ * added to the index. Changing it during indexing can lead to inconsistent results.
+ *
+ * @param {string} ref - The name of the reference field in the document.
+ */
+lunr.Builder.prototype.ref = function (ref) {
+ this._ref = ref
+}
+
+/**
+ * A function that is used to extract a field from a document.
+ *
+ * Lunr expects a field to be at the top level of a document, if however the field
+ * is deeply nested within a document an extractor function can be used to extract
+ * the right field for indexing.
+ *
+ * @callback fieldExtractor
+ * @param {object} doc - The document being added to the index.
+ * @returns {?(string|object|object[])} obj - The object that will be indexed for this field.
+ * @example
Extracting a nested field
+ * function (doc) { return doc.nested.field }
+ */
+
+/**
+ * Adds a field to the list of document fields that will be indexed. Every document being
+ * indexed should have this field. Null values for this field in indexed documents will
+ * not cause errors but will limit the chance of that document being retrieved by searches.
+ *
+ * All fields should be added before adding documents to the index. Adding fields after
+ * a document has been indexed will have no effect on already indexed documents.
+ *
+ * Fields can be boosted at build time. This allows terms within that field to have more
+ * importance when ranking search results. Use a field boost to specify that matches within
+ * one field are more important than other fields.
+ *
+ * @param {string} fieldName - The name of a field to index in all documents.
+ * @param {object} attributes - Optional attributes associated with this field.
+ * @param {number} [attributes.boost=1] - Boost applied to all terms within this field.
+ * @param {fieldExtractor} [attributes.extractor] - Function to extract a field from a document.
+ * @throws {RangeError} fieldName cannot contain unsupported characters '/'
+ */
+lunr.Builder.prototype.field = function (fieldName, attributes) {
+ if (/\//.test(fieldName)) {
+ throw new RangeError ("Field '" + fieldName + "' contains illegal character '/'")
+ }
+
+ this._fields[fieldName] = attributes || {}
+}
+
+/**
+ * A parameter to tune the amount of field length normalisation that is applied when
+ * calculating relevance scores. A value of 0 will completely disable any normalisation
+ * and a value of 1 will fully normalise field lengths. The default is 0.75. Values of b
+ * will be clamped to the range 0 - 1.
+ *
+ * @param {number} number - The value to set for this tuning parameter.
+ */
+lunr.Builder.prototype.b = function (number) {
+ if (number < 0) {
+ this._b = 0
+ } else if (number > 1) {
+ this._b = 1
+ } else {
+ this._b = number
+ }
+}
+
+/**
+ * A parameter that controls the speed at which a rise in term frequency results in term
+ * frequency saturation. The default value is 1.2. Setting this to a higher value will give
+ * slower saturation levels, a lower value will result in quicker saturation.
+ *
+ * @param {number} number - The value to set for this tuning parameter.
+ */
+lunr.Builder.prototype.k1 = function (number) {
+ this._k1 = number
+}
+
+/**
+ * Adds a document to the index.
+ *
+ * Before adding fields to the index the index should have been fully setup, with the document
+ * ref and all fields to index already having been specified.
+ *
+ * The document must have a field name as specified by the ref (by default this is 'id') and
+ * it should have all fields defined for indexing, though null or undefined values will not
+ * cause errors.
+ *
+ * Entire documents can be boosted at build time. Applying a boost to a document indicates that
+ * this document should rank higher in search results than other documents.
+ *
+ * @param {object} doc - The document to add to the index.
+ * @param {object} attributes - Optional attributes associated with this document.
+ * @param {number} [attributes.boost=1] - Boost applied to all terms within this document.
+ */
+lunr.Builder.prototype.add = function (doc, attributes) {
+ var docRef = doc[this._ref],
+ fields = Object.keys(this._fields)
+
+ this._documents[docRef] = attributes || {}
+ this.documentCount += 1
+
+ for (var i = 0; i < fields.length; i++) {
+ var fieldName = fields[i],
+ extractor = this._fields[fieldName].extractor,
+ field = extractor ? extractor(doc) : doc[fieldName],
+ tokens = this.tokenizer(field, {
+ fields: [fieldName]
+ }),
+ terms = this.pipeline.run(tokens),
+ fieldRef = new lunr.FieldRef (docRef, fieldName),
+ fieldTerms = Object.create(null)
+
+ this.fieldTermFrequencies[fieldRef] = fieldTerms
+ this.fieldLengths[fieldRef] = 0
+
+ // store the length of this field for this document
+ this.fieldLengths[fieldRef] += terms.length
+
+ // calculate term frequencies for this field
+ for (var j = 0; j < terms.length; j++) {
+ var term = terms[j]
+
+ if (fieldTerms[term] == undefined) {
+ fieldTerms[term] = 0
+ }
+
+ fieldTerms[term] += 1
+
+ // add to inverted index
+ // create an initial posting if one doesn't exist
+ if (this.invertedIndex[term] == undefined) {
+ var posting = Object.create(null)
+ posting["_index"] = this.termIndex
+ this.termIndex += 1
+
+ for (var k = 0; k < fields.length; k++) {
+ posting[fields[k]] = Object.create(null)
+ }
+
+ this.invertedIndex[term] = posting
+ }
+
+ // add an entry for this term/fieldName/docRef to the invertedIndex
+ if (this.invertedIndex[term][fieldName][docRef] == undefined) {
+ this.invertedIndex[term][fieldName][docRef] = Object.create(null)
+ }
+
+ // store all whitelisted metadata about this token in the
+ // inverted index
+ for (var l = 0; l < this.metadataWhitelist.length; l++) {
+ var metadataKey = this.metadataWhitelist[l],
+ metadata = term.metadata[metadataKey]
+
+ if (this.invertedIndex[term][fieldName][docRef][metadataKey] == undefined) {
+ this.invertedIndex[term][fieldName][docRef][metadataKey] = []
+ }
+
+ this.invertedIndex[term][fieldName][docRef][metadataKey].push(metadata)
+ }
+ }
+
+ }
+}
+
+/**
+ * Calculates the average document length for this index
+ *
+ * @private
+ */
+lunr.Builder.prototype.calculateAverageFieldLengths = function () {
+
+ var fieldRefs = Object.keys(this.fieldLengths),
+ numberOfFields = fieldRefs.length,
+ accumulator = {},
+ documentsWithField = {}
+
+ for (var i = 0; i < numberOfFields; i++) {
+ var fieldRef = lunr.FieldRef.fromString(fieldRefs[i]),
+ field = fieldRef.fieldName
+
+ documentsWithField[field] || (documentsWithField[field] = 0)
+ documentsWithField[field] += 1
+
+ accumulator[field] || (accumulator[field] = 0)
+ accumulator[field] += this.fieldLengths[fieldRef]
+ }
+
+ var fields = Object.keys(this._fields)
+
+ for (var i = 0; i < fields.length; i++) {
+ var fieldName = fields[i]
+ accumulator[fieldName] = accumulator[fieldName] / documentsWithField[fieldName]
+ }
+
+ this.averageFieldLength = accumulator
+}
+
+/**
+ * Builds a vector space model of every document using lunr.Vector
+ *
+ * @private
+ */
+lunr.Builder.prototype.createFieldVectors = function () {
+ var fieldVectors = {},
+ fieldRefs = Object.keys(this.fieldTermFrequencies),
+ fieldRefsLength = fieldRefs.length,
+ termIdfCache = Object.create(null)
+
+ for (var i = 0; i < fieldRefsLength; i++) {
+ var fieldRef = lunr.FieldRef.fromString(fieldRefs[i]),
+ fieldName = fieldRef.fieldName,
+ fieldLength = this.fieldLengths[fieldRef],
+ fieldVector = new lunr.Vector,
+ termFrequencies = this.fieldTermFrequencies[fieldRef],
+ terms = Object.keys(termFrequencies),
+ termsLength = terms.length
+
+
+ var fieldBoost = this._fields[fieldName].boost || 1,
+ docBoost = this._documents[fieldRef.docRef].boost || 1
+
+ for (var j = 0; j < termsLength; j++) {
+ var term = terms[j],
+ tf = termFrequencies[term],
+ termIndex = this.invertedIndex[term]._index,
+ idf, score, scoreWithPrecision
+
+ if (termIdfCache[term] === undefined) {
+ idf = lunr.idf(this.invertedIndex[term], this.documentCount)
+ termIdfCache[term] = idf
+ } else {
+ idf = termIdfCache[term]
+ }
+
+ score = idf * ((this._k1 + 1) * tf) / (this._k1 * (1 - this._b + this._b * (fieldLength / this.averageFieldLength[fieldName])) + tf)
+ score *= fieldBoost
+ score *= docBoost
+ scoreWithPrecision = Math.round(score * 1000) / 1000
+ // Converts 1.23456789 to 1.234.
+ // Reducing the precision so that the vectors take up less
+ // space when serialised. Doing it now so that they behave
+ // the same before and after serialisation. Also, this is
+ // the fastest approach to reducing a number's precision in
+ // JavaScript.
+
+ fieldVector.insert(termIndex, scoreWithPrecision)
+ }
+
+ fieldVectors[fieldRef] = fieldVector
+ }
+
+ this.fieldVectors = fieldVectors
+}
+
+/**
+ * Creates a token set of all tokens in the index using lunr.TokenSet
+ *
+ * @private
+ */
+lunr.Builder.prototype.createTokenSet = function () {
+ this.tokenSet = lunr.TokenSet.fromArray(
+ Object.keys(this.invertedIndex).sort()
+ )
+}
+
+/**
+ * Builds the index, creating an instance of lunr.Index.
+ *
+ * This completes the indexing process and should only be called
+ * once all documents have been added to the index.
+ *
+ * @returns {lunr.Index}
+ */
+lunr.Builder.prototype.build = function () {
+ this.calculateAverageFieldLengths()
+ this.createFieldVectors()
+ this.createTokenSet()
+
+ return new lunr.Index({
+ invertedIndex: this.invertedIndex,
+ fieldVectors: this.fieldVectors,
+ tokenSet: this.tokenSet,
+ fields: Object.keys(this._fields),
+ pipeline: this.searchPipeline
+ })
+}
+
+/**
+ * Applies a plugin to the index builder.
+ *
+ * A plugin is a function that is called with the index builder as its context.
+ * Plugins can be used to customise or extend the behaviour of the index
+ * in some way. A plugin is just a function, that encapsulated the custom
+ * behaviour that should be applied when building the index.
+ *
+ * The plugin function will be called with the index builder as its argument, additional
+ * arguments can also be passed when calling use. The function will be called
+ * with the index builder as its context.
+ *
+ * @param {Function} plugin The plugin to apply.
+ */
+lunr.Builder.prototype.use = function (fn) {
+ var args = Array.prototype.slice.call(arguments, 1)
+ args.unshift(this)
+ fn.apply(this, args)
+}
+/**
+ * Contains and collects metadata about a matching document.
+ * A single instance of lunr.MatchData is returned as part of every
+ * lunr.Index~Result.
+ *
+ * @constructor
+ * @param {string} term - The term this match data is associated with
+ * @param {string} field - The field in which the term was found
+ * @param {object} metadata - The metadata recorded about this term in this field
+ * @property {object} metadata - A cloned collection of metadata associated with this document.
+ * @see {@link lunr.Index~Result}
+ */
+lunr.MatchData = function (term, field, metadata) {
+ var clonedMetadata = Object.create(null),
+ metadataKeys = Object.keys(metadata || {})
+
+ // Cloning the metadata to prevent the original
+ // being mutated during match data combination.
+ // Metadata is kept in an array within the inverted
+ // index so cloning the data can be done with
+ // Array#slice
+ for (var i = 0; i < metadataKeys.length; i++) {
+ var key = metadataKeys[i]
+ clonedMetadata[key] = metadata[key].slice()
+ }
+
+ this.metadata = Object.create(null)
+
+ if (term !== undefined) {
+ this.metadata[term] = Object.create(null)
+ this.metadata[term][field] = clonedMetadata
+ }
+}
+
+/**
+ * An instance of lunr.MatchData will be created for every term that matches a
+ * document. However only one instance is required in a lunr.Index~Result. This
+ * method combines metadata from another instance of lunr.MatchData with this
+ * objects metadata.
+ *
+ * @param {lunr.MatchData} otherMatchData - Another instance of match data to merge with this one.
+ * @see {@link lunr.Index~Result}
+ */
+lunr.MatchData.prototype.combine = function (otherMatchData) {
+ var terms = Object.keys(otherMatchData.metadata)
+
+ for (var i = 0; i < terms.length; i++) {
+ var term = terms[i],
+ fields = Object.keys(otherMatchData.metadata[term])
+
+ if (this.metadata[term] == undefined) {
+ this.metadata[term] = Object.create(null)
+ }
+
+ for (var j = 0; j < fields.length; j++) {
+ var field = fields[j],
+ keys = Object.keys(otherMatchData.metadata[term][field])
+
+ if (this.metadata[term][field] == undefined) {
+ this.metadata[term][field] = Object.create(null)
+ }
+
+ for (var k = 0; k < keys.length; k++) {
+ var key = keys[k]
+
+ if (this.metadata[term][field][key] == undefined) {
+ this.metadata[term][field][key] = otherMatchData.metadata[term][field][key]
+ } else {
+ this.metadata[term][field][key] = this.metadata[term][field][key].concat(otherMatchData.metadata[term][field][key])
+ }
+
+ }
+ }
+ }
+}
+
+/**
+ * Add metadata for a term/field pair to this instance of match data.
+ *
+ * @param {string} term - The term this match data is associated with
+ * @param {string} field - The field in which the term was found
+ * @param {object} metadata - The metadata recorded about this term in this field
+ */
+lunr.MatchData.prototype.add = function (term, field, metadata) {
+ if (!(term in this.metadata)) {
+ this.metadata[term] = Object.create(null)
+ this.metadata[term][field] = metadata
+ return
+ }
+
+ if (!(field in this.metadata[term])) {
+ this.metadata[term][field] = metadata
+ return
+ }
+
+ var metadataKeys = Object.keys(metadata)
+
+ for (var i = 0; i < metadataKeys.length; i++) {
+ var key = metadataKeys[i]
+
+ if (key in this.metadata[term][field]) {
+ this.metadata[term][field][key] = this.metadata[term][field][key].concat(metadata[key])
+ } else {
+ this.metadata[term][field][key] = metadata[key]
+ }
+ }
+}
+/**
+ * A lunr.Query provides a programmatic way of defining queries to be performed
+ * against a {@link lunr.Index}.
+ *
+ * Prefer constructing a lunr.Query using the {@link lunr.Index#query} method
+ * so the query object is pre-initialized with the right index fields.
+ *
+ * @constructor
+ * @property {lunr.Query~Clause[]} clauses - An array of query clauses.
+ * @property {string[]} allFields - An array of all available fields in a lunr.Index.
+ */
+lunr.Query = function (allFields) {
+ this.clauses = []
+ this.allFields = allFields
+}
+
+/**
+ * Constants for indicating what kind of automatic wildcard insertion will be used when constructing a query clause.
+ *
+ * This allows wildcards to be added to the beginning and end of a term without having to manually do any string
+ * concatenation.
+ *
+ * The wildcard constants can be bitwise combined to select both leading and trailing wildcards.
+ *
+ * @constant
+ * @default
+ * @property {number} wildcard.NONE - The term will have no wildcards inserted, this is the default behaviour
+ * @property {number} wildcard.LEADING - Prepend the term with a wildcard, unless a leading wildcard already exists
+ * @property {number} wildcard.TRAILING - Append a wildcard to the term, unless a trailing wildcard already exists
+ * @see lunr.Query~Clause
+ * @see lunr.Query#clause
+ * @see lunr.Query#term
+ * @example
+ * query.term('foo', {
+ * wildcard: lunr.Query.wildcard.LEADING | lunr.Query.wildcard.TRAILING
+ * })
+ */
+
+lunr.Query.wildcard = new String ("*")
+lunr.Query.wildcard.NONE = 0
+lunr.Query.wildcard.LEADING = 1
+lunr.Query.wildcard.TRAILING = 2
+
+/**
+ * Constants for indicating what kind of presence a term must have in matching documents.
+ *
+ * @constant
+ * @enum {number}
+ * @see lunr.Query~Clause
+ * @see lunr.Query#clause
+ * @see lunr.Query#term
+ * @example
query term with required presence
+ * query.term('foo', { presence: lunr.Query.presence.REQUIRED })
+ */
+lunr.Query.presence = {
+ /**
+ * Term's presence in a document is optional, this is the default value.
+ */
+ OPTIONAL: 1,
+
+ /**
+ * Term's presence in a document is required, documents that do not contain
+ * this term will not be returned.
+ */
+ REQUIRED: 2,
+
+ /**
+ * Term's presence in a document is prohibited, documents that do contain
+ * this term will not be returned.
+ */
+ PROHIBITED: 3
+}
+
+/**
+ * A single clause in a {@link lunr.Query} contains a term and details on how to
+ * match that term against a {@link lunr.Index}.
+ *
+ * @typedef {Object} lunr.Query~Clause
+ * @property {string[]} fields - The fields in an index this clause should be matched against.
+ * @property {number} [boost=1] - Any boost that should be applied when matching this clause.
+ * @property {number} [editDistance] - Whether the term should have fuzzy matching applied, and how fuzzy the match should be.
+ * @property {boolean} [usePipeline] - Whether the term should be passed through the search pipeline.
+ * @property {number} [wildcard=lunr.Query.wildcard.NONE] - Whether the term should have wildcards appended or prepended.
+ * @property {number} [presence=lunr.Query.presence.OPTIONAL] - The terms presence in any matching documents.
+ */
+
+/**
+ * Adds a {@link lunr.Query~Clause} to this query.
+ *
+ * Unless the clause contains the fields to be matched all fields will be matched. In addition
+ * a default boost of 1 is applied to the clause.
+ *
+ * @param {lunr.Query~Clause} clause - The clause to add to this query.
+ * @see lunr.Query~Clause
+ * @returns {lunr.Query}
+ */
+lunr.Query.prototype.clause = function (clause) {
+ if (!('fields' in clause)) {
+ clause.fields = this.allFields
+ }
+
+ if (!('boost' in clause)) {
+ clause.boost = 1
+ }
+
+ if (!('usePipeline' in clause)) {
+ clause.usePipeline = true
+ }
+
+ if (!('wildcard' in clause)) {
+ clause.wildcard = lunr.Query.wildcard.NONE
+ }
+
+ if ((clause.wildcard & lunr.Query.wildcard.LEADING) && (clause.term.charAt(0) != lunr.Query.wildcard)) {
+ clause.term = "*" + clause.term
+ }
+
+ if ((clause.wildcard & lunr.Query.wildcard.TRAILING) && (clause.term.slice(-1) != lunr.Query.wildcard)) {
+ clause.term = "" + clause.term + "*"
+ }
+
+ if (!('presence' in clause)) {
+ clause.presence = lunr.Query.presence.OPTIONAL
+ }
+
+ this.clauses.push(clause)
+
+ return this
+}
+
+/**
+ * A negated query is one in which every clause has a presence of
+ * prohibited. These queries require some special processing to return
+ * the expected results.
+ *
+ * @returns boolean
+ */
+lunr.Query.prototype.isNegated = function () {
+ for (var i = 0; i < this.clauses.length; i++) {
+ if (this.clauses[i].presence != lunr.Query.presence.PROHIBITED) {
+ return false
+ }
+ }
+
+ return true
+}
+
+/**
+ * Adds a term to the current query, under the covers this will create a {@link lunr.Query~Clause}
+ * to the list of clauses that make up this query.
+ *
+ * The term is used as is, i.e. no tokenization will be performed by this method. Instead conversion
+ * to a token or token-like string should be done before calling this method.
+ *
+ * The term will be converted to a string by calling `toString`. Multiple terms can be passed as an
+ * array, each term in the array will share the same options.
+ *
+ * @param {object|object[]} term - The term(s) to add to the query.
+ * @param {object} [options] - Any additional properties to add to the query clause.
+ * @returns {lunr.Query}
+ * @see lunr.Query#clause
+ * @see lunr.Query~Clause
+ * @example
adding a single term to a query
+ * query.term("foo")
+ * @example
adding a single term to a query and specifying search fields, term boost and automatic trailing wildcard
';
+}
+
+function displayResults (results) {
+ var search_results = document.getElementById("mkdocs-search-results");
+ while (search_results.firstChild) {
+ search_results.removeChild(search_results.firstChild);
+ }
+ if (results.length > 0){
+ for (var i=0; i < results.length; i++){
+ var result = results[i];
+ var html = formatResult(result.location, result.title, result.summary);
+ search_results.insertAdjacentHTML('beforeend', html);
+ }
+ } else {
+ search_results.insertAdjacentHTML('beforeend', "
No results found
");
+ }
+}
+
+function doSearch () {
+ var query = document.getElementById('mkdocs-search-query').value;
+ if (query.length > min_search_length) {
+ if (!window.Worker) {
+ displayResults(search(query));
+ } else {
+ searchWorker.postMessage({query: query});
+ }
+ } else {
+ // Clear results for short queries
+ displayResults([]);
+ }
+}
+
+function initSearch () {
+ var search_input = document.getElementById('mkdocs-search-query');
+ if (search_input) {
+ search_input.addEventListener("keyup", doSearch);
+ }
+ var term = getSearchTermFromLocation();
+ if (term) {
+ search_input.value = term;
+ doSearch();
+ }
+}
+
+function onWorkerMessage (e) {
+ if (e.data.allowSearch) {
+ initSearch();
+ } else if (e.data.results) {
+ var results = e.data.results;
+ displayResults(results);
+ } else if (e.data.config) {
+ min_search_length = e.data.config.min_search_length-1;
+ }
+}
+
+if (!window.Worker) {
+ console.log('Web Worker API not supported');
+ // load index in main thread
+ $.getScript(joinUrl(base_url, "search/worker.js")).done(function () {
+ console.log('Loaded worker');
+ init();
+ window.postMessage = function (msg) {
+ onWorkerMessage({data: msg});
+ };
+ }).fail(function (jqxhr, settings, exception) {
+ console.error('Could not load worker.js');
+ });
+} else {
+ // Wrap search in a web worker
+ var searchWorker = new Worker(joinUrl(base_url, "search/worker.js"));
+ searchWorker.postMessage({init: true});
+ searchWorker.onmessage = onWorkerMessage;
+}
diff --git a/docs/search/search_index.json b/docs/search/search_index.json
new file mode 100644
index 00000000..80c93481
--- /dev/null
+++ b/docs/search/search_index.json
@@ -0,0 +1 @@
+{"config":{"lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"Powerlevel10k Docs Powerlevel10k is a theme for Zsh. It emphasizes speed , flexibility and out-of-the-box experience . Get Started Impressed? Then get started . Drop a Message on Gitter Documentation Features Installation Configuration Fonts Try it in Docker FAQ Troubleshooting License Powerlevel10k is released under the MIT license .","title":"Home"},{"location":"#powerlevel10k-docs","text":"Powerlevel10k is a theme for Zsh. It emphasizes speed , flexibility and out-of-the-box experience .","title":"Powerlevel10k Docs"},{"location":"#get-started","text":"Impressed? Then get started .","title":"Get Started"},{"location":"#drop-a-message-on-gitter","text":"","title":"Drop a Message on Gitter"},{"location":"#documentation","text":"Features Installation Configuration Fonts Try it in Docker FAQ Troubleshooting","title":"Documentation"},{"location":"#license","text":"Powerlevel10k is released under the MIT license .","title":"License"},{"location":"configuration/","text":"Configuration For new users On the first run, Powerlevel10k configuration wizard will ask you a few questions and configure your prompt. If it doesn't trigger automatically, type p10k configure . Configuration wizard creates ~/.p10k.zsh based on your preferences. Additional prompt customization can be done by editing this file. It has plenty of comments to help you navigate through configuration options. FAQ : What is the best prompt style in the configuration wizard? What do different symbols in Git status mean? How do I change the format of Git status? How do I add username and/or hostname to prompt? How do I change prompt colors? Why some prompt segments appear and disappear as I'm typing? Troubleshooting : Question mark in prompt . Icons, glyphs or powerline symbols don't render . Sub-pixel imperfections around powerline symbols . Directory is difficult to see in prompt when using Rainbow style . For Powerlevel9k users If you've been using Powerlevel9k before, do not remove the configuration options . Powerlevel10k will pick them up and provide you with the same prompt UI you are used to. See Powerlevel9k compatibility . FAQ : I'm using Powerlevel9k with Oh My Zsh. How do I migrate? What is the relationship between Powerlevel9k and Powerlevel10k? Does Powerlevel10k always render exactly the same prompt as Powerlevel9k given the same config? Troubleshooting : Extra or missing spaces in prompt compared to Powerlevel9k .","title":"Configuration"},{"location":"configuration/#configuration","text":"","title":"Configuration"},{"location":"configuration/#for-new-users","text":"On the first run, Powerlevel10k configuration wizard will ask you a few questions and configure your prompt. If it doesn't trigger automatically, type p10k configure . Configuration wizard creates ~/.p10k.zsh based on your preferences. Additional prompt customization can be done by editing this file. It has plenty of comments to help you navigate through configuration options. FAQ : What is the best prompt style in the configuration wizard? What do different symbols in Git status mean? How do I change the format of Git status? How do I add username and/or hostname to prompt? How do I change prompt colors? Why some prompt segments appear and disappear as I'm typing? Troubleshooting : Question mark in prompt . Icons, glyphs or powerline symbols don't render . Sub-pixel imperfections around powerline symbols . Directory is difficult to see in prompt when using Rainbow style .","title":"For new users"},{"location":"configuration/#for-powerlevel9k-users","text":"If you've been using Powerlevel9k before, do not remove the configuration options . Powerlevel10k will pick them up and provide you with the same prompt UI you are used to. See Powerlevel9k compatibility . FAQ : I'm using Powerlevel9k with Oh My Zsh. How do I migrate? What is the relationship between Powerlevel9k and Powerlevel10k? Does Powerlevel10k always render exactly the same prompt as Powerlevel9k given the same config? Troubleshooting : Extra or missing spaces in prompt compared to Powerlevel9k .","title":"For Powerlevel9k users"},{"location":"faq/","text":"FAQ How do I update Powerlevel10k? The command to update Powerlevel10k depends on how it was installed. Installation Update command Manual git -C ~/powerlevel10k pull Oh My Zsh git -C ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k pull Prezto zprezto-update Zim zimfw update Antigen antigen update Zplug zplug update Zgen zgen update Zplugin zplugin update Zinit zinit update Homebrew brew update && brew upgrade Arch Linux yay -S --noconfirm zsh-theme-powerlevel10k-git IMPORTANT : Restart Zsh after updating Powerlevel10k. Do not use source ~/.zshrc . How do I uninstall Powerlevel10k? Remove all references to \"p10k\" from ~/.zshrc . You might have this snippet at the top: if [[ -r \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\" ]]; then source \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\" fi And this at the bottom: [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh These are added by the configuration wizard . Remove them. Remove all references to \"powerlevel10k\" from ~/.zshrc , ~/.zpreztorc and ~/.zimrc (some of these files may be missing -- this is normal). These references have been added manually by yourself when installing Powerlevel10k. Refer to the installation instructions if you need a reminder. Verify that all references to \"p10k\" and \"powerlevel10k\" are gone from ~/.zshrc , ~/.zpreztorc and ~/.zimrc . grep -E 'p10k|powerlevel10k' ~/.zshrc ~/.zpreztorc ~/.zimrc 2>/dev/null If this command produces output, there are still references to \"p10k\" or \"powerlevel10k\". You need to remove them. Delete Powerlevel10k configuration file. This file is created by the configuration wizard and may contain manual edits by yourself. rm -f ~/.p10k.zsh Delete Powerlevel10k source files. These files have been downloaded when you've installed Powerlevel10k. The command to delete them depends on which installation method you'd chosen. Refer to the installation instructions if you need a reminder. Installation Uninstall command Manual rm -rf ~/powerlevel10k Oh My Zsh rm -rf -- ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k Prezto n/a Zim zimfw uninstall Antigen antigen purge romkatv/powerlevel10k Zplug zplug clean Zgen zgen reset Zplugin zplugin delete romkatv/powerlevel10k Zinit zinit delete romkatv/powerlevel10k Homebrew brew uninstall powerlevel10k; brew untap romkatv/powerlevel10k Arch Linux yay -R --noconfirm zsh-theme-powerlevel10k-git Restart Zsh. Do not use source ~/.zshrc . How do I install Powerlevel10k on a machine without Internet access? Run this command on the machine without Internet access: uname -sm | tr '[A-Z]' '[a-z]' Run these commands on a machine connected to the Internet after replacing the value of target_uname with the output of the previous command: target_uname=\"replace this with the output of the previous command\" git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k GITSTATUS_CACHE_DIR=\"$HOME\"/powerlevel10k/gitstatus/usrbin ~/powerlevel10k/gitstatus/install -f -s \"${target_uname% *}\" -m \"${target_uname#* }\" Copy ~/powerlevel10k from the machine connected to the Internet to the one without Internet access. Add source ~/powerlevel10k/powerlevel10k.zsh-theme to ~/.zshrc on the machine without Internet access: echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc If ~/.zshrc on the machine without Internet access sets ZSH_THEME , remove that line. sed -i.bak '/^ZSH_THEME=/d' ~/.zshrc To update, remove ~/powerlevel10k on both machines and repeat steps 1-3. Where can I ask for help and report bugs? The best way to ask for help and to report bugs is to open an issue . Gitter is another option. If all else fails, email roman.perepelitsa@gmail.com. If necessary, encrypt your communication with this PGP key . Which aspects of shell and terminal does Powerlevel10k affect? Powerlevel10k defines prompt and nothing else. It sets prompt-related options , and parameters PS1 and RPS1 . Everything within the highlighted areas on the screenshot is produced by Powerlevel10k. Powerlevel10k has no control over the terminal content or colors outside these areas. Powerlevel10k does not affect: Terminal window/tab title. Colors used by ls . The behavior of git command. The content and style of Tab completions. Command line colors (syntax highlighting, autosuggestions, etc.). Key bindings. Aliases. Prompt parameters other than PS1 and RPS1 . Zsh options other than those related to prompt . I'm using Powerlevel9k with Oh My Zsh. How do I migrate? Run this command: # Add powerlevel10k to the list of Oh My Zsh themes. git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k # Replace ZSH_THEME=\"powerlevel9k/powerlevel9k\" with ZSH_THEME=\"powerlevel10k/powerlevel10k\". sed -i.bak 's/powerlevel9k/powerlevel10k/g' ~/.zshrc # Restart Zsh. exec zsh Optional but highly recommended: Install the recommended font . Type p10k configure and choose your favorite prompt style. Related: Powerlevel9k compatibility. Does Powerlevel10k always render exactly the same prompt as Powerlevel9k given the same config? Extra or missing spaces in prompt compared to Powerlevel9k. Configuration wizard. Is it really fast? Yes. Benchmark results obtained with zsh-prompt-benchmark on an Intel i9-7900X running Ubuntu 18.04 with the config from the demo. Theme Prompt Latency powerlevel9k/master 1046 ms powerlevel9k/next 1005 ms powerlevel10k 8.7 ms Powerlevel10k is over 100 times faster than Powerlevel9k in this benchmark. In fairness, Powerlevel9k has acceptable latency when given a spartan configuration. If all you need is the current directory without truncation or shortening, Powerlevel9k can render it for you in 17 ms. Powerlevel10k can do the same 30 times faster but it won't matter in practice because 17 ms is fast enough (the threshold where latency becomes noticeable is around 50 ms). You have to be careful with Powerlevel9k configuration as it's all too easy to make prompt frustratingly slow. Powerlevel10k, on the other hand, doesn't require trading latency for utility -- it's virtually instant with any configuration. It stays well below the 50 ms mark, leaving most of the latency budget for other plugins you might install. How do I enable instant prompt? See instant prompt to learn about instant prompt. This section explains how you can enable it and lists caveats that you should be aware of. Instant prompt can be enabled either through p10k configure or by manually adding the following code snippet at the top of ~/.zshrc : # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. # Initialization code that may require console input (password prompts, [y/n] # confirmations, etc.) must go above this block; everything else may go below. if [[ -r \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\" ]]; then source \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\" fi It's important that you copy the lines verbatim. Don't replace source with something else, don't call zcompile , don't redirect output, etc. When instant prompt is enabled, for the duration of Zsh initialization standard input is redirected to /dev/null and standard output with standard error are redirected to a temporary file. Once Zsh is fully initialized, standard file descriptors are restored and the content of the temporary file is printed out. When using instant prompt, you should carefully check any output that appears on Zsh startup as it may indicate that initialization has been altered, or perhaps even broken, by instant prompt. Initialization code that may require console input, such as asking for a keyring password or for a [y/n] confirmation, must be moved above the instant prompt preamble in ~/.zshrc . Initialization code that merely prints to console but never reads from it will work correctly with instant prompt, although output that normally has colors may appear uncolored. You can either leave it be, suppress the output, or move it above the instant prompt preamble. Here's an example of ~/.zshrc that breaks when instant prompt is enabled: if [[ -r \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\" ]]; then source \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\" fi keychain id_rsa --agents ssh # asks for password chatty-script # spams to stdout even when everything is fine # ... Fixed version: keychain id_rsa --agents ssh # moved before instant prompt # OK to perform console I/O before this point. if [[ -r \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\" ]]; then source \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\" fi # From this point on, until zsh is fully initialized, console input won't work and # console output may appear uncolored. chatty-script >/dev/null # spam output suppressed # ... If POWERLEVEL9K_INSTANT_PROMPT is unset or set to verbose , Powerlevel10k will print a warning when it detects console output during initialization to bring attention to potential issues. You can silence this warning (without suppressing console output) with POWERLEVEL9K_INSTANT_PROMPT=quiet . This is recommended if some initialization code in ~/.zshrc prints to console and it's infeasible to move it above the instant prompt preamble or to suppress its output. You can completely disable instant prompt with POWERLEVEL9K_INSTANT_PROMPT=off . Do this if instant prompt breaks Zsh initialization and you don't know how to fix it. Note : Instant prompt requires Zsh >= 5.4. It's OK to enable it even when using an older version of Zsh but it won't do anything. What do different symbols in Git status mean? When using Lean, Classic or Rainbow style, Git status may look like this: feature:master \u21e342\u21e142 \u21e042\u21e242 *42 merge ~42 +42 !42 ?42 Symbol Meaning Source feature current branch; replaced with #tag or @commit if not on a branch git status --ignore-submodules=dirty master remote tracking branch; only shown if different from local branch git rev-parse --abbrev-ref --symbolic-full-name @{u} \u21e342 this many commits behind the remote git status --ignore-submodules=dirty \u21e142 this many commits ahead of the remote git status --ignore-submodules=dirty \u21e042 this many commits behind the push remote git rev-list --left-right --count HEAD...@{push} \u21e242 this many commits ahead of the push remote git rev-list --left-right --count HEAD...@{push} *42 this many stashes git stash list merge repository state git status --ignore-submodules=dirty ~42 this many merge conflicts git status --ignore-submodules=dirty +42 this many staged changes git status --ignore-submodules=dirty !42 this many unstaged changes git status --ignore-submodules=dirty ?42 this many untracked files git status --ignore-submodules=dirty \u2500 the number of staged, unstaged or untracked files is unknown echo $POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY or git config --get bash.showDirtyState Related : How do I change the format of Git status? How do I change the format of Git status? To change the format of Git status, open ~/.p10k.zsh , search for my_git_formatter and edit its source code. Related : What do different symbols in Git status mean? Why is Git status from $HOME/.git not displayed in prompt? When using Lean, Classic or Rainbow style, ~/.p10k.zsh contains the following parameter: # Don't show Git status in prompt for repositories whose workdir matches this pattern. # For example, if set to '~', the Git repository at $HOME/.git will be ignored. # Multiple patterns can be combined with '|': '~(|/foo)|/bar/baz/*'. typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~' To see Git status for $HOME/.git in prompt, open ~/.p10k.zsh and remove POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN . Why does Git status sometimes appear grey and then gets colored after a short period of time? tl;dr: When Git status in prompt is greyed out, it means Powerlevel10k is currently computing up-to-date Git status in the background. Prompt will get automatically refreshed when this computation completes. When your current directory is within a Git repository, Powerlevel10k computes up-to-date Git status after every command. If the repository is large, or the machine is slow, this computation can take quite a bit of time. If it takes longer than 20 milliseconds (configurable via POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS ), Powerlevel10k displays the last known Git status in grey and continues to compute up-to-date Git status in the background. When the computation completes, Powerlevel10k refreshes prompt with new information, this time with colored Git status. How do I add username and/or hostname to prompt? When using Lean, Classic or Rainbow style, prompt shows username@hostname when you are logged in as root or via SSH. There is little value in showing username or hostname when you are logged in to your local machine as a normal user. So the absence of username@hostname in your prompt is an indication that you are working locally and that you aren't root. You can change it, however. Open ~/.p10k.zsh . Close to the top you can see the most important parameters that define which segments are shown in your prompt. All generally useful prompt segments are listed in there. Some of them are enabled, others are commented out. One of them is of interest to you. typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( ... context # user@hostname ... ) Search for context to find the section in the config that lists parameters specific to this prompt segment. You should see the following lines: # Don't show context unless running with privileges or in SSH. # Tip: Remove the next line to always show context. typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION= If you follow the tip and remove (or comment out) the last line, you'll always see username@hostname in prompt. You can change the format to just username , or change the color, by adjusting the values of parameters nearby. There are plenty of comments to help you navigate. You can also move context to a different position in POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS or even to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS . Why some prompt segments appear and disappear as I'm typing? Prompt segments can be configured to be shown only when the current command you are typing invokes a relevant tool. # Show prompt segment \"kubecontext\" only when the command you are typing # invokes kubectl, helm, kubens, kubectx, oc, istioctl, kogito, k9s or helmfile. typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile' Configs created by p10k configure may contain parameters of this kind. To customize when different prompt segments are shown, open ~/.p10k.zsh , search for SHOW_ON_COMMAND and either remove these parameters or change their values. You can also define a function in ~/.zshrc to toggle the display of a prompt segment between always and on command . This is similar to kubeon / kubeoff from kube-ps1 . function kube-toggle() { if (( ${+POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND} )); then unset POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND else POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile' fi p10k reload if zle; then zle push-input zle accept-line fi } Invoke this function by typing kube-toggle . You can also bind it to a key by adding two more lines to ~/.zshrc : zle -N kube-toggle bindkey '^]' kube-toggle # ctrl-] to toggle kubecontext in powerlevel10k prompt How do I change prompt colors? You can either change the color palette used by your terminal or set colors through Powerlevel10k configuration parameters . Change the color palette used by your terminal How exactly you change the terminal color palette (a.k.a. color scheme, or theme) depends on the kind of terminal you are using. Look around in terminal's settings/preferences or consult documentation. When you change the terminal color palette, it usually affects only the first 16 colors, numbered from 0 to 15. In order to see any effect on Powerlevel10k prompt, you need to use prompt style that utilizes these low-numbered colors. Type p10k configure and select Rainbow , Lean \u2192 8 colors or Pure \u2192 Original . Other styles use higher-numbered colors, so they look the same in any terminal color palette. Set colors through Powerlevel10k configuration parameters Open ~/.p10k.zsh , search for \"color\", \"foreground\" and \"background\" and change values of appropriate parameters. For example, here's how you can set the foreground of time prompt segment to bright red: typeset -g POWERLEVEL9K_TIME_FOREGROUND=160 Colors are specified using numbers from 0 to 255. Colors from 0 to 15 look differently in different terminals. Many terminals also support customization of these colors through color palettes (a.k.a. color schemes, or themes). Colors from 16 to 255 always look the same. Type source ~/.p10k.zsh to apply your changes to the current Zsh session. To see how different colors look in your terminal, run the following command: for i in {0..255}; do print -Pn \"%K{$i} %k%F{$i}${(l:3::0:)i}%f \" ${${(M)$((i%6)):#3}:+$'\\n'}; done Why does Powerlevel10k spawn extra processes? Powerlevel10k uses gitstatus as the backend behind vcs prompt; gitstatus spawns gitstatusd and zsh . See gitstatus for details. Powerlevel10k may also spawn zsh to perform computation without blocking prompt. To avoid security hazard, these background processes aren't shared by different interactive shells. They terminate automatically when the parent zsh process terminates or runs exec(3) . Are there configuration options that make Powerlevel10k slow? No, Powerlevel10k is always fast, with any configuration you throw at it. If you have noticeable prompt latency when using Powerlevel10k, please open an issue . Is Powerlevel10k fast to load? Yes, provided that you are using Zsh >= 5.4. Loading time, or time to first prompt, can be measured with the following benchmark: time (repeat 1000 zsh -dfis <<< 'source ~/powerlevel10k/powerlevel10k.zsh-theme') Note: This measures time to first complete prompt. Powerlevel10k can also display a limited prompt before the full-featured prompt is ready. Running this command with ~/powerlevel10k as the current directory on the same machine as in the prompt benchmark takes 29 seconds (29 ms per invocation). This is about 6 times faster than powerlevel9k/master and 17 times faster than powerlevel9k/next. What is the relationship between Powerlevel9k and Powerlevel10k? Powerlevel10k was forked from Powerlevel9k in March 2019 after a week-long discussion in powerlevel9k#1170 . Powerlevel9k was already a mature project with large user base and release cycle measured in months. Powerlevel10k was spun off to iterate on performance improvements and new features at much higher pace. Powerlevel9k and Powerlevel10k are independent projects. When using one, you shouldn't install the other. Issues should be filed against the project that you actually use. There are no individuals that have commit rights in both repositories. All bug fixes and new features committed to Powerlevel9k repository get ported to Powerlevel10k. Over time, virtually all code in Powerlevel10k has been rewritten. There is currently no meaningful overlap between the implementations of Powerlevel9k and Powerlevel10k. Powerlevel10k is committed to maintaining backward compatibility with all configs indefinitely. This commitment covers all configuration parameters recognized by Powerlevel9k (see Powerlevel9k compatibility ) and additional parameters that only Powerlevel10k understands. Names of all parameters in Powerlevel10k start with POWERLEVEL9K_ for consistency. Does Powerlevel10k always render exactly the same prompt as Powerlevel9k given the same config? Almost. There are a few differences. By default only git vcs backend is enabled in Powerlevel10k. If you need svn and hg , add them to POWERLEVEL9K_VCS_BACKENDS . These backends aren't yet optimized in Powerlevel10k, so enabling them will make prompt very slow . Powerlevel10k doesn't support POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY=true . Powerlevel10k strives to be bug-compatible with Powerlevel9k but not when it comes to egregious bugs. If you accidentally rely on these bugs, your prompt will differ between Powerlevel9k and Powerlevel10k. Some examples: Powerlevel9k ignores some options that are set after the theme is sourced while Powerlevel10k respects all options. If you see different icons in Powerlevel9k and Powerlevel10k, you've probably defined POWERLEVEL9K_MODE before sourcing the theme. This parameter gets ignored by Powerlevel9k but honored by Powerlevel10k. If you want your prompt to look in Powerlevel10k the same as in Powerlevel9k, remove POWERLEVEL9K_MODE . Powerlevel9k doesn't respect ZLE_RPROMPT_INDENT . As a result, right prompt in Powerlevel10k can have an extra space at the end compared to Powerlevel9k. Set ZLE_RPROMPT_INDENT=0 if you don't want that space. More details in troubleshooting . Powerlevel9k has inconsistent spacing around icons. This was fixed in Powerlevel10k. Set POWERLEVEL9K_LEGACY_ICON_SPACING=true to get the same spacing as in Powerlevel9k. More details in troubleshooting . There are dozens more bugs in Powerlevel9k that don't exist in Powerlevel10k. If you notice any other changes in prompt appearance when switching from Powerlevel9k to Powerlevel10k, please open an issue . What is the best prompt style in the configuration wizard? There are as many opinions on what constitutes the best prompt as there are people. It mostly comes down to personal preference. There are, however, a few hidden implications of different choices. Pure style is an exact replication of Pure Zsh theme . It exists to ease the migration for users of this theme. Unless you are one of them, choose Lean style over Pure. If you want to confine prompt colors to the selected terminal color palette (say, Solarized Dark ), use Rainbow , Lean \u2192 8 colors or Pure \u2192 Original . Other styles use fixed colors and thus look the same in any terminal color palette. All styles except Pure have an option to use ASCII charset. Prompt will look less pretty but will render correctly with all fonts and in all locales. If you enable transient prompt, take advantage of two-line prompt. You'll get the benefit of extra space for typing commands without the usual drawback of reduced scrollback density. Having all commands start from the same offset is also nice. Similarly, if you enable transient prompt, sparse prompt (with an empty line before prompt) is a great choice. If you are using vi keymap, choose prompt with prompt_char in it (shown as green \u276f in the wizard). This symbol changes depending on vi mode: \u276f , \u276e , V , \u25b6 for insert, command, visual and replace mode respectively. When a command fails, the symbol turns red. Lean style always has prompt_char in it. Rainbow and Classic styles have it only in the two-line configuration without left frame. If you value horizontal space or prefer minimalist aesthetics: Use a monospace font, such as the recommended font . Non-monospace fonts require extra space after icons that are larger than a single column. Use Lean style. Compared to Classic and Rainbow, it saves two characters per prompt segment. Disable current time and frame . Use few icons . The extra icons enabled by the many icons option primarily serve decorative function. Informative icons, such as background job indicator, will be shown either way. Note : You can run configuration wizard as many times as you like. Type p10k configure to try new prompt style. How to make Powerlevel10k look like robbyrussell Oh My Zsh theme? Use this config . You can either download it, save as ~/.p10k.zsh and source ~/.p10k.zsh from ~/.zshrc , or source p10k-robbyrussell.zsh directly from your cloned powerlevel10k repository. Can prompts for completed commands display error status for those commands instead of the commands preceding them? No. When you hit ENTER and the command you've typed starts running, its error status isn't yet known, so it cannot be shown in prompt. When the command completes, the error status gets known but it's no longer possible to update prompt for that command. This is why the error status for every command is reflected in the next prompt. For details, see this post on /r/zsh . What is the minimum supported Zsh version? Zsh 5.1 or newer should work. Fast startup requires Zsh >= 5.4. How were these screenshots and animated gifs created? All screenshots and animated gifs were recorded in GNOME Terminal with the recommended font and Tango Dark color palette with custom background color ( #171A1B instead of #2E3436 -- twice as dark). Syntax highlighting, where present, was provided by zsh-syntax-highlighting . How was the recommended font created? The recommended font is the product of many individuals. Its origin is Bitstream Vera Sans Mono , which has given birth to Menlo , which in turn has spawned Meslo . Finally, extra glyphs have been added to Meslo with scripts forked from Nerd Fonts. The final font is released under the terms of Apache License . MesloLGS NF font can be recreated with the following command (requires git and docker ): git clone --depth=1 https://github.com/romkatv/nerd-fonts.git cd nerd-fonts ./build 'Meslo/S/*' If everything goes well, four ttf files will appear in ./out . How to package Powerlevel10k for distribution? It's currently neither easy nor recommended to package and distribute Powerlevel10k. There are no instructions you can follow that would allow you to easily update your package when new versions of Powerlevel10k are released. This may change in the future but not soon.","title":"FAQ"},{"location":"faq/#faq","text":"","title":"FAQ"},{"location":"faq/#how-do-i-update-powerlevel10k","text":"The command to update Powerlevel10k depends on how it was installed. Installation Update command Manual git -C ~/powerlevel10k pull Oh My Zsh git -C ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k pull Prezto zprezto-update Zim zimfw update Antigen antigen update Zplug zplug update Zgen zgen update Zplugin zplugin update Zinit zinit update Homebrew brew update && brew upgrade Arch Linux yay -S --noconfirm zsh-theme-powerlevel10k-git IMPORTANT : Restart Zsh after updating Powerlevel10k. Do not use source ~/.zshrc .","title":"How do I update Powerlevel10k?"},{"location":"faq/#how-do-i-uninstall-powerlevel10k","text":"Remove all references to \"p10k\" from ~/.zshrc . You might have this snippet at the top: if [[ -r \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\" ]]; then source \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\" fi And this at the bottom: [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh These are added by the configuration wizard . Remove them. Remove all references to \"powerlevel10k\" from ~/.zshrc , ~/.zpreztorc and ~/.zimrc (some of these files may be missing -- this is normal). These references have been added manually by yourself when installing Powerlevel10k. Refer to the installation instructions if you need a reminder. Verify that all references to \"p10k\" and \"powerlevel10k\" are gone from ~/.zshrc , ~/.zpreztorc and ~/.zimrc . grep -E 'p10k|powerlevel10k' ~/.zshrc ~/.zpreztorc ~/.zimrc 2>/dev/null If this command produces output, there are still references to \"p10k\" or \"powerlevel10k\". You need to remove them. Delete Powerlevel10k configuration file. This file is created by the configuration wizard and may contain manual edits by yourself. rm -f ~/.p10k.zsh Delete Powerlevel10k source files. These files have been downloaded when you've installed Powerlevel10k. The command to delete them depends on which installation method you'd chosen. Refer to the installation instructions if you need a reminder. Installation Uninstall command Manual rm -rf ~/powerlevel10k Oh My Zsh rm -rf -- ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k Prezto n/a Zim zimfw uninstall Antigen antigen purge romkatv/powerlevel10k Zplug zplug clean Zgen zgen reset Zplugin zplugin delete romkatv/powerlevel10k Zinit zinit delete romkatv/powerlevel10k Homebrew brew uninstall powerlevel10k; brew untap romkatv/powerlevel10k Arch Linux yay -R --noconfirm zsh-theme-powerlevel10k-git Restart Zsh. Do not use source ~/.zshrc .","title":"How do I uninstall Powerlevel10k?"},{"location":"faq/#how-do-i-install-powerlevel10k-on-a-machine-without-internet-access","text":"Run this command on the machine without Internet access: uname -sm | tr '[A-Z]' '[a-z]' Run these commands on a machine connected to the Internet after replacing the value of target_uname with the output of the previous command: target_uname=\"replace this with the output of the previous command\" git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k GITSTATUS_CACHE_DIR=\"$HOME\"/powerlevel10k/gitstatus/usrbin ~/powerlevel10k/gitstatus/install -f -s \"${target_uname% *}\" -m \"${target_uname#* }\" Copy ~/powerlevel10k from the machine connected to the Internet to the one without Internet access. Add source ~/powerlevel10k/powerlevel10k.zsh-theme to ~/.zshrc on the machine without Internet access: echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc If ~/.zshrc on the machine without Internet access sets ZSH_THEME , remove that line. sed -i.bak '/^ZSH_THEME=/d' ~/.zshrc To update, remove ~/powerlevel10k on both machines and repeat steps 1-3.","title":"How do I install Powerlevel10k on a machine without Internet access?"},{"location":"faq/#where-can-i-ask-for-help-and-report-bugs","text":"The best way to ask for help and to report bugs is to open an issue . Gitter is another option. If all else fails, email roman.perepelitsa@gmail.com. If necessary, encrypt your communication with this PGP key .","title":"Where can I ask for help and report bugs?"},{"location":"faq/#which-aspects-of-shell-and-terminal-does-powerlevel10k-affect","text":"Powerlevel10k defines prompt and nothing else. It sets prompt-related options , and parameters PS1 and RPS1 . Everything within the highlighted areas on the screenshot is produced by Powerlevel10k. Powerlevel10k has no control over the terminal content or colors outside these areas. Powerlevel10k does not affect: Terminal window/tab title. Colors used by ls . The behavior of git command. The content and style of Tab completions. Command line colors (syntax highlighting, autosuggestions, etc.). Key bindings. Aliases. Prompt parameters other than PS1 and RPS1 . Zsh options other than those related to prompt .","title":"Which aspects of shell and terminal does Powerlevel10k affect?"},{"location":"faq/#im-using-powerlevel9k-with-oh-my-zsh-how-do-i-migrate","text":"Run this command: # Add powerlevel10k to the list of Oh My Zsh themes. git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k # Replace ZSH_THEME=\"powerlevel9k/powerlevel9k\" with ZSH_THEME=\"powerlevel10k/powerlevel10k\". sed -i.bak 's/powerlevel9k/powerlevel10k/g' ~/.zshrc # Restart Zsh. exec zsh Optional but highly recommended: Install the recommended font . Type p10k configure and choose your favorite prompt style. Related: Powerlevel9k compatibility. Does Powerlevel10k always render exactly the same prompt as Powerlevel9k given the same config? Extra or missing spaces in prompt compared to Powerlevel9k. Configuration wizard.","title":"I'm using Powerlevel9k with Oh My Zsh. How do I migrate?"},{"location":"faq/#is-it-really-fast","text":"Yes. Benchmark results obtained with zsh-prompt-benchmark on an Intel i9-7900X running Ubuntu 18.04 with the config from the demo. Theme Prompt Latency powerlevel9k/master 1046 ms powerlevel9k/next 1005 ms powerlevel10k 8.7 ms Powerlevel10k is over 100 times faster than Powerlevel9k in this benchmark. In fairness, Powerlevel9k has acceptable latency when given a spartan configuration. If all you need is the current directory without truncation or shortening, Powerlevel9k can render it for you in 17 ms. Powerlevel10k can do the same 30 times faster but it won't matter in practice because 17 ms is fast enough (the threshold where latency becomes noticeable is around 50 ms). You have to be careful with Powerlevel9k configuration as it's all too easy to make prompt frustratingly slow. Powerlevel10k, on the other hand, doesn't require trading latency for utility -- it's virtually instant with any configuration. It stays well below the 50 ms mark, leaving most of the latency budget for other plugins you might install.","title":"Is it really fast?"},{"location":"faq/#how-do-i-enable-instant-prompt","text":"See instant prompt to learn about instant prompt. This section explains how you can enable it and lists caveats that you should be aware of. Instant prompt can be enabled either through p10k configure or by manually adding the following code snippet at the top of ~/.zshrc : # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. # Initialization code that may require console input (password prompts, [y/n] # confirmations, etc.) must go above this block; everything else may go below. if [[ -r \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\" ]]; then source \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\" fi It's important that you copy the lines verbatim. Don't replace source with something else, don't call zcompile , don't redirect output, etc. When instant prompt is enabled, for the duration of Zsh initialization standard input is redirected to /dev/null and standard output with standard error are redirected to a temporary file. Once Zsh is fully initialized, standard file descriptors are restored and the content of the temporary file is printed out. When using instant prompt, you should carefully check any output that appears on Zsh startup as it may indicate that initialization has been altered, or perhaps even broken, by instant prompt. Initialization code that may require console input, such as asking for a keyring password or for a [y/n] confirmation, must be moved above the instant prompt preamble in ~/.zshrc . Initialization code that merely prints to console but never reads from it will work correctly with instant prompt, although output that normally has colors may appear uncolored. You can either leave it be, suppress the output, or move it above the instant prompt preamble. Here's an example of ~/.zshrc that breaks when instant prompt is enabled: if [[ -r \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\" ]]; then source \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\" fi keychain id_rsa --agents ssh # asks for password chatty-script # spams to stdout even when everything is fine # ... Fixed version: keychain id_rsa --agents ssh # moved before instant prompt # OK to perform console I/O before this point. if [[ -r \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\" ]]; then source \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\" fi # From this point on, until zsh is fully initialized, console input won't work and # console output may appear uncolored. chatty-script >/dev/null # spam output suppressed # ... If POWERLEVEL9K_INSTANT_PROMPT is unset or set to verbose , Powerlevel10k will print a warning when it detects console output during initialization to bring attention to potential issues. You can silence this warning (without suppressing console output) with POWERLEVEL9K_INSTANT_PROMPT=quiet . This is recommended if some initialization code in ~/.zshrc prints to console and it's infeasible to move it above the instant prompt preamble or to suppress its output. You can completely disable instant prompt with POWERLEVEL9K_INSTANT_PROMPT=off . Do this if instant prompt breaks Zsh initialization and you don't know how to fix it. Note : Instant prompt requires Zsh >= 5.4. It's OK to enable it even when using an older version of Zsh but it won't do anything.","title":"How do I enable instant prompt?"},{"location":"faq/#what-do-different-symbols-in-git-status-mean","text":"When using Lean, Classic or Rainbow style, Git status may look like this: feature:master \u21e342\u21e142 \u21e042\u21e242 *42 merge ~42 +42 !42 ?42 Symbol Meaning Source feature current branch; replaced with #tag or @commit if not on a branch git status --ignore-submodules=dirty master remote tracking branch; only shown if different from local branch git rev-parse --abbrev-ref --symbolic-full-name @{u} \u21e342 this many commits behind the remote git status --ignore-submodules=dirty \u21e142 this many commits ahead of the remote git status --ignore-submodules=dirty \u21e042 this many commits behind the push remote git rev-list --left-right --count HEAD...@{push} \u21e242 this many commits ahead of the push remote git rev-list --left-right --count HEAD...@{push} *42 this many stashes git stash list merge repository state git status --ignore-submodules=dirty ~42 this many merge conflicts git status --ignore-submodules=dirty +42 this many staged changes git status --ignore-submodules=dirty !42 this many unstaged changes git status --ignore-submodules=dirty ?42 this many untracked files git status --ignore-submodules=dirty \u2500 the number of staged, unstaged or untracked files is unknown echo $POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY or git config --get bash.showDirtyState Related : How do I change the format of Git status?","title":"What do different symbols in Git status mean?"},{"location":"faq/#how-do-i-change-the-format-of-git-status","text":"To change the format of Git status, open ~/.p10k.zsh , search for my_git_formatter and edit its source code. Related : What do different symbols in Git status mean?","title":"How do I change the format of Git status?"},{"location":"faq/#why-is-git-status-from-homegit-not-displayed-in-prompt","text":"When using Lean, Classic or Rainbow style, ~/.p10k.zsh contains the following parameter: # Don't show Git status in prompt for repositories whose workdir matches this pattern. # For example, if set to '~', the Git repository at $HOME/.git will be ignored. # Multiple patterns can be combined with '|': '~(|/foo)|/bar/baz/*'. typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~' To see Git status for $HOME/.git in prompt, open ~/.p10k.zsh and remove POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN .","title":"Why is Git status from $HOME/.git not displayed in prompt?"},{"location":"faq/#why-does-git-status-sometimes-appear-grey-and-then-gets-colored-after-a-short-period-of-time","text":"tl;dr: When Git status in prompt is greyed out, it means Powerlevel10k is currently computing up-to-date Git status in the background. Prompt will get automatically refreshed when this computation completes. When your current directory is within a Git repository, Powerlevel10k computes up-to-date Git status after every command. If the repository is large, or the machine is slow, this computation can take quite a bit of time. If it takes longer than 20 milliseconds (configurable via POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS ), Powerlevel10k displays the last known Git status in grey and continues to compute up-to-date Git status in the background. When the computation completes, Powerlevel10k refreshes prompt with new information, this time with colored Git status.","title":"Why does Git status sometimes appear grey and then gets colored after a short period of time?"},{"location":"faq/#how-do-i-add-username-andor-hostname-to-prompt","text":"When using Lean, Classic or Rainbow style, prompt shows username@hostname when you are logged in as root or via SSH. There is little value in showing username or hostname when you are logged in to your local machine as a normal user. So the absence of username@hostname in your prompt is an indication that you are working locally and that you aren't root. You can change it, however. Open ~/.p10k.zsh . Close to the top you can see the most important parameters that define which segments are shown in your prompt. All generally useful prompt segments are listed in there. Some of them are enabled, others are commented out. One of them is of interest to you. typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( ... context # user@hostname ... ) Search for context to find the section in the config that lists parameters specific to this prompt segment. You should see the following lines: # Don't show context unless running with privileges or in SSH. # Tip: Remove the next line to always show context. typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION= If you follow the tip and remove (or comment out) the last line, you'll always see username@hostname in prompt. You can change the format to just username , or change the color, by adjusting the values of parameters nearby. There are plenty of comments to help you navigate. You can also move context to a different position in POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS or even to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS .","title":"How do I add username and/or hostname to prompt?"},{"location":"faq/#why-some-prompt-segments-appear-and-disappear-as-im-typing","text":"Prompt segments can be configured to be shown only when the current command you are typing invokes a relevant tool. # Show prompt segment \"kubecontext\" only when the command you are typing # invokes kubectl, helm, kubens, kubectx, oc, istioctl, kogito, k9s or helmfile. typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile' Configs created by p10k configure may contain parameters of this kind. To customize when different prompt segments are shown, open ~/.p10k.zsh , search for SHOW_ON_COMMAND and either remove these parameters or change their values. You can also define a function in ~/.zshrc to toggle the display of a prompt segment between always and on command . This is similar to kubeon / kubeoff from kube-ps1 . function kube-toggle() { if (( ${+POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND} )); then unset POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND else POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile' fi p10k reload if zle; then zle push-input zle accept-line fi } Invoke this function by typing kube-toggle . You can also bind it to a key by adding two more lines to ~/.zshrc : zle -N kube-toggle bindkey '^]' kube-toggle # ctrl-] to toggle kubecontext in powerlevel10k prompt","title":"Why some prompt segments appear and disappear as I'm typing?"},{"location":"faq/#how-do-i-change-prompt-colors","text":"You can either change the color palette used by your terminal or set colors through Powerlevel10k configuration parameters .","title":"How do I change prompt colors?"},{"location":"faq/#change-the-color-palette-used-by-your-terminal","text":"How exactly you change the terminal color palette (a.k.a. color scheme, or theme) depends on the kind of terminal you are using. Look around in terminal's settings/preferences or consult documentation. When you change the terminal color palette, it usually affects only the first 16 colors, numbered from 0 to 15. In order to see any effect on Powerlevel10k prompt, you need to use prompt style that utilizes these low-numbered colors. Type p10k configure and select Rainbow , Lean \u2192 8 colors or Pure \u2192 Original . Other styles use higher-numbered colors, so they look the same in any terminal color palette.","title":"Change the color palette used by your terminal"},{"location":"faq/#set-colors-through-powerlevel10k-configuration-parameters","text":"Open ~/.p10k.zsh , search for \"color\", \"foreground\" and \"background\" and change values of appropriate parameters. For example, here's how you can set the foreground of time prompt segment to bright red: typeset -g POWERLEVEL9K_TIME_FOREGROUND=160 Colors are specified using numbers from 0 to 255. Colors from 0 to 15 look differently in different terminals. Many terminals also support customization of these colors through color palettes (a.k.a. color schemes, or themes). Colors from 16 to 255 always look the same. Type source ~/.p10k.zsh to apply your changes to the current Zsh session. To see how different colors look in your terminal, run the following command: for i in {0..255}; do print -Pn \"%K{$i} %k%F{$i}${(l:3::0:)i}%f \" ${${(M)$((i%6)):#3}:+$'\\n'}; done","title":"Set colors through Powerlevel10k configuration parameters"},{"location":"faq/#why-does-powerlevel10k-spawn-extra-processes","text":"Powerlevel10k uses gitstatus as the backend behind vcs prompt; gitstatus spawns gitstatusd and zsh . See gitstatus for details. Powerlevel10k may also spawn zsh to perform computation without blocking prompt. To avoid security hazard, these background processes aren't shared by different interactive shells. They terminate automatically when the parent zsh process terminates or runs exec(3) .","title":"Why does Powerlevel10k spawn extra processes?"},{"location":"faq/#are-there-configuration-options-that-make-powerlevel10k-slow","text":"No, Powerlevel10k is always fast, with any configuration you throw at it. If you have noticeable prompt latency when using Powerlevel10k, please open an issue .","title":"Are there configuration options that make Powerlevel10k slow?"},{"location":"faq/#is-powerlevel10k-fast-to-load","text":"Yes, provided that you are using Zsh >= 5.4. Loading time, or time to first prompt, can be measured with the following benchmark: time (repeat 1000 zsh -dfis <<< 'source ~/powerlevel10k/powerlevel10k.zsh-theme') Note: This measures time to first complete prompt. Powerlevel10k can also display a limited prompt before the full-featured prompt is ready. Running this command with ~/powerlevel10k as the current directory on the same machine as in the prompt benchmark takes 29 seconds (29 ms per invocation). This is about 6 times faster than powerlevel9k/master and 17 times faster than powerlevel9k/next.","title":"Is Powerlevel10k fast to load?"},{"location":"faq/#what-is-the-relationship-between-powerlevel9k-and-powerlevel10k","text":"Powerlevel10k was forked from Powerlevel9k in March 2019 after a week-long discussion in powerlevel9k#1170 . Powerlevel9k was already a mature project with large user base and release cycle measured in months. Powerlevel10k was spun off to iterate on performance improvements and new features at much higher pace. Powerlevel9k and Powerlevel10k are independent projects. When using one, you shouldn't install the other. Issues should be filed against the project that you actually use. There are no individuals that have commit rights in both repositories. All bug fixes and new features committed to Powerlevel9k repository get ported to Powerlevel10k. Over time, virtually all code in Powerlevel10k has been rewritten. There is currently no meaningful overlap between the implementations of Powerlevel9k and Powerlevel10k. Powerlevel10k is committed to maintaining backward compatibility with all configs indefinitely. This commitment covers all configuration parameters recognized by Powerlevel9k (see Powerlevel9k compatibility ) and additional parameters that only Powerlevel10k understands. Names of all parameters in Powerlevel10k start with POWERLEVEL9K_ for consistency.","title":"What is the relationship between Powerlevel9k and Powerlevel10k?"},{"location":"faq/#does-powerlevel10k-always-render-exactly-the-same-prompt-as-powerlevel9k-given-the-same-config","text":"Almost. There are a few differences. By default only git vcs backend is enabled in Powerlevel10k. If you need svn and hg , add them to POWERLEVEL9K_VCS_BACKENDS . These backends aren't yet optimized in Powerlevel10k, so enabling them will make prompt very slow . Powerlevel10k doesn't support POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY=true . Powerlevel10k strives to be bug-compatible with Powerlevel9k but not when it comes to egregious bugs. If you accidentally rely on these bugs, your prompt will differ between Powerlevel9k and Powerlevel10k. Some examples: Powerlevel9k ignores some options that are set after the theme is sourced while Powerlevel10k respects all options. If you see different icons in Powerlevel9k and Powerlevel10k, you've probably defined POWERLEVEL9K_MODE before sourcing the theme. This parameter gets ignored by Powerlevel9k but honored by Powerlevel10k. If you want your prompt to look in Powerlevel10k the same as in Powerlevel9k, remove POWERLEVEL9K_MODE . Powerlevel9k doesn't respect ZLE_RPROMPT_INDENT . As a result, right prompt in Powerlevel10k can have an extra space at the end compared to Powerlevel9k. Set ZLE_RPROMPT_INDENT=0 if you don't want that space. More details in troubleshooting . Powerlevel9k has inconsistent spacing around icons. This was fixed in Powerlevel10k. Set POWERLEVEL9K_LEGACY_ICON_SPACING=true to get the same spacing as in Powerlevel9k. More details in troubleshooting . There are dozens more bugs in Powerlevel9k that don't exist in Powerlevel10k. If you notice any other changes in prompt appearance when switching from Powerlevel9k to Powerlevel10k, please open an issue .","title":"Does Powerlevel10k always render exactly the same prompt as Powerlevel9k given the same config?"},{"location":"faq/#what-is-the-best-prompt-style-in-the-configuration-wizard","text":"There are as many opinions on what constitutes the best prompt as there are people. It mostly comes down to personal preference. There are, however, a few hidden implications of different choices. Pure style is an exact replication of Pure Zsh theme . It exists to ease the migration for users of this theme. Unless you are one of them, choose Lean style over Pure. If you want to confine prompt colors to the selected terminal color palette (say, Solarized Dark ), use Rainbow , Lean \u2192 8 colors or Pure \u2192 Original . Other styles use fixed colors and thus look the same in any terminal color palette. All styles except Pure have an option to use ASCII charset. Prompt will look less pretty but will render correctly with all fonts and in all locales. If you enable transient prompt, take advantage of two-line prompt. You'll get the benefit of extra space for typing commands without the usual drawback of reduced scrollback density. Having all commands start from the same offset is also nice. Similarly, if you enable transient prompt, sparse prompt (with an empty line before prompt) is a great choice. If you are using vi keymap, choose prompt with prompt_char in it (shown as green \u276f in the wizard). This symbol changes depending on vi mode: \u276f , \u276e , V , \u25b6 for insert, command, visual and replace mode respectively. When a command fails, the symbol turns red. Lean style always has prompt_char in it. Rainbow and Classic styles have it only in the two-line configuration without left frame. If you value horizontal space or prefer minimalist aesthetics: Use a monospace font, such as the recommended font . Non-monospace fonts require extra space after icons that are larger than a single column. Use Lean style. Compared to Classic and Rainbow, it saves two characters per prompt segment. Disable current time and frame . Use few icons . The extra icons enabled by the many icons option primarily serve decorative function. Informative icons, such as background job indicator, will be shown either way. Note : You can run configuration wizard as many times as you like. Type p10k configure to try new prompt style.","title":"What is the best prompt style in the configuration wizard?"},{"location":"faq/#how-to-make-powerlevel10k-look-like-robbyrussell-oh-my-zsh-theme","text":"Use this config . You can either download it, save as ~/.p10k.zsh and source ~/.p10k.zsh from ~/.zshrc , or source p10k-robbyrussell.zsh directly from your cloned powerlevel10k repository.","title":"How to make Powerlevel10k look like robbyrussell Oh My Zsh theme?"},{"location":"faq/#can-prompts-for-completed-commands-display-error-status-for-those-commands-instead-of-the-commands-preceding-them","text":"No. When you hit ENTER and the command you've typed starts running, its error status isn't yet known, so it cannot be shown in prompt. When the command completes, the error status gets known but it's no longer possible to update prompt for that command. This is why the error status for every command is reflected in the next prompt. For details, see this post on /r/zsh .","title":"Can prompts for completed commands display error status for those commands instead of the commands preceding them?"},{"location":"faq/#what-is-the-minimum-supported-zsh-version","text":"Zsh 5.1 or newer should work. Fast startup requires Zsh >= 5.4.","title":"What is the minimum supported Zsh version?"},{"location":"faq/#how-were-these-screenshots-and-animated-gifs-created","text":"All screenshots and animated gifs were recorded in GNOME Terminal with the recommended font and Tango Dark color palette with custom background color ( #171A1B instead of #2E3436 -- twice as dark). Syntax highlighting, where present, was provided by zsh-syntax-highlighting .","title":"How were these screenshots and animated gifs created?"},{"location":"faq/#how-was-the-recommended-font-created","text":"The recommended font is the product of many individuals. Its origin is Bitstream Vera Sans Mono , which has given birth to Menlo , which in turn has spawned Meslo . Finally, extra glyphs have been added to Meslo with scripts forked from Nerd Fonts. The final font is released under the terms of Apache License . MesloLGS NF font can be recreated with the following command (requires git and docker ): git clone --depth=1 https://github.com/romkatv/nerd-fonts.git cd nerd-fonts ./build 'Meslo/S/*' If everything goes well, four ttf files will appear in ./out .","title":"How was the recommended font created?"},{"location":"faq/#how-to-package-powerlevel10k-for-distribution","text":"It's currently neither easy nor recommended to package and distribute Powerlevel10k. There are no instructions you can follow that would allow you to easily update your package when new versions of Powerlevel10k are released. This may change in the future but not soon.","title":"How to package Powerlevel10k for distribution?"},{"location":"features/","text":"Features Configuration wizard Uncompromising performance Powerlevel9k Compatibility Pure compatibility Instant prompt Show on Command Transient Prompt Current Directory that just works Extremely Customizable Batteries included Extensible","title":"Features"},{"location":"features/#features","text":"Configuration wizard Uncompromising performance Powerlevel9k Compatibility Pure compatibility Instant prompt Show on Command Transient Prompt Current Directory that just works Extremely Customizable Batteries included Extensible","title":"Features"},{"location":"fonts/","text":"Recommended font: Meslo Nerd Font patched for Powerlevel10k Gorgeous monospace font designed by Jim Lyles for Bitstream, customized by the same for Apple, further customized by Andr\u00e9 Berg, and finally patched by yours truly with customized scripts originally developed by Ryan L McIntyre of Nerd Fonts. Contains all glyphs and symbols that Powerlevel10k may need. Battle-tested in dozens of different terminals on all major operating systems. FAQ : How was the recommended font created? Automatic font installation If you are using iTerm2 or Termux, p10k configure can install the recommended font for you. Simply answer Yes when asked whether to install Meslo Nerd Font . If you are using a different terminal, proceed with manual font installation. \ud83d\udc47 Manual font installation Download these four ttf files: MesloLGS NF Regular.ttf MesloLGS NF Bold.ttf MesloLGS NF Italic.ttf MesloLGS NF Bold Italic.ttf Double-click on each file and click \"Install\". This will make MesloLGS NF font available to all applications on your system. Configure your terminal to use this font: iTerm2 : Open iTerm2 \u2192 Preferences \u2192 Profiles \u2192 Text and set Font to MesloLGS NF . Alternatively, type p10k configure and answer Yes when asked whether to install Meslo Nerd Font . Apple Terminal Open Terminal \u2192 Preferences \u2192 Profiles \u2192 Text , click Change under Font and select MesloLGS NF family. Hyper : Open Hyper \u2192 Edit \u2192 Preferences and change the value of fontFamily under module.exports.config to MesloLGS NF . Visual Studio Code : Open File \u2192 Preferences \u2192 Settings , enter terminal.integrated.fontFamily in the search box and set the value to MesloLGS NF . GNOME Terminal (the default Ubuntu terminal): Open Terminal \u2192 Preferences and click on the selected profile under Profiles . Check Custom font under Text Appearance and select MesloLGS NF Regular . Konsole : Open Settings \u2192 Edit Current Profile \u2192 Appearance , click Select Font and select MesloLGS NF Regular . Tilix : Open Tilix \u2192 Preferences and click on the selected profile under Profiles . Check Custom font under Text Appearance and select MesloLGS NF Regular . Windows Console Host (the old thing): Click the icon in the top left corner, then Properties \u2192 Font and set Font to MesloLGS NF . Windows Terminal (the new thing): Open Settings ( Ctrl+, ), search for fontFace and set value to MesloLGS NF for every profile. Termux : Type p10k configure and answer Yes when asked whether to install Meslo Nerd Font . Blink Type config , go to Appearance , tap Add a new font , tap Open Gallery , select MesloLGS NF.css , tap import and type exit in the home view to reload the font. Terminus : Open Settings \u2192 Appearance and set Font to MesloLGS NF . Terminator : Open Preferences using the context menu. Under Profiles select the General tab (should be selected already), uncheck Use the system fixed width font (if not already) and select MesloLGS NF Regular . Exit the Preferences dialog by clicking Close . Guake : Right Click on an open terminal and open Preferences . Under Appearance tab, uncheck Use the system fixed width font (if not already) and select MesloLGS NF Regular . Exit the Preferences dialog by clicking Close . Alacritty : Create or open ~/.config/alacritty/alacritty.yml and add the following section to it: font: normal: family: 'MesloLGS NF' Kitty : Create or open ~/.config/kitty/kitty.conf and add the following line to it: font_family MesloLGS NF Restart Kitty by closing all sessions and opening a new session. IMPORTANT: Run p10k configure after changing terminal font. The old ~/.p10k.zsh may work incorrectly with the new font. Using a different terminal and know how to set the font for it? Share your knowledge by sending a PR to expand the list!","title":"Recommended font: Meslo Nerd Font patched for Powerlevel10k"},{"location":"fonts/#recommended-font-meslo-nerd-font-patched-for-powerlevel10k","text":"Gorgeous monospace font designed by Jim Lyles for Bitstream, customized by the same for Apple, further customized by Andr\u00e9 Berg, and finally patched by yours truly with customized scripts originally developed by Ryan L McIntyre of Nerd Fonts. Contains all glyphs and symbols that Powerlevel10k may need. Battle-tested in dozens of different terminals on all major operating systems. FAQ : How was the recommended font created?","title":"Recommended font: Meslo Nerd Font patched for Powerlevel10k"},{"location":"fonts/#automatic-font-installation","text":"If you are using iTerm2 or Termux, p10k configure can install the recommended font for you. Simply answer Yes when asked whether to install Meslo Nerd Font . If you are using a different terminal, proceed with manual font installation. \ud83d\udc47","title":"Automatic font installation"},{"location":"fonts/#manual-font-installation","text":"Download these four ttf files: MesloLGS NF Regular.ttf MesloLGS NF Bold.ttf MesloLGS NF Italic.ttf MesloLGS NF Bold Italic.ttf Double-click on each file and click \"Install\". This will make MesloLGS NF font available to all applications on your system. Configure your terminal to use this font: iTerm2 : Open iTerm2 \u2192 Preferences \u2192 Profiles \u2192 Text and set Font to MesloLGS NF . Alternatively, type p10k configure and answer Yes when asked whether to install Meslo Nerd Font . Apple Terminal Open Terminal \u2192 Preferences \u2192 Profiles \u2192 Text , click Change under Font and select MesloLGS NF family. Hyper : Open Hyper \u2192 Edit \u2192 Preferences and change the value of fontFamily under module.exports.config to MesloLGS NF . Visual Studio Code : Open File \u2192 Preferences \u2192 Settings , enter terminal.integrated.fontFamily in the search box and set the value to MesloLGS NF . GNOME Terminal (the default Ubuntu terminal): Open Terminal \u2192 Preferences and click on the selected profile under Profiles . Check Custom font under Text Appearance and select MesloLGS NF Regular . Konsole : Open Settings \u2192 Edit Current Profile \u2192 Appearance , click Select Font and select MesloLGS NF Regular . Tilix : Open Tilix \u2192 Preferences and click on the selected profile under Profiles . Check Custom font under Text Appearance and select MesloLGS NF Regular . Windows Console Host (the old thing): Click the icon in the top left corner, then Properties \u2192 Font and set Font to MesloLGS NF . Windows Terminal (the new thing): Open Settings ( Ctrl+, ), search for fontFace and set value to MesloLGS NF for every profile. Termux : Type p10k configure and answer Yes when asked whether to install Meslo Nerd Font . Blink Type config , go to Appearance , tap Add a new font , tap Open Gallery , select MesloLGS NF.css , tap import and type exit in the home view to reload the font. Terminus : Open Settings \u2192 Appearance and set Font to MesloLGS NF . Terminator : Open Preferences using the context menu. Under Profiles select the General tab (should be selected already), uncheck Use the system fixed width font (if not already) and select MesloLGS NF Regular . Exit the Preferences dialog by clicking Close . Guake : Right Click on an open terminal and open Preferences . Under Appearance tab, uncheck Use the system fixed width font (if not already) and select MesloLGS NF Regular . Exit the Preferences dialog by clicking Close . Alacritty : Create or open ~/.config/alacritty/alacritty.yml and add the following section to it: font: normal: family: 'MesloLGS NF' Kitty : Create or open ~/.config/kitty/kitty.conf and add the following line to it: font_family MesloLGS NF Restart Kitty by closing all sessions and opening a new session. IMPORTANT: Run p10k configure after changing terminal font. The old ~/.p10k.zsh may work incorrectly with the new font. Using a different terminal and know how to set the font for it? Share your knowledge by sending a PR to expand the list!","title":"Manual font installation"},{"location":"installation/","text":"Installation Install the recommended font . Optional but highly recommended. Install Powerlevel10k for your plugin manager. Manual \ud83d\udc48 choose this if confused or uncertain Oh My Zsh Prezto Zim Antibody Antigen Zplug Zgen Zplugin Zinit Homebrew Arch Linux Restart Zsh. Type p10k configure if the configuration wizard doesn't start automatically. Manual git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc Users in mainland China can use the official mirror on gitee.com for faster download. \u4e2d\u56fd\u5927\u9646\u7528\u6237\u53ef\u4ee5\u4f7f\u7528 gitee.com \u4e0a\u7684\u5b98\u65b9\u955c\u50cf\u52a0\u901f\u4e0b\u8f7d. git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ~/powerlevel10k echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc This is the simplest kind of installation and it works even if you are using a plugin manager. Just make sure to disable the current theme in your plugin manager. See troubleshooting for help. Oh My Zsh git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k Users in mainland China can use the official mirror on gitee.com for faster download. \u4e2d\u56fd\u5927\u9646\u7528\u6237\u53ef\u4ee5\u4f7f\u7528 gitee.com \u4e0a\u7684\u5b98\u65b9\u955c\u50cf\u52a0\u901f\u4e0b\u8f7d. git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k Set ZSH_THEME=\"powerlevel10k/powerlevel10k\" in ~/.zshrc . Prezto Add zstyle :prezto:module:prompt theme powerlevel10k to ~/.zpreztorc . Zim Add zmodule romkatv/powerlevel10k to ~/.zimrc and run zimfw install . Antibody Add antibody bundle romkatv/powerlevel10k to ~/.zshrc . Antigen Add antigen theme romkatv/powerlevel10k to ~/.zshrc . Make sure you have antigen apply somewhere after it. Zplug Add zplug romkatv/powerlevel10k, as:theme, depth:1 to ~/.zshrc . Zgen Add zgen load romkatv/powerlevel10k powerlevel10k to ~/.zshrc . Zplugin Add zplugin ice depth=1; zplugin light romkatv/powerlevel10k to ~/.zshrc . The use of depth=1 ice is optional. Other types of ice are neither recommended nor officially supported by Powerlevel10k. Zinit Add zinit ice depth=1; zinit light romkatv/powerlevel10k to ~/.zshrc . The use of depth=1 ice is optional. Other types of ice are neither recommended nor officially supported by Powerlevel10k. Homebrew brew install romkatv/powerlevel10k/powerlevel10k echo 'source /usr/local/opt/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc Arch Linux yay -S --noconfirm zsh-theme-powerlevel10k-git echo 'source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc zsh-theme-powerlevel10k-git referenced above is the official Powerlevel10k package. There is also zsh-theme-powerlevel10k community package. Historicaly, it has been breaking often and for extended periods of time . Do not use it.","title":"Get Started"},{"location":"installation/#installation","text":"Install the recommended font . Optional but highly recommended. Install Powerlevel10k for your plugin manager. Manual \ud83d\udc48 choose this if confused or uncertain Oh My Zsh Prezto Zim Antibody Antigen Zplug Zgen Zplugin Zinit Homebrew Arch Linux Restart Zsh. Type p10k configure if the configuration wizard doesn't start automatically.","title":"Installation"},{"location":"installation/#manual","text":"git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc Users in mainland China can use the official mirror on gitee.com for faster download. \u4e2d\u56fd\u5927\u9646\u7528\u6237\u53ef\u4ee5\u4f7f\u7528 gitee.com \u4e0a\u7684\u5b98\u65b9\u955c\u50cf\u52a0\u901f\u4e0b\u8f7d. git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ~/powerlevel10k echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc This is the simplest kind of installation and it works even if you are using a plugin manager. Just make sure to disable the current theme in your plugin manager. See troubleshooting for help.","title":"Manual"},{"location":"installation/#oh-my-zsh","text":"git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k Users in mainland China can use the official mirror on gitee.com for faster download. \u4e2d\u56fd\u5927\u9646\u7528\u6237\u53ef\u4ee5\u4f7f\u7528 gitee.com \u4e0a\u7684\u5b98\u65b9\u955c\u50cf\u52a0\u901f\u4e0b\u8f7d. git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k Set ZSH_THEME=\"powerlevel10k/powerlevel10k\" in ~/.zshrc .","title":"Oh My Zsh"},{"location":"installation/#prezto","text":"Add zstyle :prezto:module:prompt theme powerlevel10k to ~/.zpreztorc .","title":"Prezto"},{"location":"installation/#zim","text":"Add zmodule romkatv/powerlevel10k to ~/.zimrc and run zimfw install .","title":"Zim"},{"location":"installation/#antibody","text":"Add antibody bundle romkatv/powerlevel10k to ~/.zshrc .","title":"Antibody"},{"location":"installation/#antigen","text":"Add antigen theme romkatv/powerlevel10k to ~/.zshrc . Make sure you have antigen apply somewhere after it.","title":"Antigen"},{"location":"installation/#zplug","text":"Add zplug romkatv/powerlevel10k, as:theme, depth:1 to ~/.zshrc .","title":"Zplug"},{"location":"installation/#zgen","text":"Add zgen load romkatv/powerlevel10k powerlevel10k to ~/.zshrc .","title":"Zgen"},{"location":"installation/#zplugin","text":"Add zplugin ice depth=1; zplugin light romkatv/powerlevel10k to ~/.zshrc . The use of depth=1 ice is optional. Other types of ice are neither recommended nor officially supported by Powerlevel10k.","title":"Zplugin"},{"location":"installation/#zinit","text":"Add zinit ice depth=1; zinit light romkatv/powerlevel10k to ~/.zshrc . The use of depth=1 ice is optional. Other types of ice are neither recommended nor officially supported by Powerlevel10k.","title":"Zinit"},{"location":"installation/#homebrew","text":"brew install romkatv/powerlevel10k/powerlevel10k echo 'source /usr/local/opt/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc","title":"Homebrew"},{"location":"installation/#arch-linux","text":"yay -S --noconfirm zsh-theme-powerlevel10k-git echo 'source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc zsh-theme-powerlevel10k-git referenced above is the official Powerlevel10k package. There is also zsh-theme-powerlevel10k community package. Historicaly, it has been breaking often and for extended periods of time . Do not use it.","title":"Arch Linux"},{"location":"troubleshooting/","text":"Troubleshooting Question mark in prompt If it looks like a regular ? , that's normal. It means you have untracked files in the current Git repository. Type git status to see these files. You can change this symbol or disable the display of untracked files altogether. Search for untracked files in ~/.p10k.zsh . FAQ : What do different symbols in Git status mean? You can also get a weird-looking question mark in your prompt if your terminal's font is missing some glyphs. See icons, glyphs or powerline symbols don't render . Icons, glyphs or powerline symbols don't render Restart your terminal, install the recommended font and run p10k configure . Sub-pixel imperfections around powerline symbols There are three imperfections on the screenshot. From left to right: A thin blue line (a sub-pixel gap) between the content of a prompt segment and the following powerline connection. Incorrect alignment of a powerline connection and the following prompt segment. The connection appears shifted to the right. A thin red line below a powerline connection. The connection appears shifted up. Zsh themes don't have down-to-pixel control over the terminal content. Everything you see on the screen is made of monospace characters. A white powerline prompt segment is made of text on white background followed by U+E0B0 (a right-pointing triangle). If Powerlevel10k prompt has imperfections around powerline symbols, you'll see exactly the same imperfections with all powerline themes (Agnoster, Powerlevel9k, Powerline, etc.) There are several things you can try to deal with these imperfections: Try the recommended font . If you are already using it, switching to another font may help but is unlikely. Change terminal font size one point up or down. For example, in iTerm2 powerline prompt looks perfect at font sizes 11 and 13 but breaks down at 12. Enable builtin powerline glyphs in terminal settings if your terminal supports it (iTerm2 does). Change font hinting and/or anti-aliasing mode in the terminal settings. Shift all text one pixel up/down/left/right if your terminal has an option to do so. Try a different terminal. A more radical solution is to switch to prompt style without background. Type p10k configure and select Lean . This style has a modern lightweight look. As a bonus, it doesn't suffer from rendering imperfections that afflict powerline-style prompt. Error: character not in range Type echo '\\u276F' . If you get an error saying \"zsh: character not in range\", your locale doesn't support UTF-8. You need to fix it. If you are running Zsh over SSH, see this . If you are running Zsh locally, Google \"set UTF-8 locale in your OS \". Cursor is in the wrong place Type echo '\\u276F' . If you get an error saying \"zsh: character not in range\", see the previous section . If the echo command prints \u276f but the cursor is still in the wrong place, install the recommended font and run p10k configure . If this doesn't help, add unset ZLE_RPROMPT_INDENT at the bottom of ~/.zshrc . Still having issues? Run the following command to diagnose the problem: () { emulate -L zsh setopt err_return no_unset local text print -rl -- 'Select a part of your prompt from the terminal window and paste it below.' '' read -r '?Prompt: ' text local -i len=${(m)#text} local frame=\"+-${(pl.$len..-.):-}-+\" print -lr -- $frame \"| $text |\" $frame } If the prompt line aligns with the frame +------------------------------+ | romka@adam \u2713 ~/powerlevel10k | +------------------------------+ If the output of the command is aligned for every part of your prompt (left and right), this indicates a bug in the theme or your config. Use this command to diagnose it: print -rl -- ${(eq+)PROMPT} ${(eq+)RPROMPT} Look for %{...%} and backslash escapes in the output. If there are any, they are the likely culprits. Open an issue if you get stuck. If the prompt line is longer than the frame +-----------------------------+ | romka@adam \u2713 ~/powerlevel10k | +-----------------------------+ This is usually caused by a terminal bug or misconfiguration that makes it print ambiguous-width characters as double-width instead of single width. For example, this issue . If the prompt line is shorter than the frame and is mangled +------------------------------+ | romka@adam \u2713~/powerlevel10k | +------------------------------+ Note that this prompt is different from the original as it's missing a space after the check mark. This can be caused by a low-level bug in macOS. See this issue . This can also happen if prompt contains glyphs designated as \"wide\" in the Unicode standard and your terminal incorrectly displays them as non-wide. Terminals suffering from this limitation include Konsole, Hyper and the integrated VSCode Terminal. The solution is to use a different terminal or remove all wide glyphs from prompt. If the prompt line is shorter than the frame and is not mangled +--------------------------------+ | romka@adam \u2713 ~/powerlevel10k | +--------------------------------+ This can be caused by misconfigured locale. See this issue . Prompt wrapping around in a weird way See cursor is in the wrong place . Right prompt is in the wrong place See cursor is in the wrong place . Configuration wizard runs automatically every time Zsh is started When Powerlevel10k starts, it automatically runs p10k configure if no POWERLEVEL9K_* parameters are defined. Based on your prompt style choices, the configuration wizard creates ~/.p10k.zsh with a bunch of POWERLEVEL9K_* parameters in it and adds a line to ~/.zshrc to source this file. The next time you start Zsh, the configuration wizard shouldn't run automatically. If it does, this means the evaluation of ~/.zshrc terminates prematurely before it reaches the line that sources ~/.p10k.zsh . This most often happens due to syntax errors in ~/.zshrc . These errors get hidden by the configuration wizard screen, so you don't notice them. When you exit configuration wizard, look for error messages. You can also use POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true zsh to start Zsh without automatically running the configuration wizard. Once you can see the errors, fix ~/.zshrc to get rid of them. Some prompt styles are missing from the configuration wizard If Zsh version is below 5.7.1 or COLORTERM environment variable is neither 24bit nor truecolor , configuration wizard won't offer Pure style with Snazzy color scheme. Fix : Install Zsh >= 5.7.1 and use a terminal with truecolor support. Verify with print -P '%F{#ff0000}red%f' . If the terminal can display fewer than 256 colors, configuration wizard preselects Lean style with 8 colors. All other styles require at least 256 colors. Fix : Use a terminal with 256 color support and make sure that TERM environment variable is set correctly. Verify with print $terminfo[colors] . If there is no UTF-8 locale on the system, configuration wizard won't offer prompt styles that use Unicode characters. Fix : Install a UTF-8 locale. Verify with locale -a . When a UTF-8 locale is available, the first few questions asked by the configuration wizard assess capabilities of the terminal font. If your answers indicate that some glyphs don't render correctly, configuration wizard won't offer prompt styles that use them. Fix : Restart your terminal and install the recommended font . Verify by running p10k configure and checking that all glyphs render correctly. Cannot install the recommended font Once you download the recommended font , you can install it just like any other font. Google \"how to install fonts on your OS \". Extra or missing spaces in prompt compared to Powerlevel9k tl;dr: Add ZLE_RPROMPT_INDENT=0 and POWERLEVEL9K_LEGACY_ICON_SPACING=true to ~/.zshrc to get the same prompt spacing as in Powerlevel9k. When using Powerlevel10k with a Powerlevel9k config, you might get additional spaces in prompt here and there. These come in two flavors. Extra space without background on the right side of right prompt tl;dr: Add ZLE_RPROMPT_INDENT=0 to ~/.zshrc to get rid of that space. From Zsh documentation : ZLE_RPROMPT_INDENT If set, used to give the indentation between the right hand side of the right prompt in the line editor as given by RPS1 or RPROMPT and the right hand side of the screen. If not set, the value 1 is used. Typically this will be used to set the value to 0 so that the prompt appears flush with the right hand side of the screen. Powerlevel10k respects this parameter. If you set ZLE_RPROMPT_INDENT=1 (or leave it unset, which is the same thing as setting it to 1 ), you'll get an empty space to the right of right prompt. If you set ZLE_RPROMPT_INDENT=0 , your prompt will go to the edge of the terminal. This is how it works in every theme except Powerlevel9k. Powerlevel9k issue: powerlevel9k#1292 . It's been fixed in the development branch of Powerlevel9k but the fix hasn't yet made it to master . Add ZLE_RPROMPT_INDENT=0 to ~/.zshrc to get the same spacing on the right edge of prompt as in Powerlevel9k. Note: Several versions of Zsh have bugs that get triggered when you set ZLE_RPROMPT_INDENT=0 . Powerlevel10k can work around these bugs when using powerline prompt style. If you notice visual artifacts in prompt, or wrong cursor position, try removing ZLE_RPROMPT_INDENT from ~/.zshrc . Extra or missing spaces around icons tl;dr: Add POWERLEVEL9K_LEGACY_ICON_SPACING=true to ~/.zshrc to get the same spacing around icons as in Powerlevel9k. Spacing around icons in Powerlevel9k is inconsistent. This inconsistency is a constant source of annoyance, so it was fixed in Powerlevel10k. You can add POWERLEVEL9K_LEGACY_ICON_SPACING=true to ~/.zshrc to get the same spacing around icons as in Powerlevel9k. Note: It's not a good idea to define POWERLEVEL9K_LEGACY_ICON_SPACING when using p10k configure . Weird things happen after typing source ~/.zshrc It's almost always a bad idea to run source ~/.zshrc , whether you are using Powerlevel10k or not. This command may result in random errors, misbehaving code and progressive slowdown of Zsh. If you've made changes to ~/.zshrc or to files sourced by it, restart Zsh to apply them. The most reliable way to do this is to type exit and then start a new Zsh session. You can also use exec zsh . While not exactly equivalent to complete Zsh restart, this command is much more reliable than source ~/.zshrc . Transient prompt stops working after some time See weird things happen after typing source ~/.zshrc . Cannot make Powerlevel10k work with my plugin manager If the installation instructions didn't work for you, try disabling your current theme (so that you end up with no theme) and then installing Powerlevel10k manually. Disable the current theme in your framework / plugin manager. oh-my-zsh: Open ~/.zshrc and remove the line that sets ZSH_THEME . It might look like this: ZSH_THEME=\"powerlevel9k/powerlevel9k\" . zplug: Open ~/.zshrc and remove the zplug command that refers to your current theme. For example, if you are currently using Powerlevel9k, look for zplug bhilburn/powerlevel9k, use:powerlevel9k.zsh-theme . prezto: Open ~/.zpreztorc and put zstyle :prezto:module:prompt theme off in it. Remove any other command that sets theme such as zstyle :prezto:module:prompt theme powerlevel9k . antigen: Open ~/.zshrc and remove the line that sets antigen theme . It might look like this: antigen theme powerlevel9k/powerlevel9k . Install Powerlevel10k manually. git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc This method of installation won't make anything slower or otherwise sub-par. Directory is difficult to see in prompt when using Rainbow style In Rainbow style the current working directory is shown with bright white text on blue background. The white is fixed and always looks the same but the appearance of \"blue\" is defined by your terminal color palette. If it's very light, it may be difficult to see white text on it. There are several ways to fix this. Type p10k configure and choose a more readable prompt style. Change terminal color palette . Try Tango Dark or Solarized Dark, or change just the \"blue\" color. Change directory background and/or foreground color . The parameters you are looking for are called POWERLEVEL9K_DIR_BACKGROUND , POWERLEVEL9K_DIR_FOREGROUND , POWERLEVEL9K_DIR_SHORTENED_FOREGROUND , POWERLEVEL9K_DIR_ANCHOR_FOREGROUND and POWERLEVEL9K_DIR_ANCHOR_BOLD . You can find them in in ~/.p10k.zsh . Horrific mess when resizing terminal window When you resize terminal window horizontally back and forth a few times, you might see this ugly picture. tl;dr: This is a bug in Zsh that isn't specific to Powerlevel10k. See mitigation . Zsh bug This issue is caused by a bug in Zsh that gets triggered when the vertical distance between the start of the current prompt and the cursor (henceforth VD ) changes when the terminal window is resized. This bug is not specific to Powerlevel10k. When a terminal window gets shrunk horizontally, there are two ways for a terminal to handle long lines that no longer fit: reflow or truncate . Terminal content before shrinking: Terminal reflows text when shrinking: Terminal truncates text when shrinking: Reflowing strategy can change the height of terminal content. If such content happens to be between the start of the current prompt and the cursor, Zsh will print prompt on the wrong line. Truncation strategy never changes the height of terminal content, so it doesn't trigger this bug in Zsh. Let's see how the bug plays out in slow motion. We'll start by launching zsh -df and pasting the following code: function pause() { read -s } functions -M pause 0 reset print -l {1..3} setopt prompt_subst PROMPT=$'${$((pause()))+}left>${(pl.$((COLUMNS-12))..-.)} ' When PROMPT gets expanded, it calls pause to let us observe the state of the terminal. Here's the initial state: Zsh keeps track of the cursor position relative to the start of the current prompt. In this case it knows that the cursor is one line below. When we shrink the terminal window, it looks like this: At this point the terminal sends SIGWINCH to Zsh to notify it about changes in the terminal dimensions. Note that this signal is sent after the content of the terminal has been reflown. When Zsh receives SIGWINCH , it attempts to erase the current prompt and print it anew. It goes to the position where it thinks the current prompt is -- one line above the cursor (!) -- erases all terminal content that follows and prints reexpanded prompt there. However, after resizing prompt is no longer one line above the cursor. It's two lines above! Zsh ends up printing new prompt one line too low. In this case we ended up with unwanted junk content because VD has increased . When you make terminal window wider, VD can also decrease , which would result in the new prompt being printed higher than intended, potentially erasing useful content in the process. Here are a few more examples where shrinking terminal window increased VD . Simple one-line left prompt with right prompt. No prompt_subst . Note that the cursor is below the prompt line (hit ESC-ENTER to get it there). Simple one-line left prompt. No prompt_subst , no right prompt. Here VD is bound to increase upon terminal shrinking due to the command line wrapping around. Zsh patch The bug described above has been partially fixed (only for some terminals) in this branch . The idea behind the fix is to use sc (save cursor) terminal capability before printing prompt and rc (restore cursor) to move cursor back to the original position when prompt needs to be refreshed. The patch works only on terminals that reflow saved cursor position together with text when the terminal window is resized. The patch has no observable effect on terminals that don't reflow text on resize (both patched and unpatched Zsh behave correctly) and on terminals that reflow text but not saved cursor position (both patched and unpatched Zsh redraw prompt at the same incorrect position). In other words, the patch fixes the resizing issue on some terminals while keeping the behavior unchanged on others. There are two alternative approaches to fixing the bug that may seem to work at first glance but in fact don't: Instead of sc , use u7 terminal capability to query the current cursor position and then cup to go back to it. This doesn't work because the absolute position of the start of the current prompt changes when text gets reflown. Recompute VD based on new terminal dimensions before attempting to refresh prompt. This doesn't work because Zsh doesn't know whether terminal reflows text or truncates it. If Zsh could somehow know that the terminal reflows text, this approach still wouldn't work on terminals that continuously reflow text and rapid-fire SIGWINCH when the window is being resized. In such environment real terminal dimensions go out of sync with what Zsh thinks the dimensions are. There is no ETA for the patch making its way into upstream Zsh. See discussion . Mitigation There are a few mitigation options for this issue. Apply the patch and rebuild Zsh from source . It won't help if you are using Alacritty, Kitty or some other terminal that reflows text on resize but doesn't reflow saved cursor position. On such terminals the patch will have no visible effect. Disable text reflowing on window resize in terminal settings. If your terminal doesn't have this setting, try a different terminal. Avoid long lines between the start of prompt and cursor. Disable ruler with POWERLEVEL9K_SHOW_RULER=false . Disable prompt connection with POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' ' . Disable right frame with POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX='' , POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX='' and POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX='' . Set POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() . Right prompt on the last prompt line will cause resizing issues only when the cursor is below it. This isn't very common, so you might want to keep some elements in POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS provided that none of them are succeeded by newline . Icons cut off in Konsole When using Konsole with a non-monospace font, icons may be cut off on the right side. Here \"non-monospace\" refers to any font with glyphs wider than a single column, or wider than two columns for glyphs designated as \"wide\" in the Unicode standard. The last line on the screenshot shows a cut off Arch Linux logo. There are several mitigation options for this issue. Use a different terminal. Konsole is the only terminal that exhibits this behavior. Use a monospace font. Manually add an extra space after the icon that gets cut off. For example, if the content of os_icon prompt segment gets cut off, open ~/.p10k.zsh , search for POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION and change it as follows: typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='${P9K_CONTENT} ' # extra space at the end Use a different icon that is monospace. For example, if Arch Linux logo gets cut off, add the following parameter to ~/.p10k.zsh : typeset -g POWERLEVEL9K_LINUX_ARCH_ICON='Arch' # plain \"Arch\" in place of a logo Disable the display of the icon that gets cut off. For example, if the content of os_icon prompt segment gets cut off, open ~/.p10k.zsh and remove os_icon from POWERLEVEL9K_LEFT_PROMPT_ELEMENTS and POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS . Note : Non-monospace fonts are not officially supported by Konsole . Arch Linux logo has a dot in the bottom right corner Some fonts have this incorrect dotted icon in bold typeface. There are two ways to fix this issue. Use a font with a correct Arch Linux logo in bold typeface. For example, the recommended Powerlevel10k font . Display the icon in regular (non-bold) typeface. To do this, open ~/.p10k.zsh , search for POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION and remove %B from its value. typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='${P9K_CONTENT}' # not bold","title":"Troubleshooting"},{"location":"troubleshooting/#troubleshooting","text":"","title":"Troubleshooting"},{"location":"troubleshooting/#question-mark-in-prompt","text":"If it looks like a regular ? , that's normal. It means you have untracked files in the current Git repository. Type git status to see these files. You can change this symbol or disable the display of untracked files altogether. Search for untracked files in ~/.p10k.zsh . FAQ : What do different symbols in Git status mean? You can also get a weird-looking question mark in your prompt if your terminal's font is missing some glyphs. See icons, glyphs or powerline symbols don't render .","title":"Question mark in prompt"},{"location":"troubleshooting/#icons-glyphs-or-powerline-symbols-dont-render","text":"Restart your terminal, install the recommended font and run p10k configure .","title":"Icons, glyphs or powerline symbols don't render"},{"location":"troubleshooting/#sub-pixel-imperfections-around-powerline-symbols","text":"There are three imperfections on the screenshot. From left to right: A thin blue line (a sub-pixel gap) between the content of a prompt segment and the following powerline connection. Incorrect alignment of a powerline connection and the following prompt segment. The connection appears shifted to the right. A thin red line below a powerline connection. The connection appears shifted up. Zsh themes don't have down-to-pixel control over the terminal content. Everything you see on the screen is made of monospace characters. A white powerline prompt segment is made of text on white background followed by U+E0B0 (a right-pointing triangle). If Powerlevel10k prompt has imperfections around powerline symbols, you'll see exactly the same imperfections with all powerline themes (Agnoster, Powerlevel9k, Powerline, etc.) There are several things you can try to deal with these imperfections: Try the recommended font . If you are already using it, switching to another font may help but is unlikely. Change terminal font size one point up or down. For example, in iTerm2 powerline prompt looks perfect at font sizes 11 and 13 but breaks down at 12. Enable builtin powerline glyphs in terminal settings if your terminal supports it (iTerm2 does). Change font hinting and/or anti-aliasing mode in the terminal settings. Shift all text one pixel up/down/left/right if your terminal has an option to do so. Try a different terminal. A more radical solution is to switch to prompt style without background. Type p10k configure and select Lean . This style has a modern lightweight look. As a bonus, it doesn't suffer from rendering imperfections that afflict powerline-style prompt.","title":"Sub-pixel imperfections around powerline symbols"},{"location":"troubleshooting/#error-character-not-in-range","text":"Type echo '\\u276F' . If you get an error saying \"zsh: character not in range\", your locale doesn't support UTF-8. You need to fix it. If you are running Zsh over SSH, see this . If you are running Zsh locally, Google \"set UTF-8 locale in your OS \".","title":"Error: character not in range"},{"location":"troubleshooting/#cursor-is-in-the-wrong-place","text":"Type echo '\\u276F' . If you get an error saying \"zsh: character not in range\", see the previous section . If the echo command prints \u276f but the cursor is still in the wrong place, install the recommended font and run p10k configure . If this doesn't help, add unset ZLE_RPROMPT_INDENT at the bottom of ~/.zshrc . Still having issues? Run the following command to diagnose the problem: () { emulate -L zsh setopt err_return no_unset local text print -rl -- 'Select a part of your prompt from the terminal window and paste it below.' '' read -r '?Prompt: ' text local -i len=${(m)#text} local frame=\"+-${(pl.$len..-.):-}-+\" print -lr -- $frame \"| $text |\" $frame }","title":"Cursor is in the wrong place"},{"location":"troubleshooting/#if-the-prompt-line-aligns-with-the-frame","text":"+------------------------------+ | romka@adam \u2713 ~/powerlevel10k | +------------------------------+ If the output of the command is aligned for every part of your prompt (left and right), this indicates a bug in the theme or your config. Use this command to diagnose it: print -rl -- ${(eq+)PROMPT} ${(eq+)RPROMPT} Look for %{...%} and backslash escapes in the output. If there are any, they are the likely culprits. Open an issue if you get stuck.","title":"If the prompt line aligns with the frame"},{"location":"troubleshooting/#if-the-prompt-line-is-longer-than-the-frame","text":"+-----------------------------+ | romka@adam \u2713 ~/powerlevel10k | +-----------------------------+ This is usually caused by a terminal bug or misconfiguration that makes it print ambiguous-width characters as double-width instead of single width. For example, this issue .","title":"If the prompt line is longer than the frame"},{"location":"troubleshooting/#if-the-prompt-line-is-shorter-than-the-frame-and-is-mangled","text":"+------------------------------+ | romka@adam \u2713~/powerlevel10k | +------------------------------+ Note that this prompt is different from the original as it's missing a space after the check mark. This can be caused by a low-level bug in macOS. See this issue . This can also happen if prompt contains glyphs designated as \"wide\" in the Unicode standard and your terminal incorrectly displays them as non-wide. Terminals suffering from this limitation include Konsole, Hyper and the integrated VSCode Terminal. The solution is to use a different terminal or remove all wide glyphs from prompt.","title":"If the prompt line is shorter than the frame and is mangled"},{"location":"troubleshooting/#if-the-prompt-line-is-shorter-than-the-frame-and-is-not-mangled","text":"+--------------------------------+ | romka@adam \u2713 ~/powerlevel10k | +--------------------------------+ This can be caused by misconfigured locale. See this issue .","title":"If the prompt line is shorter than the frame and is not mangled"},{"location":"troubleshooting/#prompt-wrapping-around-in-a-weird-way","text":"See cursor is in the wrong place .","title":"Prompt wrapping around in a weird way"},{"location":"troubleshooting/#right-prompt-is-in-the-wrong-place","text":"See cursor is in the wrong place .","title":"Right prompt is in the wrong place"},{"location":"troubleshooting/#configuration-wizard-runs-automatically-every-time-zsh-is-started","text":"When Powerlevel10k starts, it automatically runs p10k configure if no POWERLEVEL9K_* parameters are defined. Based on your prompt style choices, the configuration wizard creates ~/.p10k.zsh with a bunch of POWERLEVEL9K_* parameters in it and adds a line to ~/.zshrc to source this file. The next time you start Zsh, the configuration wizard shouldn't run automatically. If it does, this means the evaluation of ~/.zshrc terminates prematurely before it reaches the line that sources ~/.p10k.zsh . This most often happens due to syntax errors in ~/.zshrc . These errors get hidden by the configuration wizard screen, so you don't notice them. When you exit configuration wizard, look for error messages. You can also use POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true zsh to start Zsh without automatically running the configuration wizard. Once you can see the errors, fix ~/.zshrc to get rid of them.","title":"Configuration wizard runs automatically every time Zsh is started"},{"location":"troubleshooting/#some-prompt-styles-are-missing-from-the-configuration-wizard","text":"If Zsh version is below 5.7.1 or COLORTERM environment variable is neither 24bit nor truecolor , configuration wizard won't offer Pure style with Snazzy color scheme. Fix : Install Zsh >= 5.7.1 and use a terminal with truecolor support. Verify with print -P '%F{#ff0000}red%f' . If the terminal can display fewer than 256 colors, configuration wizard preselects Lean style with 8 colors. All other styles require at least 256 colors. Fix : Use a terminal with 256 color support and make sure that TERM environment variable is set correctly. Verify with print $terminfo[colors] . If there is no UTF-8 locale on the system, configuration wizard won't offer prompt styles that use Unicode characters. Fix : Install a UTF-8 locale. Verify with locale -a . When a UTF-8 locale is available, the first few questions asked by the configuration wizard assess capabilities of the terminal font. If your answers indicate that some glyphs don't render correctly, configuration wizard won't offer prompt styles that use them. Fix : Restart your terminal and install the recommended font . Verify by running p10k configure and checking that all glyphs render correctly.","title":"Some prompt styles are missing from the configuration wizard"},{"location":"troubleshooting/#cannot-install-the-recommended-font","text":"Once you download the recommended font , you can install it just like any other font. Google \"how to install fonts on your OS \".","title":"Cannot install the recommended font"},{"location":"troubleshooting/#extra-or-missing-spaces-in-prompt-compared-to-powerlevel9k","text":"tl;dr: Add ZLE_RPROMPT_INDENT=0 and POWERLEVEL9K_LEGACY_ICON_SPACING=true to ~/.zshrc to get the same prompt spacing as in Powerlevel9k. When using Powerlevel10k with a Powerlevel9k config, you might get additional spaces in prompt here and there. These come in two flavors.","title":"Extra or missing spaces in prompt compared to Powerlevel9k"},{"location":"troubleshooting/#extra-space-without-background-on-the-right-side-of-right-prompt","text":"tl;dr: Add ZLE_RPROMPT_INDENT=0 to ~/.zshrc to get rid of that space. From Zsh documentation : ZLE_RPROMPT_INDENT If set, used to give the indentation between the right hand side of the right prompt in the line editor as given by RPS1 or RPROMPT and the right hand side of the screen. If not set, the value 1 is used. Typically this will be used to set the value to 0 so that the prompt appears flush with the right hand side of the screen. Powerlevel10k respects this parameter. If you set ZLE_RPROMPT_INDENT=1 (or leave it unset, which is the same thing as setting it to 1 ), you'll get an empty space to the right of right prompt. If you set ZLE_RPROMPT_INDENT=0 , your prompt will go to the edge of the terminal. This is how it works in every theme except Powerlevel9k. Powerlevel9k issue: powerlevel9k#1292 . It's been fixed in the development branch of Powerlevel9k but the fix hasn't yet made it to master . Add ZLE_RPROMPT_INDENT=0 to ~/.zshrc to get the same spacing on the right edge of prompt as in Powerlevel9k. Note: Several versions of Zsh have bugs that get triggered when you set ZLE_RPROMPT_INDENT=0 . Powerlevel10k can work around these bugs when using powerline prompt style. If you notice visual artifacts in prompt, or wrong cursor position, try removing ZLE_RPROMPT_INDENT from ~/.zshrc .","title":"Extra space without background on the right side of right prompt"},{"location":"troubleshooting/#extra-or-missing-spaces-around-icons","text":"tl;dr: Add POWERLEVEL9K_LEGACY_ICON_SPACING=true to ~/.zshrc to get the same spacing around icons as in Powerlevel9k. Spacing around icons in Powerlevel9k is inconsistent. This inconsistency is a constant source of annoyance, so it was fixed in Powerlevel10k. You can add POWERLEVEL9K_LEGACY_ICON_SPACING=true to ~/.zshrc to get the same spacing around icons as in Powerlevel9k. Note: It's not a good idea to define POWERLEVEL9K_LEGACY_ICON_SPACING when using p10k configure .","title":"Extra or missing spaces around icons"},{"location":"troubleshooting/#weird-things-happen-after-typing-source-zshrc","text":"It's almost always a bad idea to run source ~/.zshrc , whether you are using Powerlevel10k or not. This command may result in random errors, misbehaving code and progressive slowdown of Zsh. If you've made changes to ~/.zshrc or to files sourced by it, restart Zsh to apply them. The most reliable way to do this is to type exit and then start a new Zsh session. You can also use exec zsh . While not exactly equivalent to complete Zsh restart, this command is much more reliable than source ~/.zshrc .","title":"Weird things happen after typing source ~/.zshrc"},{"location":"troubleshooting/#transient-prompt-stops-working-after-some-time","text":"See weird things happen after typing source ~/.zshrc .","title":"Transient prompt stops working after some time"},{"location":"troubleshooting/#cannot-make-powerlevel10k-work-with-my-plugin-manager","text":"If the installation instructions didn't work for you, try disabling your current theme (so that you end up with no theme) and then installing Powerlevel10k manually. Disable the current theme in your framework / plugin manager. oh-my-zsh: Open ~/.zshrc and remove the line that sets ZSH_THEME . It might look like this: ZSH_THEME=\"powerlevel9k/powerlevel9k\" . zplug: Open ~/.zshrc and remove the zplug command that refers to your current theme. For example, if you are currently using Powerlevel9k, look for zplug bhilburn/powerlevel9k, use:powerlevel9k.zsh-theme . prezto: Open ~/.zpreztorc and put zstyle :prezto:module:prompt theme off in it. Remove any other command that sets theme such as zstyle :prezto:module:prompt theme powerlevel9k . antigen: Open ~/.zshrc and remove the line that sets antigen theme . It might look like this: antigen theme powerlevel9k/powerlevel9k . Install Powerlevel10k manually. git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc This method of installation won't make anything slower or otherwise sub-par.","title":"Cannot make Powerlevel10k work with my plugin manager"},{"location":"troubleshooting/#directory-is-difficult-to-see-in-prompt-when-using-rainbow-style","text":"In Rainbow style the current working directory is shown with bright white text on blue background. The white is fixed and always looks the same but the appearance of \"blue\" is defined by your terminal color palette. If it's very light, it may be difficult to see white text on it. There are several ways to fix this. Type p10k configure and choose a more readable prompt style. Change terminal color palette . Try Tango Dark or Solarized Dark, or change just the \"blue\" color. Change directory background and/or foreground color . The parameters you are looking for are called POWERLEVEL9K_DIR_BACKGROUND , POWERLEVEL9K_DIR_FOREGROUND , POWERLEVEL9K_DIR_SHORTENED_FOREGROUND , POWERLEVEL9K_DIR_ANCHOR_FOREGROUND and POWERLEVEL9K_DIR_ANCHOR_BOLD . You can find them in in ~/.p10k.zsh .","title":"Directory is difficult to see in prompt when using Rainbow style"},{"location":"troubleshooting/#horrific-mess-when-resizing-terminal-window","text":"When you resize terminal window horizontally back and forth a few times, you might see this ugly picture. tl;dr: This is a bug in Zsh that isn't specific to Powerlevel10k. See mitigation .","title":"Horrific mess when resizing terminal window"},{"location":"troubleshooting/#zsh-bug","text":"This issue is caused by a bug in Zsh that gets triggered when the vertical distance between the start of the current prompt and the cursor (henceforth VD ) changes when the terminal window is resized. This bug is not specific to Powerlevel10k. When a terminal window gets shrunk horizontally, there are two ways for a terminal to handle long lines that no longer fit: reflow or truncate . Terminal content before shrinking: Terminal reflows text when shrinking: Terminal truncates text when shrinking: Reflowing strategy can change the height of terminal content. If such content happens to be between the start of the current prompt and the cursor, Zsh will print prompt on the wrong line. Truncation strategy never changes the height of terminal content, so it doesn't trigger this bug in Zsh. Let's see how the bug plays out in slow motion. We'll start by launching zsh -df and pasting the following code: function pause() { read -s } functions -M pause 0 reset print -l {1..3} setopt prompt_subst PROMPT=$'${$((pause()))+}left>${(pl.$((COLUMNS-12))..-.)} ' When PROMPT gets expanded, it calls pause to let us observe the state of the terminal. Here's the initial state: Zsh keeps track of the cursor position relative to the start of the current prompt. In this case it knows that the cursor is one line below. When we shrink the terminal window, it looks like this: At this point the terminal sends SIGWINCH to Zsh to notify it about changes in the terminal dimensions. Note that this signal is sent after the content of the terminal has been reflown. When Zsh receives SIGWINCH , it attempts to erase the current prompt and print it anew. It goes to the position where it thinks the current prompt is -- one line above the cursor (!) -- erases all terminal content that follows and prints reexpanded prompt there. However, after resizing prompt is no longer one line above the cursor. It's two lines above! Zsh ends up printing new prompt one line too low. In this case we ended up with unwanted junk content because VD has increased . When you make terminal window wider, VD can also decrease , which would result in the new prompt being printed higher than intended, potentially erasing useful content in the process. Here are a few more examples where shrinking terminal window increased VD . Simple one-line left prompt with right prompt. No prompt_subst . Note that the cursor is below the prompt line (hit ESC-ENTER to get it there). Simple one-line left prompt. No prompt_subst , no right prompt. Here VD is bound to increase upon terminal shrinking due to the command line wrapping around.","title":"Zsh bug"},{"location":"troubleshooting/#zsh-patch","text":"The bug described above has been partially fixed (only for some terminals) in this branch . The idea behind the fix is to use sc (save cursor) terminal capability before printing prompt and rc (restore cursor) to move cursor back to the original position when prompt needs to be refreshed. The patch works only on terminals that reflow saved cursor position together with text when the terminal window is resized. The patch has no observable effect on terminals that don't reflow text on resize (both patched and unpatched Zsh behave correctly) and on terminals that reflow text but not saved cursor position (both patched and unpatched Zsh redraw prompt at the same incorrect position). In other words, the patch fixes the resizing issue on some terminals while keeping the behavior unchanged on others. There are two alternative approaches to fixing the bug that may seem to work at first glance but in fact don't: Instead of sc , use u7 terminal capability to query the current cursor position and then cup to go back to it. This doesn't work because the absolute position of the start of the current prompt changes when text gets reflown. Recompute VD based on new terminal dimensions before attempting to refresh prompt. This doesn't work because Zsh doesn't know whether terminal reflows text or truncates it. If Zsh could somehow know that the terminal reflows text, this approach still wouldn't work on terminals that continuously reflow text and rapid-fire SIGWINCH when the window is being resized. In such environment real terminal dimensions go out of sync with what Zsh thinks the dimensions are. There is no ETA for the patch making its way into upstream Zsh. See discussion .","title":"Zsh patch"},{"location":"troubleshooting/#mitigation","text":"There are a few mitigation options for this issue. Apply the patch and rebuild Zsh from source . It won't help if you are using Alacritty, Kitty or some other terminal that reflows text on resize but doesn't reflow saved cursor position. On such terminals the patch will have no visible effect. Disable text reflowing on window resize in terminal settings. If your terminal doesn't have this setting, try a different terminal. Avoid long lines between the start of prompt and cursor. Disable ruler with POWERLEVEL9K_SHOW_RULER=false . Disable prompt connection with POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' ' . Disable right frame with POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX='' , POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX='' and POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX='' . Set POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() . Right prompt on the last prompt line will cause resizing issues only when the cursor is below it. This isn't very common, so you might want to keep some elements in POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS provided that none of them are succeeded by newline .","title":"Mitigation"},{"location":"troubleshooting/#icons-cut-off-in-konsole","text":"When using Konsole with a non-monospace font, icons may be cut off on the right side. Here \"non-monospace\" refers to any font with glyphs wider than a single column, or wider than two columns for glyphs designated as \"wide\" in the Unicode standard. The last line on the screenshot shows a cut off Arch Linux logo. There are several mitigation options for this issue. Use a different terminal. Konsole is the only terminal that exhibits this behavior. Use a monospace font. Manually add an extra space after the icon that gets cut off. For example, if the content of os_icon prompt segment gets cut off, open ~/.p10k.zsh , search for POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION and change it as follows: typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='${P9K_CONTENT} ' # extra space at the end Use a different icon that is monospace. For example, if Arch Linux logo gets cut off, add the following parameter to ~/.p10k.zsh : typeset -g POWERLEVEL9K_LINUX_ARCH_ICON='Arch' # plain \"Arch\" in place of a logo Disable the display of the icon that gets cut off. For example, if the content of os_icon prompt segment gets cut off, open ~/.p10k.zsh and remove os_icon from POWERLEVEL9K_LEFT_PROMPT_ELEMENTS and POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS . Note : Non-monospace fonts are not officially supported by Konsole .","title":"Icons cut off in Konsole"},{"location":"troubleshooting/#arch-linux-logo-has-a-dot-in-the-bottom-right-corner","text":"Some fonts have this incorrect dotted icon in bold typeface. There are two ways to fix this issue. Use a font with a correct Arch Linux logo in bold typeface. For example, the recommended Powerlevel10k font . Display the icon in regular (non-bold) typeface. To do this, open ~/.p10k.zsh , search for POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION and remove %B from its value. typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='${P9K_CONTENT}' # not bold","title":"Arch Linux logo has a dot in the bottom right corner"},{"location":"try_docker/","text":"Try it in Docker Try Powerlevel10k in Docker. You can safely make any changes to the file system while trying out the theme. Once you exit Zsh, the image is deleted. docker run -e TERM -e COLORTERM -it --rm alpine sh -uec ' apk update apk add git zsh nano vim git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k echo \"source ~/powerlevel10k/powerlevel10k.zsh-theme\" >>~/.zshrc cd ~/powerlevel10k exec zsh' Tip : Install the recommended font before running the Docker command to get access to all prompt styles. Tip : Run p10k configure while in Docker to try a different prompt style.","title":"Try it in Docker"},{"location":"try_docker/#try-it-in-docker","text":"Try Powerlevel10k in Docker. You can safely make any changes to the file system while trying out the theme. Once you exit Zsh, the image is deleted. docker run -e TERM -e COLORTERM -it --rm alpine sh -uec ' apk update apk add git zsh nano vim git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k echo \"source ~/powerlevel10k/powerlevel10k.zsh-theme\" >>~/.zshrc cd ~/powerlevel10k exec zsh' Tip : Install the recommended font before running the Docker command to get access to all prompt styles. Tip : Run p10k configure while in Docker to try a different prompt style.","title":"Try it in Docker"},{"location":"features/batteries_included/","text":"Batteries included Powerlevel10k comes with dozens of built-in high quality segments. When you run p10k configure and choose any style except Pure , many of these segments get enabled by default while others be manually enabled by opening ~/.p10k.zsh and uncommenting them. You can enable as many segments as you like. It won't slow down your prompt or Zsh startup. Segment Meaning os_icon your OS logo (apple for macOS, swirl for debian, etc.) dir current working directory vcs Git repository status prompt_char multi-functional prompt symbol; changes depending on vi mode: \u276f , \u276e , V , \u25b6 for insert, command, visual and replace mode respectively; turns red on error context user@hostname status exit code of the last command command_execution_time duration (wall time) of the last command background_jobs presence of background jobs time current time direnv direnv status asdf tool versions from asdf virtualenv python environment from venv anaconda virtual environment from conda pyenv python environment from pyenv goenv go environment from goenv nodenv node.js environment from nodenv nvm node.js environment from nvm nodeenv node.js environment from nodeenv rbenv ruby environment from rbenv rvm ruby environment from rvm fvm flutter environment from fvm luaenv lua environment from luaenv jenv java environment from jenv plenv perl environment from plenv phpenv php environment from phpenv haskell_stack haskell version from stack node_version node.js version go_version go version rust_version rustc version dotnet_version dotnet version php_version php version laravel_version laravel php framework version java_version java version package name@version from package.json kubecontext current kubernetes context terraform terraform workspace aws aws profile aws_eb_env aws elastic beanstalk environment azure azure account name gcloud google cloud cli account and project google_app_cred google application credentials nordvpn nordvpn connection status ranger ranger shell nnn nnn shell vim_shell vim shell ( :sh ) midnight_commander midnight commander shell nix_shell nix shell indicator todo todo items timewarrior timewarrior tracking status taskwarrior taskwarrior task count vpn_ip virtual private network indicator ip IP address and bandwidth usage for a specified network interface load CPU load disk_usage disk usage ram free RAM swap used swap public_ip public IP address proxy system-wide http/https/ftp proxy wifi WiFi speed battery internal battery state and charge level (yep, batteries literally included)","title":"Batteries included"},{"location":"features/batteries_included/#batteries-included","text":"Powerlevel10k comes with dozens of built-in high quality segments. When you run p10k configure and choose any style except Pure , many of these segments get enabled by default while others be manually enabled by opening ~/.p10k.zsh and uncommenting them. You can enable as many segments as you like. It won't slow down your prompt or Zsh startup. Segment Meaning os_icon your OS logo (apple for macOS, swirl for debian, etc.) dir current working directory vcs Git repository status prompt_char multi-functional prompt symbol; changes depending on vi mode: \u276f , \u276e , V , \u25b6 for insert, command, visual and replace mode respectively; turns red on error context user@hostname status exit code of the last command command_execution_time duration (wall time) of the last command background_jobs presence of background jobs time current time direnv direnv status asdf tool versions from asdf virtualenv python environment from venv anaconda virtual environment from conda pyenv python environment from pyenv goenv go environment from goenv nodenv node.js environment from nodenv nvm node.js environment from nvm nodeenv node.js environment from nodeenv rbenv ruby environment from rbenv rvm ruby environment from rvm fvm flutter environment from fvm luaenv lua environment from luaenv jenv java environment from jenv plenv perl environment from plenv phpenv php environment from phpenv haskell_stack haskell version from stack node_version node.js version go_version go version rust_version rustc version dotnet_version dotnet version php_version php version laravel_version laravel php framework version java_version java version package name@version from package.json kubecontext current kubernetes context terraform terraform workspace aws aws profile aws_eb_env aws elastic beanstalk environment azure azure account name gcloud google cloud cli account and project google_app_cred google application credentials nordvpn nordvpn connection status ranger ranger shell nnn nnn shell vim_shell vim shell ( :sh ) midnight_commander midnight commander shell nix_shell nix shell indicator todo todo items timewarrior timewarrior tracking status taskwarrior taskwarrior task count vpn_ip virtual private network indicator ip IP address and bandwidth usage for a specified network interface load CPU load disk_usage disk usage ram free RAM swap used swap public_ip public IP address proxy system-wide http/https/ftp proxy wifi WiFi speed battery internal battery state and charge level (yep, batteries literally included)","title":"Batteries included"},{"location":"features/current_directory/","text":"Current directory that just works The current working directory is perhaps the most important prompt segment. Powerlevel10k goes to great length to highlight its important parts and to truncate it with the least loss of information when horizontal space gets scarce. When the full directory doesn't fit, the leftmost segment gets truncated to its shortest unique prefix. In the screencast, ~/work becomes ~/wo . It couldn't be truncated to ~/w because it would be ambiguous (there was ~/wireguard when the session was recorded). The next segment -- projects -- turns into p as there was nothing else that started with p in ~/work/ . Directory segments are shown in one of three colors: Truncated segments are bleak. Important segments are bright and never truncated. These include the first and the last segment, roots of Git repositories, etc. Regular segments (not truncated but can be) use in-between color. Tip : If you copy-paste a truncated directory and hit TAB , it'll complete to the original. Troubleshooting : Directory is difficult to see in prompt when using Rainbow style.","title":"Current Directory that just works"},{"location":"features/current_directory/#current-directory-that-just-works","text":"The current working directory is perhaps the most important prompt segment. Powerlevel10k goes to great length to highlight its important parts and to truncate it with the least loss of information when horizontal space gets scarce. When the full directory doesn't fit, the leftmost segment gets truncated to its shortest unique prefix. In the screencast, ~/work becomes ~/wo . It couldn't be truncated to ~/w because it would be ambiguous (there was ~/wireguard when the session was recorded). The next segment -- projects -- turns into p as there was nothing else that started with p in ~/work/ . Directory segments are shown in one of three colors: Truncated segments are bleak. Important segments are bright and never truncated. These include the first and the last segment, roots of Git repositories, etc. Regular segments (not truncated but can be) use in-between color. Tip : If you copy-paste a truncated directory and hit TAB , it'll complete to the original. Troubleshooting : Directory is difficult to see in prompt when using Rainbow style.","title":"Current directory that just works"},{"location":"features/customizable/","text":"Extremely customizable Powerlevel10k can be configured to look like any other Zsh theme out there. Pure , Powerlevel9k and robbyrussell emulations are built-in. To emulate the appearance of other themes, you'll need to write a suitable configuration file. The best way to go about it is to run p10k configure , select the style that is the closest to your goal and then edit ~/.p10k.zsh . The full range of Powerlevel10k appearance spans from spartan: To ~~ridiculous~~ extravagant:","title":"Extremely Customizable"},{"location":"features/customizable/#extremely-customizable","text":"Powerlevel10k can be configured to look like any other Zsh theme out there. Pure , Powerlevel9k and robbyrussell emulations are built-in. To emulate the appearance of other themes, you'll need to write a suitable configuration file. The best way to go about it is to run p10k configure , select the style that is the closest to your goal and then edit ~/.p10k.zsh . The full range of Powerlevel10k appearance spans from spartan: To ~~ridiculous~~ extravagant:","title":"Extremely customizable"},{"location":"features/extensible/","text":"Extensible If there is no prompt segment that does what you need, implement your own. Powerlevel10k provides public API for defining segments that are as fast and as flexible as built-in ones. On Linux you can fetch current CPU temperature by reading /sys/class/thermal/thermal_zone0/temp . The screencast shows how to define a prompt segment to display this value. Once the segment is defined, you can use it like any other segment. All standard customization parameters will work for it out of the box. Type p10k help segment for reference. Tip : Prefix names of your own segments with my_ to avoid clashes with future versions of Powerlevel10k.","title":"Extensible"},{"location":"features/extensible/#extensible","text":"If there is no prompt segment that does what you need, implement your own. Powerlevel10k provides public API for defining segments that are as fast and as flexible as built-in ones. On Linux you can fetch current CPU temperature by reading /sys/class/thermal/thermal_zone0/temp . The screencast shows how to define a prompt segment to display this value. Once the segment is defined, you can use it like any other segment. All standard customization parameters will work for it out of the box. Type p10k help segment for reference. Tip : Prefix names of your own segments with my_ to avoid clashes with future versions of Powerlevel10k.","title":"Extensible"},{"location":"features/instant_prompt/","text":"Instant prompt If your ~/.zshrc loads many plugins, or perhaps just a few slow ones (for example, pyenv or nvm ), you may have noticed that it takes some time for Zsh to start. Powerlevel10k can remove Zsh startup lag even if it's not caused by a theme . This feature is called Instant Prompt . You need to explicitly enable it through p10k configure or manually . It does what it says on the tin -- prints prompt instantly upon Zsh startup allowing you to start typing while plugins are still loading. Other themes increase Zsh startup lag -- some by a lot, others by a just a little. Powerlevel10k removes it outright. FAQ: How do I enable instant prompt?","title":"Instant prompt"},{"location":"features/instant_prompt/#instant-prompt","text":"If your ~/.zshrc loads many plugins, or perhaps just a few slow ones (for example, pyenv or nvm ), you may have noticed that it takes some time for Zsh to start. Powerlevel10k can remove Zsh startup lag even if it's not caused by a theme . This feature is called Instant Prompt . You need to explicitly enable it through p10k configure or manually . It does what it says on the tin -- prints prompt instantly upon Zsh startup allowing you to start typing while plugins are still loading. Other themes increase Zsh startup lag -- some by a lot, others by a just a little. Powerlevel10k removes it outright. FAQ: How do I enable instant prompt?","title":"Instant prompt"},{"location":"features/p9k_compatibility/","text":"Powerlevel9k compatibility Powerlevel10k understands all Powerlevel9k configuration parameters. Migration from Powerlevel9k to Powerlevel10k is a straightforward process. All your POWERLEVEL9K configuration parameters will still work. Prompt will look the same as before ( almost ) but it will be much faster ( certainly ). FAQ : I'm using Powerlevel9k with Oh My Zsh. How do I migrate? Does Powerlevel10k always render exactly the same prompt as Powerlevel9k given the same config? What is the relationship between Powerlevel9k and Powerlevel10k?","title":"Powerlevel9k Compatibility"},{"location":"features/p9k_compatibility/#powerlevel9k-compatibility","text":"Powerlevel10k understands all Powerlevel9k configuration parameters. Migration from Powerlevel9k to Powerlevel10k is a straightforward process. All your POWERLEVEL9K configuration parameters will still work. Prompt will look the same as before ( almost ) but it will be much faster ( certainly ). FAQ : I'm using Powerlevel9k with Oh My Zsh. How do I migrate? Does Powerlevel10k always render exactly the same prompt as Powerlevel9k given the same config? What is the relationship between Powerlevel9k and Powerlevel10k?","title":"Powerlevel9k compatibility"},{"location":"features/pure_compatibility/","text":"Pure compatibility Powerlevel10k can produce the same prompt as Pure . Type p10k configure and select Pure style. You can still use Powerlevel10k features such as transient prompt or instant prompt when sporting Pure style. To customize prompt, edit ~/.p10k.zsh . Powerlevel10k doesn't recognize Pure configuration parameters, so you'll need to use POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3 instead of PURE_CMD_MAX_EXEC_TIME=3 , etc. All relevant parameters are in ~/.p10k.zsh . This file has plenty of comments to help you navigate through it. FAQ: What is the best prompt style in the configuration wizard?","title":"Pure compatibility"},{"location":"features/pure_compatibility/#pure-compatibility","text":"Powerlevel10k can produce the same prompt as Pure . Type p10k configure and select Pure style. You can still use Powerlevel10k features such as transient prompt or instant prompt when sporting Pure style. To customize prompt, edit ~/.p10k.zsh . Powerlevel10k doesn't recognize Pure configuration parameters, so you'll need to use POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3 instead of PURE_CMD_MAX_EXEC_TIME=3 , etc. All relevant parameters are in ~/.p10k.zsh . This file has plenty of comments to help you navigate through it. FAQ: What is the best prompt style in the configuration wizard?","title":"Pure compatibility"},{"location":"features/show_on_command/","text":"Show on command The behavior of some commands depends on global environment. For example, kubectl run ... runs an image on the cluster defined by the current kubernetes context. If you frequently change context between \"prod\" and \"testing\", you might want to display the current context in Zsh prompt. If you do likewise for AWS, Azure and Google Cloud credentials, prompt will get pretty crowded. Enter Show On Command . This feature makes prompt segments appear only when they are relevant to the command you are currently typing. Configs created by p10k configure enable show on command for several prompt segments by default. Here's the relevant parameter for kubernetes context: # Show prompt segment \"kubecontext\" only when the command you are typing # invokes kubectl, helm, kubens, kubectx, oc, istioctl, kogito, k9s or helmfile. typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile' To customize when different prompt segments are shown, open ~/.p10k.zsh , search for SHOW_ON_COMMAND and either remove these parameters to display affected segments unconditionally, or change their values.","title":"Show on command"},{"location":"features/show_on_command/#show-on-command","text":"The behavior of some commands depends on global environment. For example, kubectl run ... runs an image on the cluster defined by the current kubernetes context. If you frequently change context between \"prod\" and \"testing\", you might want to display the current context in Zsh prompt. If you do likewise for AWS, Azure and Google Cloud credentials, prompt will get pretty crowded. Enter Show On Command . This feature makes prompt segments appear only when they are relevant to the command you are currently typing. Configs created by p10k configure enable show on command for several prompt segments by default. Here's the relevant parameter for kubernetes context: # Show prompt segment \"kubecontext\" only when the command you are typing # invokes kubectl, helm, kubens, kubectx, oc, istioctl, kogito, k9s or helmfile. typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile' To customize when different prompt segments are shown, open ~/.p10k.zsh , search for SHOW_ON_COMMAND and either remove these parameters to display affected segments unconditionally, or change their values.","title":"Show on command"},{"location":"features/transient_prompt/","text":"Transient prompt When Transient Prompt is enabled through p10k configure , Powerlevel10k will trim down every prompt when accepting a command line. Transient prompt makes it much easier to copy-paste series of commands from the terminal scrollback. Tip : If you enable transient prompt, take advantage of two-line prompt. You'll get the benefit of extra space for typing commands without the usual drawback of reduced scrollback density. Sparse prompt (with an empty line before prompt) also works great in combination with transient prompt.","title":"Transient prompt"},{"location":"features/transient_prompt/#transient-prompt","text":"When Transient Prompt is enabled through p10k configure , Powerlevel10k will trim down every prompt when accepting a command line. Transient prompt makes it much easier to copy-paste series of commands from the terminal scrollback. Tip : If you enable transient prompt, take advantage of two-line prompt. You'll get the benefit of extra space for typing commands without the usual drawback of reduced scrollback density. Sparse prompt (with an empty line before prompt) also works great in combination with transient prompt.","title":"Transient prompt"},{"location":"features/uncompromising_performance/","text":"Uncompromising performance When you hit ENTER , the next prompt appears instantly. With Powerlevel10k there is no prompt lag. If you install Cygwin on Raspberry Pi, cd into a Linux Git repository and activate enough prompt segments to fill four prompt lines on both sides of the screen... wait, that's just crazy and no one ever does that. Probably impossible, too. The point is, Powerlevel10k prompt is always fast, no matter what you do! Note how the effect of every command is instantly reflected by the very next prompt. Command Prompt Indicator Meaning timew start hack linux \ud83d\udee1\ufe0f hack linux time tracking enabled in timewarrior touch x y ?2 2 untracked files in the Git repo rm COPYING !1 1 unstaged change in the Git repo echo 3.7.3 >.python-version \ud83d\udc0d 3.7.3 the current python version in pyenv Other Zsh themes capable of displaying the same information either produce prompt lag or print prompt that doesn't reflect the current state of the system and then refresh it later. With Powerlevel10k you get fast prompt and up-to-date information. FAQ : Is it really fast?","title":"Uncompromising performance"},{"location":"features/uncompromising_performance/#uncompromising-performance","text":"When you hit ENTER , the next prompt appears instantly. With Powerlevel10k there is no prompt lag. If you install Cygwin on Raspberry Pi, cd into a Linux Git repository and activate enough prompt segments to fill four prompt lines on both sides of the screen... wait, that's just crazy and no one ever does that. Probably impossible, too. The point is, Powerlevel10k prompt is always fast, no matter what you do! Note how the effect of every command is instantly reflected by the very next prompt. Command Prompt Indicator Meaning timew start hack linux \ud83d\udee1\ufe0f hack linux time tracking enabled in timewarrior touch x y ?2 2 untracked files in the Git repo rm COPYING !1 1 unstaged change in the Git repo echo 3.7.3 >.python-version \ud83d\udc0d 3.7.3 the current python version in pyenv Other Zsh themes capable of displaying the same information either produce prompt lag or print prompt that doesn't reflect the current state of the system and then refresh it later. With Powerlevel10k you get fast prompt and up-to-date information. FAQ : Is it really fast?","title":"Uncompromising performance"},{"location":"features/wizard/","text":"Configuration wizard Type p10k configure to access the builtin configuration wizard right from your terminal. All styles except Pure are functionally equivalent. They display the same information and differ only in presentation. Configuration wizard creates ~/.p10k.zsh based on your preferences. Additional prompt customization can be done by editing this file. It has plenty of comments to help you navigate through configuration options. Tip : Install the recommended font before running p10k configure to unlock all prompt styles. FAQ: What is the best prompt style in the configuration wizard? What do different symbols in Git status mean? How do I change prompt colors? Troubleshooting : Some prompt styles are missing from the configuration wizard . Question mark in prompt . Icons, glyphs or powerline symbols don't render . Sub-pixel imperfections around powerline symbols . Directory is difficult to see in prompt when using Rainbow style .","title":"Configuration wizard"},{"location":"features/wizard/#configuration-wizard","text":"Type p10k configure to access the builtin configuration wizard right from your terminal. All styles except Pure are functionally equivalent. They display the same information and differ only in presentation. Configuration wizard creates ~/.p10k.zsh based on your preferences. Additional prompt customization can be done by editing this file. It has plenty of comments to help you navigate through configuration options. Tip : Install the recommended font before running p10k configure to unlock all prompt styles. FAQ: What is the best prompt style in the configuration wizard? What do different symbols in Git status mean? How do I change prompt colors? Troubleshooting : Some prompt styles are missing from the configuration wizard . Question mark in prompt . Icons, glyphs or powerline symbols don't render . Sub-pixel imperfections around powerline symbols . Directory is difficult to see in prompt when using Rainbow style .","title":"Configuration wizard"}]}
\ No newline at end of file
diff --git a/docs/search/worker.js b/docs/search/worker.js
new file mode 100644
index 00000000..9cce2f79
--- /dev/null
+++ b/docs/search/worker.js
@@ -0,0 +1,130 @@
+var base_path = 'function' === typeof importScripts ? '.' : '/search/';
+var allowSearch = false;
+var index;
+var documents = {};
+var lang = ['en'];
+var data;
+
+function getScript(script, callback) {
+ console.log('Loading script: ' + script);
+ $.getScript(base_path + script).done(function () {
+ callback();
+ }).fail(function (jqxhr, settings, exception) {
+ console.log('Error: ' + exception);
+ });
+}
+
+function getScriptsInOrder(scripts, callback) {
+ if (scripts.length === 0) {
+ callback();
+ return;
+ }
+ getScript(scripts[0], function() {
+ getScriptsInOrder(scripts.slice(1), callback);
+ });
+}
+
+function loadScripts(urls, callback) {
+ if( 'function' === typeof importScripts ) {
+ importScripts.apply(null, urls);
+ callback();
+ } else {
+ getScriptsInOrder(urls, callback);
+ }
+}
+
+function onJSONLoaded () {
+ data = JSON.parse(this.responseText);
+ var scriptsToLoad = ['lunr.js'];
+ if (data.config && data.config.lang && data.config.lang.length) {
+ lang = data.config.lang;
+ }
+ if (lang.length > 1 || lang[0] !== "en") {
+ scriptsToLoad.push('lunr.stemmer.support.js');
+ if (lang.length > 1) {
+ scriptsToLoad.push('lunr.multi.js');
+ }
+ for (var i=0; i < lang.length; i++) {
+ if (lang[i] != 'en') {
+ scriptsToLoad.push(['lunr', lang[i], 'js'].join('.'));
+ }
+ }
+ }
+ loadScripts(scriptsToLoad, onScriptsLoaded);
+}
+
+function onScriptsLoaded () {
+ console.log('All search scripts loaded, building Lunr index...');
+ if (data.config && data.config.separator && data.config.separator.length) {
+ lunr.tokenizer.separator = new RegExp(data.config.separator);
+ }
+
+ if (data.index) {
+ index = lunr.Index.load(data.index);
+ data.docs.forEach(function (doc) {
+ documents[doc.location] = doc;
+ });
+ console.log('Lunr pre-built index loaded, search ready');
+ } else {
+ index = lunr(function () {
+ if (lang.length === 1 && lang[0] !== "en" && lunr[lang[0]]) {
+ this.use(lunr[lang[0]]);
+ } else if (lang.length > 1) {
+ this.use(lunr.multiLanguage.apply(null, lang)); // spread operator not supported in all browsers: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator#Browser_compatibility
+ }
+ this.field('title');
+ this.field('text');
+ this.ref('location');
+
+ for (var i=0; i < data.docs.length; i++) {
+ var doc = data.docs[i];
+ this.add(doc);
+ documents[doc.location] = doc;
+ }
+ });
+ console.log('Lunr index built, search ready');
+ }
+ allowSearch = true;
+ postMessage({config: data.config});
+ postMessage({allowSearch: allowSearch});
+}
+
+function init () {
+ var oReq = new XMLHttpRequest();
+ oReq.addEventListener("load", onJSONLoaded);
+ var index_path = base_path + '/search_index.json';
+ if( 'function' === typeof importScripts ){
+ index_path = 'search_index.json';
+ }
+ oReq.open("GET", index_path);
+ oReq.send();
+}
+
+function search (query) {
+ if (!allowSearch) {
+ console.error('Assets for search still loading');
+ return;
+ }
+
+ var resultDocuments = [];
+ var results = index.search(query);
+ for (var i=0; i < results.length; i++){
+ var result = results[i];
+ doc = documents[result.ref];
+ doc.summary = doc.text.substring(0, 200);
+ resultDocuments.push(doc);
+ }
+ return resultDocuments;
+}
+
+if( 'function' === typeof importScripts ) {
+ onmessage = function (e) {
+ if (e.data.init) {
+ init();
+ } else if (e.data.query) {
+ postMessage({ results: search(e.data.query) });
+ } else {
+ console.error("Worker - Unrecognized message: " + e);
+ }
+ };
+}
diff --git a/docs/sitemap.xml b/docs/sitemap.xml
new file mode 100644
index 00000000..77d419ba
--- /dev/null
+++ b/docs/sitemap.xml
@@ -0,0 +1,63 @@
+
+
+ None
+ 2020-11-22
+ daily
+
+ None
+ 2020-11-22
+ daily
+
+ None
+ 2020-11-22
+ daily
+
+ None
+ 2020-11-22
+ daily
+
+ None
+ 2020-11-22
+ daily
+
+ None
+ 2020-11-22
+ daily
+
+ None
+ 2020-11-22
+ daily
+
+ None
+ 2020-11-22
+ daily
+
+ None
+ 2020-11-22
+ daily
+
+ None
+ 2020-11-22
+ daily
+
+ None
+ 2020-11-22
+ daily
+
+ None
+ 2020-11-22
+ daily
+
+ None
+ 2020-11-22
+ daily
+
+ None
+ 2020-11-22
+ daily
+
+ None
+ 2020-11-22
+ daily
+
+
\ No newline at end of file
diff --git a/docs/sitemap.xml.gz b/docs/sitemap.xml.gz
new file mode 100644
index 00000000..84e6bda1
Binary files /dev/null and b/docs/sitemap.xml.gz differ
diff --git a/docs/troubleshooting/index.html b/docs/troubleshooting/index.html
new file mode 100644
index 00000000..5c05385e
--- /dev/null
+++ b/docs/troubleshooting/index.html
@@ -0,0 +1,672 @@
+
+
+
+
+
+
+
+
+
+
+ Troubleshooting - Powerlevel10k
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
If it looks like a regular ?, that's normal. It means you have untracked files in the current Git
+repository. Type git status to see these files. You can change this symbol or disable the display
+of untracked files altogether. Search for untracked files in ~/.p10k.zsh.
There are three imperfections on the screenshot. From left to right:
+
+
A thin blue line (a sub-pixel gap) between the content of a prompt segment and the following
+ powerline connection.
+
Incorrect alignment of a powerline connection and the following prompt segment. The connection
+ appears shifted to the right.
+
A thin red line below a powerline connection. The connection appears shifted up.
+
+
Zsh themes don't have down-to-pixel control over the terminal content. Everything you see on the
+screen is made of monospace characters. A white powerline prompt segment is made of text on white
+background followed by U+E0B0 (a right-pointing triangle).
+
+
If Powerlevel10k prompt has imperfections around powerline symbols, you'll see exactly the same
+imperfections with all powerline themes (Agnoster, Powerlevel9k, Powerline, etc.)
+
There are several things you can try to deal with these imperfections:
+
+
Try the recommended font. If you are already using
+ it, switching to another font may help but is unlikely.
+
Change terminal font size one point up or down. For example, in iTerm2 powerline prompt looks
+ perfect at font sizes 11 and 13 but breaks down at 12.
+
Enable builtin powerline glyphs in terminal settings if your terminal supports it (iTerm2 does).
+
Change font hinting and/or anti-aliasing mode in the terminal settings.
+
Shift all text one pixel up/down/left/right if your terminal has an option to do so.
+
Try a different terminal.
+
+
A more radical solution is to switch to prompt style without background. Type p10k configure and
+select Lean. This style has a modern lightweight look. As a bonus, it doesn't suffer from
+rendering imperfections that afflict powerline-style prompt.
+
Error: character not in range
+
Type echo '\u276F'. If you get an error saying "zsh: character not in range", your locale
+doesn't support UTF-8. You need to fix it. If you are running Zsh over SSH, see
+this. If you are
+running Zsh locally, Google "set UTF-8 locale in your OS".
+
Cursor is in the wrong place
+
Type echo '\u276F'. If you get an error saying "zsh: character not in range", see the
+previous section.
+
If the echo command prints ❯ but the cursor is still in the wrong place, install
+the recommended font and run
+p10k configure.
+
If this doesn't help, add unset ZLE_RPROMPT_INDENT at the bottom of ~/.zshrc.
+
Still having issues? Run the following command to diagnose the problem:
+
() {
+ emulate -L zsh
+ setopt err_return no_unset
+ local text
+ print -rl -- 'Select a part of your prompt from the terminal window and paste it below.' ''
+ read -r '?Prompt: ' text
+ local -i len=${(m)#text}
+ local frame="+-${(pl.$len..-.):-}-+"
+ print -lr -- $frame "| $text |" $frame
+}
+
If the output of the command is aligned for every part of your prompt (left and right), this
+indicates a bug in the theme or your config. Use this command to diagnose it:
+
print -rl -- ${(eq+)PROMPT} ${(eq+)RPROMPT}
+
+
+
Look for %{...%} and backslash escapes in the output. If there are any, they are the likely
+culprits. Open an issue if you get stuck.
This is usually caused by a terminal bug or misconfiguration that makes it print ambiguous-width
+characters as double-width instead of single width. For example,
+this issue.
+
If the prompt line is shorter than the frame and is mangled
Note that this prompt is different from the original as it's missing a space after the check mark.
+
This can be caused by a low-level bug in macOS. See
+this issue.
+
This can also happen if prompt contains glyphs designated as "wide" in the Unicode standard and your
+terminal incorrectly displays them as non-wide. Terminals suffering from this limitation include
+Konsole, Hyper and the integrated VSCode Terminal. The solution is to use a different terminal or
+remove all wide glyphs from prompt.
+
If the prompt line is shorter than the frame and is not mangled
Configuration wizard runs automatically every time Zsh is started
+
When Powerlevel10k starts, it automatically runs p10k configure if no POWERLEVEL9K_*
+parameters are defined. Based on your prompt style choices, the configuration wizard creates
+~/.p10k.zsh with a bunch of POWERLEVEL9K_* parameters in it and adds a line to ~/.zshrc to
+source this file. The next time you start Zsh, the configuration wizard shouldn't run automatically.
+If it does, this means the evaluation of ~/.zshrc terminates prematurely before it reaches the
+line that sources ~/.p10k.zsh. This most often happens due to syntax errors in ~/.zshrc. These
+errors get hidden by the configuration wizard screen, so you don't notice them. When you exit
+configuration wizard, look for error messages. You can also use
+POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true zsh to start Zsh without automatically running the
+configuration wizard. Once you can see the errors, fix ~/.zshrc to get rid of them.
+
Some prompt styles are missing from the configuration wizard
+
If Zsh version is below 5.7.1 or COLORTERM environment variable is neither 24bit nor
+truecolor, configuration wizard won't offer Pure style with Snazzy color scheme. Fix: Install
+Zsh >= 5.7.1 and use a terminal with truecolor support. Verify with print -P '%F{#ff0000}red%f'.
+
If the terminal can display fewer than 256 colors, configuration wizard preselects Lean style with
+8 colors. All other styles require at least 256 colors. Fix: Use a terminal with 256 color support
+and make sure that TERM environment variable is set correctly. Verify with
+print $terminfo[colors].
+
If there is no UTF-8 locale on the system, configuration wizard won't offer prompt styles that use
+Unicode characters. Fix: Install a UTF-8 locale. Verify with locale -a.
+
When a UTF-8 locale is available, the first few questions asked by the configuration wizard assess
+capabilities of the terminal font. If your answers indicate that some glyphs don't render correctly,
+configuration wizard won't offer prompt styles that use them. Fix: Restart your terminal and
+install the recommended font. Verify by running
+p10k configure and checking that all glyphs render correctly.
+
Cannot install the recommended font
+
Once you download the recommended font,
+you can install it just like any other font. Google "how to install fonts on your OS".
+
Extra or missing spaces in prompt compared to Powerlevel9k
+
tl;dr: Add ZLE_RPROMPT_INDENT=0 and POWERLEVEL9K_LEGACY_ICON_SPACING=true to ~/.zshrc to get
+the same prompt spacing as in Powerlevel9k.
+
When using Powerlevel10k with a Powerlevel9k config, you might get additional spaces in prompt here
+and there. These come in two flavors.
+
Extra space without background on the right side of right prompt
+
tl;dr: Add ZLE_RPROMPT_INDENT=0 to ~/.zshrc to get rid of that space.
If set, used to give the indentation between the right hand side of the right prompt in the line
+editor as given by RPS1 or RPROMPT and the right hand side of the screen. If not set, the
+value 1 is used.
+
Typically this will be used to set the value to 0 so that the prompt appears flush with the
+right hand side of the screen.
+
+
Powerlevel10k respects this parameter. If you set ZLE_RPROMPT_INDENT=1 (or leave it unset, which
+is the same thing as setting it to 1), you'll get an empty space to the right of right prompt. If
+you set ZLE_RPROMPT_INDENT=0, your prompt will go to the edge of the terminal. This is how it
+works in every theme except Powerlevel9k.
+
+
Powerlevel9k issue: powerlevel9k#1292.
+It's been fixed in the development branch of Powerlevel9k but the fix hasn't yet made it to
+master.
+
Add ZLE_RPROMPT_INDENT=0 to ~/.zshrc to get the same spacing on the right edge of prompt as in
+Powerlevel9k.
+
Note: Several versions of Zsh have bugs that get triggered when you set ZLE_RPROMPT_INDENT=0.
+Powerlevel10k can work around these bugs when using powerline prompt style. If you notice visual
+artifacts in prompt, or wrong cursor position, try removing ZLE_RPROMPT_INDENT from ~/.zshrc.
+
Extra or missing spaces around icons
+
tl;dr: Add POWERLEVEL9K_LEGACY_ICON_SPACING=true to ~/.zshrc to get the same spacing around
+icons as in Powerlevel9k.
+
Spacing around icons in Powerlevel9k is inconsistent.
+
+
This inconsistency is a constant source of annoyance, so it was fixed in Powerlevel10k. You can add
+POWERLEVEL9K_LEGACY_ICON_SPACING=true to ~/.zshrc to get the same spacing around icons as in
+Powerlevel9k.
+
Note: It's not a good idea to define POWERLEVEL9K_LEGACY_ICON_SPACING when using
+p10k configure.
+
Weird things happen after typing source ~/.zshrc
+
It's almost always a bad idea to run source ~/.zshrc, whether you are using Powerlevel10k or not.
+This command may result in random errors, misbehaving code and progressive slowdown of Zsh.
+
If you've made changes to ~/.zshrc or to files sourced by it, restart Zsh to apply them. The most
+reliable way to do this is to type exit and then start a new Zsh session. You can also use
+exec zsh. While not exactly equivalent to complete Zsh restart, this command is much more reliable
+than source ~/.zshrc.
Cannot make Powerlevel10k work with my plugin manager
+
If the installation instructions didn't work for you, try disabling your current
+theme (so that you end up with no theme) and then installing Powerlevel10k manually.
+
+
+
Disable the current theme in your framework / plugin manager.
+
+
+
oh-my-zsh: Open ~/.zshrc and remove the line that sets ZSH_THEME. It might look like this:
+ ZSH_THEME="powerlevel9k/powerlevel9k".
+
+
zplug: Open ~/.zshrc and remove the zplug command that refers to your current theme. For
+ example, if you are currently using Powerlevel9k, look for
+ zplug bhilburn/powerlevel9k, use:powerlevel9k.zsh-theme.
+
prezto: Open ~/.zpreztorc and put zstyle :prezto:module:prompt theme off in it. Remove
+ any other command that sets theme such as zstyle :prezto:module:prompt theme powerlevel9k.
+
+
antigen: Open ~/.zshrc and remove the line that sets antigen theme. It might look like
+ this: antigen theme powerlevel9k/powerlevel9k.
This method of installation won't make anything slower or otherwise sub-par.
+
Directory is difficult to see in prompt when using Rainbow style
+
In Rainbow style the current working directory is shown with bright white text on blue background.
+The white is fixed and always looks the same but the appearance of "blue" is defined by your
+terminal color palette. If it's very light, it may be difficult to see white text on it.
+
There are several ways to fix this.
+
+
Type p10k configure and choose a more readable prompt style.
Change directory background and/or foreground color.
+ The parameters you are looking for are called POWERLEVEL9K_DIR_BACKGROUND,
+ POWERLEVEL9K_DIR_FOREGROUND, POWERLEVEL9K_DIR_SHORTENED_FOREGROUND,
+ POWERLEVEL9K_DIR_ANCHOR_FOREGROUND and POWERLEVEL9K_DIR_ANCHOR_BOLD. You can find them in
+ in ~/.p10k.zsh.
+
+
Horrific mess when resizing terminal window
+
When you resize terminal window horizontally back and forth a few times, you might see this ugly
+picture.
+
+
tl;dr: This is a bug in Zsh that isn't specific to Powerlevel10k. See mitigation.
+
Zsh bug
+
This issue is caused by a bug in Zsh that gets triggered when the vertical distance between the
+start of the current prompt and the cursor (henceforth VD) changes when the terminal window is
+resized. This bug is not specific to Powerlevel10k.
+
When a terminal window gets shrunk horizontally, there are two ways for a terminal to handle long
+lines that no longer fit: reflow or truncate.
+
Terminal content before shrinking:
+
+
Terminal reflows text when shrinking:
+
+
Terminal truncates text when shrinking:
+
+
Reflowing strategy can change the height of terminal content. If such content happens to be between
+the start of the current prompt and the cursor, Zsh will print prompt on the wrong line. Truncation
+strategy never changes the height of terminal content, so it doesn't trigger this bug in Zsh.
+
Let's see how the bug plays out in slow motion. We'll start by launching zsh -df and pasting
+the following code:
When PROMPT gets expanded, it calls pause to let us observe the state of the terminal. Here's
+the initial state:
+
+
Zsh keeps track of the cursor position relative to the start of the current prompt. In this case it
+knows that the cursor is one line below. When we shrink the terminal window, it looks like this:
+
+
At this point the terminal sends SIGWINCH to Zsh to notify it about changes in the terminal
+dimensions. Note that this signal is sent after the content of the terminal has been reflown.
+
When Zsh receives SIGWINCH, it attempts to erase the current prompt and print it anew. It goes to
+the position where it thinks the current prompt is -- one line above the cursor (!) -- erases all
+terminal content that follows and prints reexpanded prompt there. However, after resizing prompt is
+no longer one line above the cursor. It's two lines above! Zsh ends up printing new prompt one line
+too low.
+
+
In this case we ended up with unwanted junk content because VD has increased. When you make
+terminal window wider, VD can also decrease, which would result in the new prompt being printed
+higher than intended, potentially erasing useful content in the process.
+
Here are a few more examples where shrinking terminal window increased VD.
+
Simple one-line left prompt with right prompt. No prompt_subst. Note that the cursor is below the
+prompt line (hit ESC-ENTER to get it there).
+
+
Simple one-line left prompt. No prompt_subst, no right prompt. Here VD is bound to increase
+upon terminal shrinking due to the command line wrapping around.
+
+
Zsh patch
+
The bug described above has been partially fixed (only for some terminals) in this branch. The idea behind the fix is to use sc (save
+cursor) terminal capability before printing prompt and rc (restore cursor) to move cursor back
+to the original position when prompt needs to be refreshed.
+
The patch works only on terminals that reflow saved cursor position together with text when the
+terminal window is resized. The patch has no observable effect on terminals that don't reflow text
+on resize (both patched and unpatched Zsh behave correctly) and on terminals that reflow text but
+not saved cursor position (both patched and unpatched Zsh redraw prompt at the same incorrect
+position). In other words, the patch fixes the resizing issue on some terminals while keeping the
+behavior unchanged on others.
+
There are two alternative approaches to fixing the bug that may seem to work at first glance but in
+fact don't:
+
+
Instead of sc, use u7 terminal capability to query the current cursor position and then cup
+ to go back to it. This doesn't work because the absolute position of the start of the current
+ prompt changes when text gets reflown.
+
Recompute VD based on new terminal dimensions before attempting to refresh prompt. This doesn't
+ work because Zsh doesn't know whether terminal reflows text or truncates it. If Zsh could somehow
+ know that the terminal reflows text, this approach still wouldn't work on terminals that
+ continuously reflow text and rapid-fire SIGWINCH when the window is being resized. In such
+ environment real terminal dimensions go out of sync with what Zsh thinks the dimensions are.
+
+
There is no ETA for the patch making its way into upstream Zsh. See discussion.
+
Mitigation
+
There are a few mitigation options for this issue.
+
+
Apply the patch and rebuild Zsh from source. It won't help if you are using Alacritty,
+ Kitty or some other terminal that reflows text on resize but doesn't reflow saved cursor position.
+ On such terminals the patch will have no visible effect.
+
Disable text reflowing on window resize in terminal settings. If your terminal doesn't have this
+ setting, try a different terminal.
+
Avoid long lines between the start of prompt and cursor.
+
Disable ruler with POWERLEVEL9K_SHOW_RULER=false.
+
Disable prompt connection with POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' '.
+
Disable right frame with POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX='',
+ POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX='' and
+ POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX=''.
+
Set POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(). Right prompt on the last prompt line will cause
+ resizing issues only when the cursor is below it. This isn't very common, so you might want to
+ keep some elements in POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS provided that none of them are
+ succeeded by newline.
+
+
Icons cut off in Konsole
+
When using Konsole with a non-monospace font, icons may be cut off on the right side. Here
+"non-monospace" refers to any font with glyphs wider than a single column, or wider than two columns
+for glyphs designated as "wide" in the Unicode standard.
+
+
The last line on the screenshot shows a cut off Arch Linux logo.
+
There are several mitigation options for this issue.
+
+
Use a different terminal. Konsole is the only terminal that exhibits this behavior.
+
Use a monospace font.
+
Manually add an extra space after the icon that gets cut off. For example, if the content of
+ os_icon prompt segment gets cut off, open ~/.p10k.zsh, search for
+ POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION and change it as follows:
+
+
typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='${P9K_CONTENT} ' # extra space at the end
+
+
+
+
Use a different icon that is monospace. For example, if Arch Linux logo gets cut off, add
+ the following parameter to ~/.p10k.zsh:
+
+
typeset -g POWERLEVEL9K_LINUX_ARCH_ICON='Arch' # plain "Arch" in place of a logo
+
+
+
+
Disable the display of the icon that gets cut off. For example, if the content of
+ os_icon prompt segment gets cut off, open ~/.p10k.zsh and remove os_icon from
+ POWERLEVEL9K_LEFT_PROMPT_ELEMENTS and POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS.
Display the icon in regular (non-bold) typeface. To do this, open ~/.p10k.zsh, search for
+ POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION and remove %B from its value.
+
+
typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='${P9K_CONTENT}' # not bold
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Search
+
+
+
+
+ From here you can search these documents. Enter
+ your search terms below.
+