Skip to content

Powerlevel10k - High-Performance Zsh Theme

Powerlevel10k is a theme for Zsh that emphasizes speed, flexibility, and out-of-the-box experience. It's a drop-in replacement for Powerlevel9k with dramatically improved performance, featuring instant prompt rendering, extensive customization options, and a user-friendly configuration wizard. Powerlevel10k delivers a beautiful, informative prompt while maintaining exceptional speed through advanced optimization techniques.

Installation

Prerequisites

bash
# Ensure Zsh is installed and set as default shell
zsh --version
echo $SHELL

# Install a Nerd Font (required for icons)
# Download from: https://www.nerdfonts.com/
# Popular choices: MesloLGS NF, Hack Nerd Font, FiraCode Nerd Font

# Verify font installation
echo -e "\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699"

Installation Methods

bash
# Clone Powerlevel10k repository
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

# Set theme in ~/.zshrc
ZSH_THEME="powerlevel10k/powerlevel10k"

# Reload configuration
source ~/.zshrc

# Run configuration wizard
p10k configure

Manual Installation (Zsh without Oh My Zsh)

bash
# Clone repository
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k

# Add to ~/.zshrc
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc

# Reload and configure
source ~/.zshrc
p10k configure

Package Manager Installation

bash
# Homebrew (macOS)
brew install romkatv/powerlevel10k/powerlevel10k
echo "source $(brew --prefix)/opt/powerlevel10k/powerlevel10k.zsh-theme" >>~/.zshrc

# Arch Linux
yay -S zsh-theme-powerlevel10k-git
echo 'source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc

# Gentoo
emerge app-shells/powerlevel10k
echo 'source /usr/share/zsh/site-functions/powerlevel10k.zsh-theme' >>~/.zshrc

Zinit Plugin Manager

bash
# Add to ~/.zshrc
zinit ice depth=1; zinit light romkatv/powerlevel10k

# Reload configuration
source ~/.zshrc
p10k configure

Font Configuration

bash
# Download and install MesloLGS NF (recommended)
# Manual download from GitHub releases
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf

# Install fonts (Linux)
mkdir -p ~/.local/share/fonts
cp *.ttf ~/.local/share/fonts/
fc-cache -fv

# Configure terminal to use MesloLGS NF font
# Terminal-specific instructions vary

Configuration Wizard

Initial Setup

bash
# Run configuration wizard
p10k configure

# Reconfigure anytime
p10k configure

# Configuration wizard options:
# 1. Diamond symbols display test
# 2. Lock symbol display test  
# 3. Debian logo display test
# 4. Prompt style selection
# 5. Character set selection
# 6. Show current time
# 7. Prompt separators
# 8. Prompt heads
# 9. Prompt tails
# 10. Prompt height
# 11. Prompt connection
# 12. Prompt frame
# 13. Connection color
# 14. Prompt spacing
# 15. Icons
# 16. Prompt flow
# 17. Enable transient prompt
# 18. Instant prompt mode

Configuration File

bash
# Configuration file location
~/.p10k.zsh

# Backup configuration
cp ~/.p10k.zsh ~/.p10k.zsh.backup

# Reset to defaults
rm ~/.p10k.zsh
p10k configure

# Apply configuration
source ~/.p10k.zsh

Core Features and Segments

Instant Prompt

bash
# Enable instant prompt (default)
# Add to top of ~/.zshrc (before Oh My Zsh source)
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

# Disable instant prompt
typeset -g POWERLEVEL9K_INSTANT_PROMPT=off

# Instant prompt modes
typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose  # Show warnings
typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet    # Hide warnings
typeset -g POWERLEVEL9K_INSTANT_PROMPT=off      # Disable

Prompt Segments Configuration

bash
# Configure left prompt segments
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
  os_icon                 # OS identifier
  dir                     # Current directory
  vcs                     # Git status
  prompt_char             # Prompt character
)

