4bcbe2ee68
==[ Changes since the last release ]== - Complete documentation overhaul. Powerlevel10k documentation is no longer embarrassing (still no reference though; coming "soon"). - Worker pool and recursive globber have been rewritten for better performance and simpler code. Performance improvements (large speedup means an improvement in big-O and at least 2x in typical configurations): - +15% prompt speedup across the board. - Large prompt speedup for several rarely used prompt segments (disk_usage, ram, etc.). - Large prompt speedup for a few prompt segments on macOS (battery, swap, etc.). - Large prompt speedup when many prompt segments are active simultaneously. - Large prompt speedup when filesystem is slow. - New prompt segments: nix_shell and timewarrior. Both enabled by default. - Configuration wizard: - Many new options for Pure style (color scheme, number of lines, etc.) - Several new options for 8-color version of Pure style. - Better support for terminals with less than 256 colors. - Lean, Classic and Rainbow style configs now have disk_usage and swap prompt segments (disabled by default). - POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER now contains 'oc'. - New parameters: - POWERLEVEL9K_LEGACY_ICON_SPACING=true makes spaces around icons appear just like in powerlevel9k. - When in a vcs repo, POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER=true removes directory prefix that precedes repo root. - P9K_KUBECONTEXT_USER can now be used in kubecontext format. - POWERLEVEL9K_GOENV_SOURCES -- the same as POWERLEVEL9K_RBENV_SOURCES but or go. - POWERLEVEL9K_TERRAFORM_CLASSES -- the same as POWERLEVEL9K_AWS_CLASSES but for terraform. - Bug fixes: - Configuration wizard now correctly follows symlinks when modifying ~/.zshrc and ~/.p10k.zsh. - ram prompt segment now works on WSL. - Powerlevel10k now correctly works with zsh-you-should-use in hardcore mode. - POWERLEVEL9K_PUBLIC_IP_HOST now points to a host that actually works. - Instant prompt no longer prints nonsensical "entry=" in rare circumstances. - Misc: - Config templates no longer work with POWERLEVEL9K_VISUAL_IDENTIFIER='' defined after them. - Powerlevel10k now detects when Antigen corrupts its source and emits an appropriate error message. - Command line parser now understands 'tabbed'. - Remove all references to romkatv/dotfiles-public. Fonts are now hosted in romkatv/powerlevel10k-media together with all images and animations. ==[ Build time dependencies ]== - |
||
---|---|---|
.. | ||
external | ||
functions | ||
init.zsh | ||
README.md |
Prompt
Loads prompt themes.
Settings
Prompt Theme
To select a prompt theme, add the following to zpreztorc, and replace name with the name of the theme you wish to load. Setting it to random will load a random theme.
zstyle ':prezto:module:prompt' theme 'name'
Prompt Display Length
To change working directory prompt display length from 'short', set the
following to 'long' (without ~
expansion) or 'full' (with ~
expansion)
in zpreztorc.
zstyle ':prezto:module:prompt' pwd-length 'short'
Display Return Value
Some prompts display the return value in the prompt. If a prompt has support, this can be disabled with the following snippet.
zstyle ':prezto:module:prompt' show-return-val 'no'
Theming
A prompt theme is an autoloadable function file with a special name,
prompt_name_setup
, placed anywhere in $fpath
, but for the purpose of this
project, themes should be placed in the modules/prompt/functions
directory.
Required Variables
To ensure that your function works with the editor-info module you'll need to set the following variable:
# Tell prezto we can manage this prompt
zstyle ':prezto:module:prompt' managed 'yes'
This is to ensure compatibility with outside prompts, while allowing prezto
and prezto-compatible prompts to take full advantage of the editor module.
This should be set in the prompt_name_setup
function after you've added
any additional hooks with add-zsh-hook precmd prompt_name_precmd
. See below
for additional information about functions and hooks.
Theme Functions
There are three theme functions, a setup function, a help function, and a preview function. The setup function must always be defined. The help function and the preview functions are optional.
prompt_name_setup
This function is called by the prompt
function to install the theme. This
function may define other functions as necessary to maintain the prompt,
including a function that displays help or a function used to preview it.
Do not call this function directly.
The most basic example of this function can be seen below.
function prompt_name_setup {
PROMPT='%m%# '
RPROMPT=''
}
prompt_name_help
If the prompt_name_setup
function is customizable via parameters, a help
function should be defined. The user will access it via prompt -h name
.
The most basic example of this function can be seen below.
function prompt_name_help {
cat <<EOH
This prompt is color-scheme-able. You can invoke it thus:
prompt theme [<color1>] [<color2>]
where the color is for the left-hand prompt.
EOH
}
prompt_name_preview
If the prompt_name_setup
function is customizable via parameters, a preview
function should be defined. The user will access it via prompt -p name
.
The most basic example of this function can be seen below.
function prompt_name_preview {
if (( $# > 0 )); then
prompt_preview_theme theme "$@"
else
prompt_preview_theme theme red green blue
print
prompt_preview_theme theme yellow magenta black
fi
}
Hook Functions
There are many Zsh hook functions, but mostly the precmd hook will be used.
prompt_name_precmd
This hook is called before the prompt is displayed and is useful for getting information to display in a prompt.
When calling functions to get information to display in a prompt, do not assume that all the dependencies have been loaded. Always check for the availability of a function before you calling it.
Do not register hook functions. They will be registered by the prompt
function.
The most basic example of this function can be seen below.
function prompt_name_precmd {
if (( $+functions[git-info] )); then
git-info
fi
}
Troubleshooting
Fonts aren't displaying properly.
On most systems, themes which use special characters need to have a patched font installed and configured properly.
Powerline provides some information on terminal support and how to install patched fonts which should fix most font issues.
Authors
The authors of this module should be contacted via the issue tracker.