Customizing Powerleve10k prompt

Display only the last directory segment

  1. Open ~/.p10k.zsh.
  2. Search for POWERLEVEL9K_SHORTEN_STRATEGY.
  3. Change the value of this parameter to truncate_to_last.

Alternatively, change the value of POWERLEVEL9K_DIR_MAX_LENGTH to 1. This will maximally shorten current directory while keeping the transformation reversible. You can restore the original directory by copy-pasting the shortened directory to the command line and pressing TAB.

Ruby version

Powerlevel10k has several prompt segments that can display Ruby version. By default only those are enabled that display Ruby version when it has been manually overridden by some tool (e.g., rbenv or asdf).

To remove Ruby version from prompt:

  1. Open ~/.p10k.zsh.
  2. Search for POWERLEVEL9K_RIGHT_PROMPT_SEGMENTS.
  3. Remove or comment out the following elements: rbenv, rvm and asdf.

Alternatively (and perhaps preferably), find out which tool is overriding Ruby version for you and remove the override if you no longer need it.


shorten dir segment to show only deepest directory

To show only last n significant path segments, you can set following in your config .zshrc, e.g n=1 means show only last folder in present working directory:

POWERLEVEL9K_SHORTEN_DIR_LENGTH=1

See https://stackoverflow.com/a/49027654

explain Git symbols

The question/exclamation mark in Git segment (vcs segment, next to path) means the number of files untracked (?) and unstaged (!). For detailed description see What do different symbols in Git status mean?

change version segment

You can change the version segment (on the right of prompt) to reflect another tool. For example to replace shown ruby version by python version replace the element within right promt elements in your config .zshrc:

POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(rbenv)

by

POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(pyenv)

Tags:

Zsh

Oh My Zsh