# Configure right prompt segments
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
  status                  # Exit code
  command_execution_time  # Command duration
  background_jobs         # Background jobs
  direnv                  # direnv status
  asdf                    # asdf version manager
  virtualenv              # Python virtual environment
  anaconda                # Anaconda environment
  pyenv                   # pyenv Python version
  goenv                   # goenv Go version
  nodenv                  # nodenv Node.js version
  nvm                     # nvm Node.js version
  nodeenv                 # nodeenv Node.js environment
  rbenv                   # rbenv Ruby version
  rvm                     # rvm Ruby version
  fvm                     # fvm Flutter version
  luaenv                  # luaenv Lua version
  jenv                    # jenv Java version
  plenv                   # plenv Perl version
  phpenv                  # phpenv PHP version
  scalaenv                # scalaenv Scala version
  haskell_stack           # Haskell Stack
  kubecontext             # Kubernetes context
  terraform               # Terraform workspace
  aws                     # AWS profile
  aws_eb_env              # AWS Elastic Beanstalk
  azure                   # Azure account
  gcloud                  # Google Cloud config
  google_app_cred         # Google Application Credentials
  context                 # User@hostname
  nordvpn                 # NordVPN status
  ranger                  # Ranger file manager
  nnn                     # nnn file manager
  vim_shell               # Vim shell indicator
  midnight_commander      # Midnight Commander
  nix_shell               # Nix shell
  vi_mode                 # Vi mode indicator
  todo                    # Todo.txt
  timewarrior             # Timewarrior
  taskwarrior             # Taskwarrior
  time                    # Current time
  ip                      # IP address
  public_ip               # Public IP address
  proxy                   # Proxy indicator
  battery                 # Battery level
  wifi                    # WiFi status
  vpn_ip                  # VPN IP address
  load                    # System load
  disk_usage              # Disk usage
  ram                     # RAM usage
  swap                    # Swap usage
  cpu_arch                # CPU architecture
  newline                 # Line break
)

Directory Segment

bash
# Directory segment configuration
typeset -g POWERLEVEL9K_DIR_BACKGROUND=4
typeset -g POWERLEVEL9K_DIR_FOREGROUND=254
typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=250
typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=255
typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=true

# Directory truncation
typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique
typeset -g POWERLEVEL9K_SHORTEN_DELIMITER=
typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=80
typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40
typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT=50

# Directory substitutions
typeset -g POWERLEVEL9K_DIR_PACKAGE_FILES=(package.json composer.json)
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v3

# Custom directory colors
typeset -g POWERLEVEL9K_DIR_CLASSES=(
  '~/work(|/*)'  WORK
  '~/tmp(|/*)'   TEMP
  '*'            DEFAULT
)
typeset -g POWERLEVEL9K_DIR_WORK_BACKGROUND=4
typeset -g POWERLEVEL9K_DIR_TEMP_BACKGROUND=1

Git (VCS) Segment

bash
# Git segment configuration
typeset -g POWERLEVEL9K_VCS_CLEAN_BACKGROUND=2
typeset -g POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND=3
typeset -g POWERLEVEL9K_VCS_MODIFIED_BACKGROUND=1

# Git status icons
typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?'
typeset -g POWERLEVEL9K_VCS_UNSTAGED_ICON='!'
typeset -g POWERLEVEL9K_VCS_STAGED_ICON='+'
typeset -g POWERLEVEL9K_VCS_STASH_ICON='*'
typeset -g POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON='⇣'
typeset -g POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON='⇡'
typeset -g POWERLEVEL9K_VCS_COMMIT_ICON=''

# Git branch icon
typeset -g POWERLEVEL9K_VCS_BRANCH_ICON='\uF126 '
typeset -g POWERLEVEL9K_VCS_REMOTE_BRANCH_ICON=' '
typeset -g POWERLEVEL9K_VCS_GIT_ICON=''
typeset -g POWERLEVEL9K_VCS_GIT_GITHUB_ICON=''
typeset -g POWERLEVEL9K_VCS_GIT_BITBUCKET_ICON=''
typeset -g POWERLEVEL9K_VCS_GIT_GITLAB_ICON=''

