Pure - Minimal Zsh Prompt¶
Pure ist eine ziemliche, minimale und schnelle Zsh-Prompt, die sich auf Einfachheit und Leistung konzentriert. Erstellt von Sindre Sorhus, Rein betont saubere Ästhetik, asynchron Git Information fetching und intelligente Anzeige nur relevanter Informationen. Es stellt die minimalistische Philosophie in der zeitnahen Gestaltung dar, wobei die wesentliche Funktionalität für moderne Entwicklungsarbeit beibehalten wird.
• Installation
Voraussetzungen¶
# Ensure Zsh is installed and set as default shell
zsh --version
echo $SHELL
# Set Zsh as default shell if needed
chsh -s $(which zsh)
# Verify Zsh configuration
echo $ZSH_VERSION
```_
### Installationsmethoden
Installation (empfohlen)
```bash
# Install via npm
npm install --global pure-prompt
# Verify installation
which pure
# Check version
pure --version
```_
Manuelle Installation
```bash
# Clone repository
mkdir -p "$HOME/.zsh"
git clone https://github.com/sindresorhus/pure.git "$HOME/.zsh/pure"
# Add to .zshrc
echo 'fpath+=$HOME/.zsh/pure' >> ~/.zshrc
echo 'autoload -U promptinit; promptinit' >> ~/.zshrc
echo 'prompt pure' >> ~/.zshrc
# Reload configuration
source ~/.zshrc
```_
Installation des Paketmanagers
```bash
# Homebrew (macOS)
brew install pure
# Add to .zshrc
echo 'fpath+=/usr/local/share/zsh/site-functions' >> ~/.zshrc
echo 'autoload -U promptinit; promptinit' >> ~/.zshrc
echo 'prompt pure' >> ~/.zshrc
# Arch Linux
yay -S zsh-pure-prompt
# Gentoo
emerge app-shells/pure
# FreeBSD
pkg install zsh-pure
```_
Meine Zsh Integration
```bash
# Clone to Oh My Zsh custom themes
git clone https://github.com/sindresorhus/pure.git "$ZSH_CUSTOM/themes/pure"
# Symlink pure.zsh-theme
ln -s "$ZSH_CUSTOM/themes/pure/pure.zsh-theme" "$ZSH_CUSTOM/themes/pure.zsh-theme"
# Set theme in .zshrc
ZSH_THEME="" # Disable Oh My Zsh themes
echo 'fpath+=$ZSH_CUSTOM/themes/pure' >> ~/.zshrc
echo 'autoload -U promptinit; promptinit' >> ~/.zshrc
echo 'prompt pure' >> ~/.zshrc
```_
oder Zinit Plugin Manager
```bash
# Add to .zshrc
zinit ice compile'(pure|async).zsh' pick'async.zsh' src'pure.zsh'
zinit light sindresorhus/pure
# Alternative with Oh My Zsh compatibility
zinit ice pick'async.zsh' src'pure.zsh'
zinit light sindresorhus/pure
```_
Antibody Plugin Manager
```bash
# Add to .zshrc
antibody bundle mafredri/zsh-async
antibody bundle sindresorhus/pure
# Or use antibody bundle file
echo 'mafredri/zsh-async' >> ~/.zsh_plugins.txt
echo 'sindresorhus/pure' >> ~/.zsh_plugins.txt
antibody bundle < ~/.zsh_plugins.txt > ~/.zsh_plugins.sh
source ~/.zsh_plugins.sh
```_
Konfiguration
### Basic Setup
```bash
# Add to .zshrc after Pure installation
autoload -U promptinit; promptinit
prompt pure
# Reload configuration
source ~/.zshrc
```_
### Color Customization
```bash
# Customize colors in .zshrc
# Available colors: black, red, green, yellow, blue, magenta, cyan, white
# Or use color codes: 0-255
# Prompt symbol color
zstyle ':prompt:pure:prompt:success' color green
zstyle ':prompt:pure:prompt:error' color red
# Path color
zstyle ':prompt:pure:path' color blue
# Git branch color
zstyle ':prompt:pure:git:branch' color cyan
# Git dirty state color
zstyle ':prompt:pure:git:dirty' color yellow
# Git stash color
zstyle ':prompt:pure:git:stash' color magenta
# Command execution time color
zstyle ':prompt:pure:execution_time' color yellow
# User and host color (when shown)
zstyle ':prompt:pure:user' color magenta
zstyle ':prompt:pure:host' color cyan
# Virtualenv color
zstyle ':prompt:pure:virtualenv' color yellow
```_
### Symbol Customization
```bash
# Customize symbols in .zshrc
# Prompt symbols
zstyle ':prompt:pure:prompt:success' symbol '❯'
zstyle ':prompt:pure:prompt:error' symbol '❯'
zstyle ':prompt:pure:prompt:continuation' symbol '…'
# Git symbols
zstyle ':prompt:pure:git:up_arrow' symbol '⇡'
zstyle ':prompt:pure:git:down_arrow' symbol '⇣'
zstyle ':prompt:pure:git:dirty' symbol '*'
zstyle ':prompt:pure:git:stash' symbol '≡'
# Alternative symbols
zstyle ':prompt:pure:prompt:success' symbol '→'
zstyle ':prompt:pure:prompt:error' symbol '✗'
zstyle ':prompt:pure:git:dirty' symbol '!'
zstyle ':prompt:pure:git:stash' symbol '
### Display Options
```bash
# Benutzername und Hostname anzeigen
zstyle ':prompt:pure:user' zeigen wahr
zstyle ':prompt:pure:host' zeigen wahr
# Benutzername nur anzeigen, wenn anders als Standard
zstyle ':prompt:pure:user' zeigen auto
# Hostname nur über SSH anzeigen
zstyle ':prompt:pure:host' show auto
# Immer Benutzername und Hostname anzeigen
zstyle ':prompt:pure:user' Show immer
zstyle ':prompt:pure:host' Show immer
# Benutzername und Hostname nie anzeigen
zstyle ':prompt:pure:user' zeigen falsch
zstyle ':prompt:pure:host' zeigen falsch
Git Configuration¶
# Optionen zur Statusanzeige
# Git stash count anzeigen
zstyle ':prompt:pure:git:stash' zeigen wahr
# Verstecken Git stash count
zstyle ':prompt:pure:git:stash' zeigen falsch
# Zeigen Sie schmutzigen Zustand sofort (kein Async)
zstyle ':prompt:pure:git:dirty' check true
# Deaktivieren Sie schmutzige Zustandskontrolle für Leistung
zstyle ':prompt:pure:git:dirty' überprüfen falsch
# Legen Sie Git-Status-Fetch-Timeout (Sekunden)
zstyle ':prompt:pure:git:fetch' Timeout 5
Execution Time Display¶
# Befehlsausführungszeitschwelle anzeigen (Sekunden)
zstyle ':prompt:pure:execution_time' Schwelle 2
# Ausführende Zeitanzeige deaktivieren
zstyle ':prompt:pure:execution_time' zeigen falsch
# Immer Ausführungszeit anzeigen
zstyle ':prompt:pure:execution_time' zeigen true
# Zoll Ausführung Zeitformat
zstyle ':prompt:pure:execution_time' Format '%d:%02d:%02d '
Path Display¶
# Maximale Pfadsegmente anzeigen
zstyle ':prompt:pur:path' max_dirs 2
# Vollständiger Pfad
zstyle ':prompt:pur:path' max_dirs 0
# Pfadkürzelsymbol
zstyle ':prompt:pur:path' truncation '... '
# Deaktivieren des Pfades
zstyle ':prompt:pur:path' '
Advanced Configuration¶
Conditional Display¶
# Benutzer@host nur unter bestimmten Bedingungen anzeigen
# SSH Verbindungen
wenn [[ -n $SSH_CONNECTION]]; dann
zstyle ':prompt:pure:user' zeigen wahr
zstyle ':prompt:pure:host' zeigen wahr
andere
zstyle ':prompt:pure:user' zeigen falsch
zstyle ':prompt:pure:host' zeigen falsch
Fichte
# Root Benutzererkennung
wenn [[ $UID -eq 0]]; dann
zstyle ':prompt:pure:user' zeigen wahr
zstyle ':prompt:rein:prompt:success' Farbe rot
Fichte
# Verschiedene Umgebungen
Fall $HOST
Produktion-*)
zstyle ':prompt:pure:host' zeigen wahr
zstyle ':prompt:pure:host' Farbe rot
;;
stufen-*)
zstyle ':prompt:pure:host' zeigen wahr
zstyle ':prompt:pure:host' Farbe gelb
;;
Entwicklung-*)
zstyle ':prompt:pure:host' zeigen wahr
zstyle ':prompt:pure:host' Farbe grün
;;
Esac
Custom Hooks¶
# Vorbefehlshaken
pure_preexec() .
# Benutzerdefinierte Logik vor Befehlsausführung
echo "Executing: $1"
{\cHFFFF}
# Postanforderung Haken
rein_precmd() .
# Benutzerdefinierte Logik nach Befehlsausführung
# Dies läuft vor der Eingabeaufforderung
{\cHFFFF}
# Fügen Sie Haken zu precmd und preexec Arrays hinzu
precmd_functions+=(pure_precmd)
preexec_functions+=(pure_preexec)
Integration with Other Tools¶
# Virtuelle Integration
# Rein automatisch erkennt und zeigt Python virtuelle Umgebungen an
# Virtualenv-Display anpassen
zstyle ':prompt:pure:virtualenv' Farbe Cyan
zstyle ':prompt:pure:virtualenv' Format '[%s]'
# Node.js version display (custom)
Pure_node_version() \{
wenn [[ -f Paket.json]]; dann
lokale node_version=$(node --version 2>/dev/null)
wenn [[ -n $node_version]]; dann
echo " node:$node_version"
Fichte
Fichte
{\cHFFFF}
# Hinzufügen zur Eingabeaufforderung
RPROMPT='$(pure_node_version) '
Performance Optimization¶
# Deaktivieren Sie teure Git-Operationen
zstyle ':prompt:pure:git:fetch' Timeout 1
zstyle ':prompt:pure:git:dirty' überprüfen falsch
# Reduzierung Prüffrequenz des Giessstatus
zstyle ':prompt:pur:git:fetch' Intervall 60
# Async Git-Status für sehr große Repositories deaktivieren
zstyle ':prompt:pure:git:async' ermöglichen falsch
Customization Examples¶
Minimal Configuration¶
# Ultra-minimal Reine Einrichtung
autoload -U promptinit; promptinit
sofort rein
# Verstecken alles außer Pfad und Aufforderung
zstyle ':prompt:pure:user' zeigen falsch
zstyle ':prompt:pure:host' zeigen falsch
zstyle ':prompt:pure:git:stash' zeigen falsch
zstyle ':prompt:pure:execution_time' zeigen falsch
# Einfache Symbole
zstyle ':prompt:pur:prompt:success' Symbol '> '
zstyle ':prompt:pur:prompt:error' Symbol '> '
zstyle ':prompt:pure:git:dirty' Symbol '* '
Developer-Focused Configuration¶
# Entwickler-optimiert Reines Setup
autoload -U promptinit; promptinit
sofort rein
# Ausführungszeit für Leistungsüberwachung anzeigen
zstyle ':prompt:pur:execution_time' Schwelle 1
zstyle ':prompt:pure:execution_time' Farbe gelb
# Enhanced Gier Informationen
zstyle ':prompt:pure:git:stash' zeigen wahr
zstyle ':prompt:pure:git:dirty' check true
zstyle ':prompt:pur:git:branch' Farbe Cyan
zstyle ':prompt:pur:git:dirty' Farbe rot
# Benutzer@host für den Kontext anzeigen
zstyle ':prompt:pure:user' zeigen auto
zstyle ':prompt:pure:host' show auto
# Custom Symbole für bessere Sichtbarkeit
zstyle ':prompt:pure:prompt:success' Symbol ' '
zstyle ':prompt:pure:prompt:error' Symbol ' '
zstyle ':prompt:pure:git:up_arrow' Symbol '↑ '
zstyle ':prompt:pure:git:down_arrow' Symbol '↓ '
Production Environment Configuration¶
# Production-safe Pure Konfiguration
autoload -U promptinit; promptinit
sofort rein
# Zeigen Sie immer user@host für Sicherheitsbewusstsein
zstyle ':prompt:pure:user' zeigen wahr
zstyle ':prompt:pure:host' zeigen wahr
zstyle ':prompt:pure:user' Farbe rot
zstyle ':prompt:pure:host' Farbe rot
# Prominente Fehleranzeige
zstyle ':prompt:rein:prompt:error' Farbe rot
zstyle ':prompt:pur:prompt:error' Symbol '✗ '
# Ausführungszeit für Audit Trails anzeigen
zstyle ':prompt:pure:execution_time' Schwelle 0
zstyle ':prompt:pure:execution_time' Farbe gelb
# Konservative Git Einstellungen
zstyle ':prompt:pure:git:fetch' Timeout 10.
zstyle ':prompt:pure:git:dirty' check true
Multi-line Configuration¶
# Multi-line Reine Aufforderung
autoload -U promptinit; promptinit
sofort rein
# Individuelle Eingabeaufforderung für Multiline
pure_setup_multiline() )
# Erste Zeile: Pfad und git info
PROMPT='%F\{blue\}%~%f$(pure_git_info)
%F. '
# Richtige Aufforderung: Ausführungszeit und virtualenv
RPROMPT='$(pure_execution_time)$(pure_virtualenv) '
{\cHFFFF}
# Override Pures schnelles Setup
pure_setup_multiline
Integration with Development Tools¶
Git Integration¶
# Enhanced Gier Statusanzeige
zstyle ':prompt:pure:git:stash' zeigen wahr
zstyle ':prompt:pure:git:dirty' check true
# Git aliases, die gut mit Pure arbeiten
alias gs='git status --kur '
alias gd='git diff '
alias gl='git log --oneline -10'
alias gb='git branch -v '
# Git Haken für reine Optimierung
# .git/hooks/post-checkout
#/bin/sh
# Trigger Pure Giessstatus erfrischt
Kill -USR1 $
Docker Integration¶
# Docker-Kontextanzeige (Kundenspezifische Ergänzung)
pure_docker_context() )
wenn Befehl -v-Dockingstation >/dev/null 2>&1; dann
lokale kontext=$(dockerkontext anzeigen 2>/dev/null)
wenn [[ $context != "default"]]; dann
echo "docker:$context"
Fichte
Fichte
{\cHFFFF}
# Zu der rechten Aufforderung hinzufügen
RPROMPT='$(pure_docker_context)$RPROMPT '
Kubernetes Integration¶
# Kubernetes Kontextdisplay (Kundenzusatz)
pure_k8s_context() )
wenn Befehl -v kubectl >/dev/null 2>&1; dann
lokaler Kontext=$(kubectl config current-context 2>/dev/null)
lokale namespace=$(kubectl config view --minify --output 'jsonpath=\{.namespace\}' 2>/dev/null)
wenn [[ -n $context]]; dann
echo " k8s:$context$\{namespace:+/$namespace\}"
Fichte
Fichte
{\cHFFFF}
# Zu der rechten Aufforderung hinzufügen
RPROMPT='$(pure_k8s_context)$RPROMPT '
Python Virtual Environment¶
# Pure erkennt automatisch virtuelle Umgebungen
# Virtualenv-Display anpassen
zstyle ':prompt:pure:virtualenv' Farbe grün
zstyle ':prompt:pure:virtualenv' Format '(%) '
# Conda Environment support (custom)
pure_conda_env() \{
wenn [[ -n $CONDA_DEFAULT_ENV]]]; dann
echo "($CONDA_DEFAULT_ENV) "
Fichte
{\cHFFFF}
# Virtualenv-Display überschreiben, um Conda aufzunehmen
PROMPT='$(pure_conda_env)$PROMPT '
Troubleshooting¶
Common Issues¶
# Rein nicht geladen
# Überprüfen Sie, ob promptinit geladen wird
autoload -U promptinit; promptinit
# Verify Pure ist verfügbar
schnell -l|grep pure
# Kraftumladung Rein
sofort rein
# Überprüfen Sie Konflikte mit anderen prompten Themen
# Deaktivieren Sie meine Zsh-Themen
ZSH_THEME=""
# bestehende Eingabeaufforderungen löschen
PROMPT RPROMPT PS1 PS2
Performance Issues¶
# Deaktivieren Sie teure Git-Operationen
zstyle ':prompt:pure:git:fetch' Timeout 1
zstyle ':prompt:pure:git:dirty' überprüfen falsch
# Überprüfen Sie langsame Git Repositories
Zeit git Status
# Optimize Gierkonfiguration
git config --globaler Kern. Vorladeindex wahr
git config --globaler Kern. fscache wahr
git config --global gc.auto 256
# Profil Zsh startup
Zeit zsh -i -c Ausfahrt
Async Issues¶
# Überprüfen Sie, ob die Async-Bibliothek geladen wird
die async_init
# Reinstallieren Sie Async Abhängigkeit
npm install --global pure-prompt
# Manuelle Async-Installation
git clone https://github.com/mafredri/zsh-async.git ~/.zsh/async
Echo 'source' ~/.zsh/async/async.zsh' >> ~
Color Issues¶
# Überprüfen Sie die Terminal-Farbunterstützung
Echo $TERM
Tput Farben
# Testfarbe Ausgabe
für i in \{0..255\}; do print -Pn "%F\{$i\}▇%f"; getan; echo
# Farbeinstellungen zurücksetzen
zstyle -d ':prompt:pure:*' Farbe
# Verwenden Sie Grundfarben für Kompatibilität
zstyle ':prompt:rein:prompt:success' Farbe grün
zstyle ':prompt:rein:prompt:error' Farbe rot
zstyle ':prompt:pur:path' Farbe blau
Best Practices¶
Configuration Management¶
# Reine Konfiguration in separater Datei halten
~/.config/pur/config.zsh
autoload -U promptinit; promptinit
sofort rein
# Farbkonfiguration
zstyle ':prompt:rein:prompt:success' Farbe grün
zstyle ':prompt:rein:prompt:error' Farbe rot
zstyle ':prompt:pur:path' Farbe blau
zstyle ':prompt:pur:git:branch' Farbe Cyan
# Quelle von .zshrc
Quelle ~/.config/pur/config.zsh
# Versionskontrolle Reine Konfiguration
git add ~/.config/pur/config.zsh
git commit -m "Einfache schnelle Konfiguration hinzufügen"
Environment-Specific Settings¶
# Verschiedene Einstellungen für verschiedene Umgebungen
Fall $HOST
Arbeit-*)
zstyle ':prompt:pure:user' zeigen wahr
zstyle ':prompt:pure:host' zeigen wahr
zstyle ':prompt:pure:execution_time' Schwelle 1
;;
persönlich-*)
zstyle ':prompt:pure:user' zeigen falsch
zstyle ':prompt:pure:host' zeigen falsch
zstyle ':prompt:pure:execution_time' Schwelle 5
;;
Esac
# SSH-spezifische Konfiguration
wenn [[ -n $SSH_CONNECTION]]; dann
zstyle ':prompt:pure:user' zeigen wahr
zstyle ':prompt:pure:host' zeigen wahr
zstyle ':prompt:pure:host' Farbe gelb
Fichte
Performance Guidelines¶
# Optimieren Sie für große Repositories
wenn [[ $(git rev-list --count HEAD 2>/dev/null||echo 0) -gt 10000 ]]; dann
zstyle ':prompt:pure:git:dirty' überprüfen falsch
zstyle ':prompt:pure:git:fetch' Timeout 1
Fichte
* Zustand Gierstatuskontrolle
zstyle ':prompt:pure:git:dirty' check true
zstyle ':prompt:pure:git:fetch' Timeout 3
# Minimale Konfiguration für langsame Systeme
zstyle ':prompt:pure:execution_time' zeigen falsch
zstyle ':prompt:pure:git:stash' zeigen falsch
Security Considerations¶
# Verstecken sensible Informationen in Screenshots/Nachrichten
zstyle ':prompt:pure:user' zeigen falsch
zstyle ':prompt:pure:host' zeigen falsch
# Kontext in Produktionsumgebungen anzeigen
wenn [[ $HOST = ~ "prod" ]]; dann
zstyle ':prompt:pure:user' zeigen wahr
zstyle ':prompt:pure:host' zeigen wahr
zstyle ':prompt:pure:host' Farbe rot
Fichte
# Vermeiden Sie die Anzeige sensibler Pfade
zstyle ':prompt:pur:path' max_dirs 2
Pure represents the essence of minimalist prompt design, providing essential information without visual clutter. Its asynchronous Git status fetching, intelligent display logic, and extensive customization options make it an excellent choice for developers who value clean aesthetics and optimal performance. Whether you prefer the default minimal appearance or customize it extensively, Pure maintains its core philosophy of showing only what matters while staying fast and responsive.
Git Configuration¶
Execution Time Display¶
Path Display¶
Advanced Configuration¶
Conditional Display¶
Custom Hooks¶
Integration with Other Tools¶
Performance Optimization¶
Customization Examples¶
Minimal Configuration¶
Developer-Focused Configuration¶
Production Environment Configuration¶
Multi-line Configuration¶
Integration with Development Tools¶
Git Integration¶
Docker Integration¶
Kubernetes Integration¶
Python Virtual Environment¶
Troubleshooting¶
Common Issues¶
Performance Issues¶
Async Issues¶
Color Issues¶
Best Practices¶
Configuration Management¶
Environment-Specific Settings¶
Performance Guidelines¶
Security Considerations¶
Pure represents the essence of minimalist prompt design, providing essential information without visual clutter. Its asynchronous Git status fetching, intelligent display logic, and extensive customization options make it an excellent choice for developers who value clean aesthetics and optimal performance. Whether you prefer the default minimal appearance or customize it extensively, Pure maintains its core philosophy of showing only what matters while staying fast and responsive.
```_
Pure repräsentiert die Essenz der minimalistischen prompten Design, bietet wesentliche Informationen ohne visuellen Cutter. Seine asynchrone Git-Status-Fetching, intelligente Display-Logik und umfangreiche Anpassungsmöglichkeiten machen es zu einer ausgezeichneten Wahl für Entwickler, die saubere Ästhetik und optimale Leistung schätzen. Egal, ob Sie das voreingestellte minimale Aussehen bevorzugen oder es umfassend anpassen, Pure behält seine Kernphilosophie vor, nur zu zeigen, was wichtig ist, während Sie schnell und reaktionsschnell bleiben.