# Advanced Git configuration
typeset -g POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY=-1
typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~'
typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true
typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${P9K_CONTENT}${${P9K_CONTENT:#*[!0-9]*}:+ M}'

Status Segment

bash
# Status segment configuration
typeset -g POWERLEVEL9K_STATUS_EXTENDED_STATES=true
typeset -g POWERLEVEL9K_STATUS_OK=false
typeset -g POWERLEVEL9K_STATUS_OK_FOREGROUND=2
typeset -g POWERLEVEL9K_STATUS_OK_BACKGROUND=0
typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=1
typeset -g POWERLEVEL9K_STATUS_ERROR_BACKGROUND=0
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_FOREGROUND=1
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_BACKGROUND=0
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_FOREGROUND=1
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_BACKGROUND=0

Command Execution Time

bash
# Command execution time configuration
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=0
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND=3
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'

Background Jobs

bash
# Background jobs configuration
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=6
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_BACKGROUND=0

Language and Environment Integration

Python Environment

bash
# Python virtual environment
typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=0
typeset -g POWERLEVEL9K_VIRTUALENV_BACKGROUND=4
typeset -g POWERLEVEL9K_VIRTUALENV_GENERIC_NAMES=(virtualenv venv .venv)
typeset -g POWERLEVEL9K_VIRTUALENV_LEFT_DELIMITER=
typeset -g POWERLEVEL9K_VIRTUALENV_RIGHT_DELIMITER=

# Anaconda environment
typeset -g POWERLEVEL9K_ANACONDA_FOREGROUND=0
typeset -g POWERLEVEL9K_ANACONDA_BACKGROUND=4
typeset -g POWERLEVEL9K_ANACONDA_LEFT_DELIMITER=
typeset -g POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER=

# Pyenv Python version
typeset -g POWERLEVEL9K_PYENV_FOREGROUND=0
typeset -g POWERLEVEL9K_PYENV_BACKGROUND=4
typeset -g POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_PYENV_SOURCES=(shell local global)

Node.js Environment

bash
# Node.js version (nvm)
typeset -g POWERLEVEL9K_NVM_FOREGROUND=0
typeset -g POWERLEVEL9K_NVM_BACKGROUND=5
typeset -g POWERLEVEL9K_NVM_PROMPT_ALWAYS_SHOW=false

# Node.js version (nodenv)
typeset -g POWERLEVEL9K_NODENV_FOREGROUND=0
typeset -g POWERLEVEL9K_NODENV_BACKGROUND=2
typeset -g POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_NODENV_SOURCES=(shell local global)

# Node.js environment (nodeenv)
typeset -g POWERLEVEL9K_NODEENV_FOREGROUND=2
typeset -g POWERLEVEL9K_NODEENV_BACKGROUND=0
typeset -g POWERLEVEL9K_NODEENV_LEFT_DELIMITER=
typeset -g POWERLEVEL9K_NODEENV_RIGHT_DELIMITER=

Ruby Environment

bash
# Ruby version (rbenv)
typeset -g POWERLEVEL9K_RBENV_FOREGROUND=0
typeset -g POWERLEVEL9K_RBENV_BACKGROUND=1
typeset -g POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_RBENV_SOURCES=(shell local global)

# Ruby version (rvm)
typeset -g POWERLEVEL9K_RVM_FOREGROUND=0
typeset -g POWERLEVEL9K_RVM_BACKGROUND=1
typeset -g POWERLEVEL9K_RVM_SHOW_GEMSET=false
typeset -g POWERLEVEL9K_RVM_SHOW_PREFIX=false

Go Environment

bash
# Go version (goenv)
typeset -g POWERLEVEL9K_GOENV_FOREGROUND=0
typeset -g POWERLEVEL9K_GOENV_BACKGROUND=4
typeset -g POWERLEVEL9K_GOENV_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_GOENV_SOURCES=(shell local global)

Java Environment

bash
# Java version (jenv)
typeset -g POWERLEVEL9K_JENV_FOREGROUND=1
typeset -g POWERLEVEL9K_JENV_BACKGROUND=7
typeset -g POWERLEVEL9K_JENV_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_JENV_SOURCES=(shell local global)

Cloud and Container Integration

Kubernetes

bash
# Kubernetes context
typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile|flux|fluxctl|stern'
typeset -g POWERLEVEL9K_KUBECONTEXT_FOREGROUND=0
typeset -g POWERLEVEL9K_KUBECONTEXT_BACKGROUND=5
typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=0
typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_BACKGROUND=5
typeset -g POWERLEVEL9K_KUBECONTEXT_SUFFIX=
typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION=
typeset -g POWERLEVEL9K_KUBECONTEXT_CONTENT_EXPANSION='${P9K_KUBECONTEXT_CLOUD_CLUSTER:-${P9K_KUBECONTEXT_NAME}}'

# Kubernetes context classes
typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=(
  '*prod*'    PROD
  '*test*'    TEST
  '*'         DEFAULT
)
typeset -g POWERLEVEL9K_KUBECONTEXT_PROD_FOREGROUND=0
typeset -g POWERLEVEL9K_KUBECONTEXT_PROD_BACKGROUND=1
typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_FOREGROUND=0
typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_BACKGROUND=3

AWS

bash
# AWS profile
typeset -g POWERLEVEL9K_AWS_SHOW_ON_COMMAND='aws|awless|terraform|pulumi|terragrunt'
typeset -g POWERLEVEL9K_AWS_FOREGROUND=232
typeset -g POWERLEVEL9K_AWS_BACKGROUND=39
typeset -g POWERLEVEL9K_AWS_CONTENT_EXPANSION='${P9K_AWS_PROFILE//\%/%%}${P9K_AWS_REGION:+ ${P9K_AWS_REGION//\%/%%}}'

# AWS profile classes
typeset -g POWERLEVEL9K_AWS_CLASSES=(
  '*prod*'    PROD
  '*test*'    TEST
  '*'         DEFAULT
)
typeset -g POWERLEVEL9K_AWS_PROD_FOREGROUND=232
typeset -g POWERLEVEL9K_AWS_PROD_BACKGROUND=1

Google Cloud

bash
# Google Cloud configuration
typeset -g POWERLEVEL9K_GCLOUD_SHOW_ON_COMMAND='gcloud|gcs|gsutil'
typeset -g POWERLEVEL9K_GCLOUD_FOREGROUND=32
typeset -g POWERLEVEL9K_GCLOUD_BACKGROUND=4
typeset -g POWERLEVEL9K_GCLOUD_CONTENT_EXPANSION='${P9K_GCLOUD_PROJECT_ID//\%/%%}${P9K_GCLOUD_PROJECT_NAME:+ (${P9K_GCLOUD_PROJECT_NAME//\%/%%})}'

Azure

bash
# Azure account
typeset -g POWERLEVEL9K_AZURE_SHOW_ON_COMMAND='az|terraform|pulumi|terragrunt'
typeset -g POWERLEVEL9K_AZURE_FOREGROUND=232
typeset -g POWERLEVEL9K_AZURE_BACKGROUND=4

Terraform

bash
# Terraform workspace
typeset -g POWERLEVEL9K_TERRAFORM_SHOW_ON_COMMAND='terraform|tf|terragrunt|tg'
typeset -g POWERLEVEL9K_TERRAFORM_FOREGROUND=0
typeset -g POWERLEVEL9K_TERRAFORM_BACKGROUND=5

# Terraform workspace classes
typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=(
  '*prod*'    PROD
  '*test*'    TEST
  '*'         DEFAULT
)
typeset -g POWERLEVEL9K_TERRAFORM_PROD_FOREGROUND=0
typeset -g POWERLEVEL9K_TERRAFORM_PROD_BACKGROUND=1

System Information Segments

Time

bash
# Time segment
typeset -g POWERLEVEL9K_TIME_FOREGROUND=0
typeset -g POWERLEVEL9K_TIME_BACKGROUND=7
typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false

Battery

bash
# Battery segment
typeset -g POWERLEVEL9K_BATTERY_LOW_THRESHOLD=20
typeset -g POWERLEVEL9K_BATTERY_LOW_FOREGROUND=1
typeset -g POWERLEVEL9K_BATTERY_LOW_BACKGROUND=0
typeset -g POWERLEVEL9K_BATTERY_CHARGING_FOREGROUND=2
typeset -g POWERLEVEL9K_BATTERY_CHARGING_BACKGROUND=0
typeset -g POWERLEVEL9K_BATTERY_CHARGED_FOREGROUND=2
typeset -g POWERLEVEL9K_BATTERY_CHARGED_BACKGROUND=0
typeset -g POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND=3
typeset -g POWERLEVEL9K_BATTERY_DISCONNECTED_BACKGROUND=0

# Battery stages
typeset -g POWERLEVEL9K_BATTERY_STAGES=(
  $'▁\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0'
  $'▂\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0'
  $'▃\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0'
  $'▄\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0'
  $'▅\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0'
  $'▆\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0'
  $'▇\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0'
  $'█\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0'
)

System Load

bash
# System load
typeset -g POWERLEVEL9K_LOAD_WHICH=5
typeset -g POWERLEVEL9K_LOAD_NORMAL_FOREGROUND=0
typeset -g POWERLEVEL9K_LOAD_NORMAL_BACKGROUND=2
typeset -g POWERLEVEL9K_LOAD_WARNING_FOREGROUND=0
typeset -g POWERLEVEL9K_LOAD_WARNING_BACKGROUND=3
typeset -g POWERLEVEL9K_LOAD_CRITICAL_FOREGROUND=0
typeset -g POWERLEVEL9K_LOAD_CRITICAL_BACKGROUND=1

Disk Usage

bash
# Disk usage
typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=0
typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_BACKGROUND=2
typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_FOREGROUND=0
typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_BACKGROUND=3
typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_FOREGROUND=0
typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_BACKGROUND=1
typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=90
typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=95
typeset -g POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=false

RAM Usage

bash
# RAM usage
typeset -g POWERLEVEL9K_RAM_FOREGROUND=0
typeset -g POWERLEVEL9K_RAM_BACKGROUND=3

WiFi

bash
# WiFi status
typeset -g POWERLEVEL9K_WIFI_FOREGROUND=0
typeset -g POWERLEVEL9K_WIFI_BACKGROUND=4

Advanced Customization

Custom Segments

bash
# Define custom segment
function prompt_my_custom_segment() {
  local content="Custom"
  p10k segment -f 208 -b 0 -i '⚡' -t "$content"
}

# Add to prompt elements
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
  # ... other elements
  my_custom_segment
)

# Custom segment with conditional display
function prompt_docker_status() {
  if command -v docker >/dev/null 2>&1 && docker info >/dev/null 2>&1; then
    local containers=$(docker ps -q | wc -l)
    if [[ $containers -gt 0 ]]; then
      p10k segment -f 4 -b 0 -i '🐳' -t "$containers"
    fi
  fi
}

# Git repository specific customization
function prompt_git_custom() {
  if [[ -n $P9K_VCS_BRANCH ]]; then
    local repo_name=${${P9K_VCS_ROOT:t}//\%/%%}
    case $repo_name in
      work-*)
        p10k segment -f 0 -b 4 -i '💼' -t "$repo_name"
        ;;
      personal-*)
        p10k segment -f 0 -b 2 -i '🏠' -t "$repo_name"
        ;;
    esac
  fi
}

Conditional Segments

bash
# Show segment only in specific directories
typeset -g POWERLEVEL9K_TERRAFORM_SHOW_ON_COMMAND='terraform|tf'
typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm'

# Custom conditional logic
function prompt_conditional_segment() {
  if [[ $PWD == */work/* ]]; then
    p10k segment -f 0 -b 4 -i '💼' -t "WORK"
  elif [[ $PWD == */personal/* ]]; then
    p10k segment -f 0 -b 2 -i '🏠' -t "PERSONAL"
  fi
}

# Environment-based segments
function prompt_env_indicator() {
  if [[ -n $DEVELOPMENT ]]; then
    p10k segment -f 0 -b 3 -i '🔧' -t "DEV"
  elif [[ -n $PRODUCTION ]]; then
    p10k segment -f 0 -b 1 -i '⚠️' -t "PROD"
  fi
}

Transient Prompt

bash
# Enable transient prompt
typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always

# Transient prompt configuration
typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=same-dir  # Only in same directory
typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=off       # Disable

# Custom transient prompt
function p10k-on-post-prompt() {
  p10k display '*/right'=hide
}

Multi-line Prompt

bash
# Enable multi-line prompt
typeset -g POWERLEVEL9K_PROMPT_ON_NEWLINE=true
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true

# Multi-line prompt character
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=
typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX=
typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX=

# Connection line
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX='%242F╭─'
typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX='%242F├─'
typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX='%242F╰─'

Performance Optimization

Gitstatus Configuration

bash
# Gitstatus performance settings
typeset -g POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY=-1
typeset -g POWERLEVEL9K_VCS_STAGED_MAX_NUM=1
typeset -g POWERLEVEL9K_VCS_UNSTAGED_MAX_NUM=1
typeset -g POWERLEVEL9K_VCS_UNTRACKED_MAX_NUM=1
typeset -g POWERLEVEL9K_VCS_CONFLICTED_MAX_NUM=1
typeset -g POWERLEVEL9K_VCS_COMMITS_AHEAD_MAX_NUM=1
typeset -g POWERLEVEL9K_VCS_COMMITS_BEHIND_MAX_NUM=1

Segment Optimization

bash
# Disable heavy segments
typeset -g POWERLEVEL9K_PUBLIC_IP_DISABLED=true
typeset -g POWERLEVEL9K_LOAD_DISABLED=true
typeset -g POWERLEVEL9K_DISK_USAGE_DISABLED=true

# Optimize command detection
typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm'
typeset -g POWERLEVEL9K_TERRAFORM_SHOW_ON_COMMAND='terraform|tf'
typeset -g POWERLEVEL9K_AWS_SHOW_ON_COMMAND='aws|terraform'

# Cache expensive operations
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3

Instant Prompt Optimization

bash
# Optimize instant prompt
typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose

# Disable problematic segments for instant prompt
typeset -g POWERLEVEL9K_PUBLIC_IP_DISABLED=true
typeset -g POWERLEVEL9K_LOAD_DISABLED=true

# Configure instant prompt cache
export P9K_INSTANT_PROMPT_CACHE_TTL=3600  # 1 hour

Troubleshooting

Common Issues

bash
# Font rendering issues
# Verify Nerd Font installation
echo -e "\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699"

# Check terminal font configuration
# Ensure terminal uses Nerd Font

# Performance issues
# Profile Zsh startup
time zsh -i -c exit

# Check gitstatus performance
gitstatus_query -d . -t 1000

# Debug instant prompt
typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose

# Reset configuration
rm ~/.p10k.zsh
p10k configure

Debug Mode

bash
# Enable debug mode
typeset -g POWERLEVEL9K_DEBUG=1

# Check segment rendering
p10k segment -f 1 -b 2 -i '🔧' -t "test"

# Verify configuration
p10k configure

# Check gitstatus
gitstatus_query -d .

Configuration Validation

bash
# Validate configuration file
source ~/.p10k.zsh

# Check for syntax errors
zsh -n ~/.p10k.zsh

# Test specific segments
p10k display '*'=show
p10k display 'dir'=hide
p10k display 'vcs'=show

Integration Examples

IDE Integration

bash
# VS Code terminal integration
# Configure terminal.integrated.fontFamily: "MesloLGS NF"

# IntelliJ IDEA terminal
# Configure terminal font to MesloLGS NF

# Terminal multiplexer integration
# Tmux: ensure TERM is set correctly
# Screen: configure for 256 colors

CI/CD Integration

bash
# Disable interactive features in CI
if [[ -n $CI ]]; then
  typeset -g POWERLEVEL9K_INSTANT_PROMPT=off
  typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=off
fi

# Minimal CI configuration
if [[ -n $CI ]]; then
  typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs)
  typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
fi

Docker Integration

bash
# Docker container detection
function prompt_docker_container() {
  if [[ -f /.dockerenv ]]; then
    p10k segment -f 0 -b 4 -i '🐳' -t "DOCKER"
  fi
}

# Add to prompt elements
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
  docker_container
  # ... other elements
)

Best Practices

Configuration Management

bash
# Version control configuration
git add ~/.p10k.zsh
git commit -m "Add Powerlevel10k configuration"

# Environment-specific configurations
if [[ $HOST == "work-laptop" ]]; then
  # Work-specific settings
  typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon dir vcs work_indicator prompt_char)
elif [[ $HOST == "personal-desktop" ]]; then
  # Personal settings
  typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon dir vcs personal_indicator prompt_char)
fi

# Modular configuration
source ~/.config/p10k/segments.zsh
source ~/.config/p10k/colors.zsh
source ~/.config/p10k/icons.zsh

Performance Guidelines

bash
# Keep essential segments only
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
  dir
  vcs
  prompt_char
)

# Use conditional display
typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm'

# Optimize Git performance
typeset -g POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY=4096

# Cache expensive operations
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3

Security Considerations

bash
# Avoid displaying sensitive information
typeset -g POWERLEVEL9K_CONTEXT_DEFAULT_FOREGROUND=8  # Dim username
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=false       # Hide write permissions

# Secure Git information
typeset -g POWERLEVEL9K_VCS_HIDE_TAGS=true           # Hide Git tags
typeset -g POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH=8   # Limit hash display

# Environment-aware configuration
if [[ -n $SSH_CONNECTION ]]; then
  # Show more context when SSH'd
  typeset -g POWERLEVEL9K_CONTEXT_DEFAULT_FOREGROUND=3
fi

Powerlevel10k represents the pinnacle of Zsh theme development, combining exceptional performance with extensive customization capabilities. Its instant prompt feature, comprehensive segment system, and intelligent optimization make it the ideal choice for developers and power users who demand both functionality and speed. Whether you prefer a minimal setup or a feature-rich display with comprehensive system information, Powerlevel10k delivers unmatched performance while providing all the information you need at a glance.