Puro - Minimal Zsh Prompt
"Clase de la hoja"
########################################################################################################################################################################################################################################################## Copiar todos los comandos
########################################################################################################################################################################################################################################################## Generar PDF seleccionado/button
■/div titulada
Puro es un impulso Zsh bastante, mínimo y rápido que se centra en la simplicidad y el rendimiento. Creado por Sindre Sorhus, Pure enfatiza la estética limpia, asincrónica Obtenga información y muestre inteligente de sólo información relevante. Representa la filosofía minimalista en el diseño rápido, manteniendo la funcionalidad esencial para los flujos de trabajo de desarrollo modernos.
Instalación
Prerrequisitos
# 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
Métodos de instalación
npm Instalación (Recomendada)
# Install via npm
npm install --global pure-prompt
# Verify installation
which pure
# Check version
pure --version
Instalación manual
# 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
Paquete Manager Instalación
# 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
Oh My Zsh Integration
# 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
Zinit Plugin Manager
# 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
# 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
Configuración
Configuración básica
# Add to .zshrc after Pure installation
autoload -U promptinit; promptinit
prompt pure
# Reload configuration
source ~/.zshrc
Personalización de color
# 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
Símbolo Personalización
# 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
# Mostrar/hide nombre de usuario y nombre de host
zstyle ':prompt:pure:user' mostrar verdadero
zstyle ':prompt:pure:host' mostrar verdadero
# Mostrar el nombre de usuario sólo cuando diferente de predeterminado
zstyle ':prompt:pure:user' show auto
# Mostrar el nombre de host sólo sobre SSH
zstyle ':prompt:pure:host' mostrar auto
# Mostrar siempre el nombre de usuario y el nombre de host
zstyle ':prompt:pure:user' show always
zstyle ':prompt:pure:host' show always
# Nunca mostrar el nombre de usuario y el nombre de host
zstyle ':prompt:pure:user' show false
zstyle ':prompt:pure:host' mostrar falso
Git Configuration
# Opciones de visualización de estado de Git
# Mostrar Git cuenta de basura
zstyle ':prompt:pure:git:stash' show true
# Escóndete.
zstyle ':prompt:pure:git:stash' show false
# Mostrar estado sucio inmediatamente (sin asinc)
zstyle ':prompt:pure:git:dirty' cheque true
# Control de estado sucio deshabilitado para el rendimiento
zstyle ':prompt:pure:git:dirty' check false
# Set Git status fetch timeout (segundos)
zstyle ':prompt:pure:git:fetch' timeout 5
__CODE_BLOCK_11_bash
# Mostrar el umbral del tiempo de ejecución del comando (segundos)
zstyle ':prompt:pure:execution_time' umbral 2
# Visualización del tiempo de ejecución deshabilitable
zstyle ':prompt:pure:execution_time' show false
# Siempre mostrar tiempo de ejecución
zstyle ':prompt:pure:execution_time' show true
# Formato del tiempo de ejecución personal
zstyle ':prompt:pure:execution_time' format '%d:%02d:%02d '
Path Display
# Segmentos de ruta máxima para mostrar
zstyle ':prompt:pure:path' max_dirs 2
# Mostrar el camino completo
zstyle ':prompt:pure:path' max_dirs 0
# Signo de truncación
zstyle ':prompt:pure:path' truncation '... '
# Camino desactivado truncación
zstyle ':prompt:pure:path' truncation ' '
__CODE_BLOCK_13_bash
# Mostrar usuario@host sólo en condiciones específicas
# SSH connections
si [[ -n $SSH_CONNECTION ]]; entonces
zstyle ':prompt:pure:user' mostrar verdadero
zstyle ':prompt:pure:host' mostrar verdadero
más
zstyle ':prompt:pure:user' show false
zstyle ':prompt:pure:host' mostrar falso
fi
# Detección del usuario raíz
si [[ $UID -eq 0 ]]; entonces
zstyle ':prompt:pure:user' mostrar verdadero
zstyle ':prompt:pure:prompt:success color rojo
fi
# Diferentes entornos
caso $HOST en
producción*)
zstyle ':prompt:pure:host' mostrar verdadero
zstyle ':prompt:pure:host' color rojo
;
estancamiento*)
zstyle ':prompt:pure:host' mostrar verdadero
zstyle ':prompt:pure:host' color amarillo
;
desarrollo*)
zstyle ':prompt:pure:host' mostrar verdadero
zstyle ':prompt:pure:host' color verde
;
esac
__CODE_BLOCK_14_bash
# Gancho precomandado
pure_preexec() \{
# Custom logic before command execution
eco "Ejecutar: $1"
{\cHFF}
# Gancho post-command
pure_precmd() \{
# Custom logic after command execution
# This runs before prompt is displayed
{\cHFF}
# Añadir ganchos a precmd y preexec arrays
precmd_functions+=(pure_precmd)
preexec_functions+=(pure_preexec)
Integration with Other Tools
# Integración Virtualenv
# Detecta y muestra automáticamente entornos virtuales Python
# Personalizar la pantalla virtualenv
zstyle ':prompt:pure:virtualenv' color cian
zstyle ':prompt:pure:virtualenv' formato '[%s]
# Node.js versión (costo)
pure_node_version() \{
si [[ -f package.json ]]; entonces
local node_version=$(node --version 2 título/dev/null)
si [[ -n $node_version ]]; entonces
eco "nodo:$node_version"
fi
fi
{\cHFF}
# Add to prompt
RPROMPT='$(pure_node_version) '
Performance Optimization
# Carga deshabilitada Operaciones de Git
zstyle ':prompt:pure:git:fetch' timeout 1
zstyle ':prompt:pure:git:dirty' check false
# Reducir frecuencia de comprobación de estado de Git
zstyle ':prompt:pure:git:fetch' intervalo 60
# Disable async Git status for very large repositories
zstyle ':prompt:pure:git:async' habilita false
Customization Examples
Minimal Configuration
# Configuración ultraminimal pura
autoload -U promptinit; promptinit
pura
# Ocultar todo excepto el camino y el impulso
zstyle ':prompt:pure:user' show false
zstyle ':prompt:pure:host' mostrar falso
zstyle ':prompt:pure:git:stash' show false
zstyle ':prompt:pure:execution_time' show false
# Símbolos simples
zstyle ':prompt:pure:prompt:success símbolo ' '
zstyle ':prompt:pure:prompt:error' símbolo ' '
zstyle ':prompt:pure:git:dirty' símbolo '* '
Developer-Focused Configuration
# Desarrollador optimizado Configuración pura
autoload -U promptinit; promptinit
pura
# Mostrar tiempo de ejecución para el monitoreo del desempeño
zstyle ':prompt:pure:execution_time' threshold 1
zstyle ':prompt:pure:execution_time' color amarillo
# Información sobre Git mejorado
zstyle ':prompt:pure:git:stash' show true
zstyle ':prompt:pure:git:dirty' cheque true
zstyle ':prompt:pure:git:branch' color cyan
zstyle ':prompt:pure:git:dirty' color rojo
# Mostrar usuario@host para contexto
zstyle ':prompt:pure:user' show auto
zstyle ':prompt:pure:host' mostrar auto
# símbolos personalizados para una mejor visibilidad
zstyle ':prompt:pure:prompt:success' symbol ' '
zstyle ':prompt:pure:prompt:error' símbolo ' '
zstyle ':prompt:pure:git:up_arrow' símbolo '↑ '
zstyle ':prompt:pure:git:down_arrow' símbolo '↓ '
__CODE_BLOCK_19_bash
# Seguridad de la producción Configuración pura
autoload -U promptinit; promptinit
pura
# Mostrar siempre user@host para la conciencia de seguridad
zstyle ':prompt:pure:user' mostrar verdadero
zstyle ':prompt:pure:host' mostrar verdadero
zstyle ':prompt:pure:user' color rojo
zstyle ':prompt:pure:host' color rojo
# Indicación de error prominente
zstyle ':prompt:pure:prompt:error' color rojo
zstyle ':prompt:pure:prompt:error' símbolo '✗ '
# Mostrar tiempo de ejecución para las pistas de auditoría
zstyle ':prompt:pure:execution_time' threshold 0
zstyle ':prompt:pure:execution_time' color amarillo
# Conservador Ajustes de Git
zstyle ':prompt:pure:git:fetch' timeout 10
zstyle ':prompt:pure:git:dirty' cheque true
Multi-line Configuration
# Multilínea Previsión pura
autoload -U promptinit; promptinit
pura
# Función inmediata personalizada para multilínea
pure_setup_multiline() \{
# First line: path and git info
PROMPT='%F\{blue\}%~%f$(pure_git_info)
################################################################################################################################################################################################################################################################ '
# Right prompt: execution time and virtualenv
RPROMPT='$(pure_execution_time)$(pure_virtualenv) '
{\cHFF}
# Configuración rápida de Override Pure
pure_setup_multiline
Integration with Development Tools
Git Integration
# Enhanced Pantalla de estado de Git
zstyle ':prompt:pure:git:stash' show true
zstyle ':prompt:pure:git:dirty' cheque true
# Git alias que trabajan bien con Pure
alias gs='git status --short '
alias gd='git diff '
alias gl='git log --oneline - 10'
alias gb='git branch -v '
# Ganchos para la optimización pura
# .git/hooks/post-checkout
#!/bin/sh
# Trigger Pure Actualización de estado de Git
matar -USR1 $
Docker Integration
# Pantalla de contexto Docker (adicionamiento personal)
pure_docker_context() \{
si el comando -v docker ó/dev/null 2 ventaja1; entonces
contexto local=$(contexto de puerta mostrar 2 confianza/dev/null)
si [[ $context != "default" ]]; entonces
eco "Docker:$context"
fi
fi
{\cHFF}
# Add to right prompt
RPROMPT='$(pure_docker_context)$RPPT '
Kubernetes Integration
# Pantalla contextual Kubernetes (adicionamiento personal)
pure_k8s_context() \{
si el comando -v kubectl >/dev/null 2 ventaja1; entonces
contexto local=$(kubectl config current-context 2 =/dev/null)
local namespace=$(kubectl config view --minify --output 'jsonpath=\{.namespace\}' 2 propiedades/dev/null)
si [[ -n $context ]]; entonces
eco " k8s:$context$\{namespace:+/$namespace\}"
fi
fi
{\cHFF}
# Add to right prompt
RPROMPT='$(pure_k8s_context)$RPROMPT '
Python Virtual Environment
# Puro detecta automáticamente entornos virtuales
# Personalizar la pantalla virtualenv
zstyle ':prompt:pure:virtualenv' color verde
zstyle ':prompt:pure:virtualenv' format '(%s) '
# Apoyo al medio ambiente conda (costo)
pure_conda_env() \{
si [[ -n $CONDA_DEFAULT_ENV ]]; entonces
eco "($CONDA_DEFAULT_ENV) "
fi
{\cHFF}
# Superar la pantalla virtualenv para incluir Conda
PROMPT='$(pure_conda_env)$PROMPT '
Troubleshooting
Common Issues
# Puro no cargado
# Comprueba si el promptinit está cargado
autoload -U promptinit; promptinit
# Verify Pure está disponible
prompt -l duracióngrep puro
# Recarga de la fuerza Puro
pura
# Comprobar conflictos con otros temas rápidos
# Desactivar Oh Mis temas Zsh
ZSH_THEME="
# Configuración rápida existente clara
PROMPT RPROMPT PS1 PS2
Performance Issues
# Carga deshabilitada Operaciones de Git
zstyle ':prompt:pure:git:fetch' timeout 1
zstyle ':prompt:pure:git:dirty' check false
# Comprobación lenta Repositorios de Git
tiempo git status
# Optimize Configuración de Git
Git config - núcleo global. preloadindex verdadero
Git config - núcleo global. fscache verdadero
git config --global gc.auto 256
# Perfil Zsh startup
time zsh -i -c exit
Async Issues
# Compruebe si la biblioteca async está cargada
que async_init
# Reinstall async dependency
npm instalar --global puro-prompt
# Instalación manual de async
git clone https://github.com/mafredri/zsh-async.git ~/.zsh/async
Recursos ~/.zsh/async/async.zsh' Confía ~/.zshrc
Color Issues
# Control de soporte de color terminal
eco $TERM
colores tput
# Prueba de la salida del color
para mí en \{0..255\}; do print -Pn "%F\{$i\}%%f"; done; echo
# Ajustes de color
zstyle -d ':prompt:pure:* color
# Use colores básicos para la compatibilidad
zstyle ':prompt:pure:prompt:success color verde
zstyle ':prompt:pure:prompt:error' color rojo
zstyle ':prompt:pure:path' color azul
Best Practices
Configuration Management
# Mantener la configuración Pura en un archivo separado
# ~/.config/pure/config.zsh
autoload -U promptinit; promptinit
pura
# Configuración de color
zstyle ':prompt:pure:prompt:success color verde
zstyle ':prompt:pure:prompt:error' color rojo
zstyle ':prompt:pure:path' color azul
zstyle ':prompt:pure:git:branch' color cyan
# Fuente de .zshrc
fuente ~/.config/pure/config.zsh
# Control de versiones Configuración pura
git add ~/.config/pure/config.zsh
git commit -m "Add Pure prompt settings"
Environment-Specific Settings
# Diferentes configuraciones para diferentes entornos
caso $HOST en
trabajo-*)
zstyle ':prompt:pure:user' mostrar verdadero
zstyle ':prompt:pure:host' mostrar verdadero
zstyle ':prompt:pure:execution_time' umbral 1
;
personal*)
zstyle ':prompt:pure:user' show false
zstyle ':prompt:pure:host' mostrar falso
zstyle ':prompt:pure:execution_time' umbral 5
;
esac
# Configuración específica de SSH
si [[ -n $SSH_CONNECTION ]]; entonces
zstyle ':prompt:pure:user' mostrar verdadero
zstyle ':prompt:pure:host' mostrar verdadero
zstyle ':prompt:pure:host' color amarillo
fi
Performance Guidelines
# Optimize for large repositories
si [[ $(git rev-list --count HEAD 2>/dev/null||echo 0) -gt 10000 ]]; entonces
zstyle ':prompt:pure:git:dirty' check false
zstyle ':prompt:pure:git:fetch' timeout 1
fi
# condicional Control de estado de Git
zstyle ':prompt:pure:git:dirty' cheque true
zstyle ':prompt:pure:git:fetch' timeout 3
# Configuración mínima para sistemas lentos
zstyle ':prompt:pure:execution_time' show false
zstyle ':prompt:pure:git:stash' show false
__CODE_BLOCK_32_bash
# Ocultar información confidencial en capturas de pantalla/grabaciones
zstyle ':prompt:pure:user' show false
zstyle ':prompt:pure:host' mostrar falso
# Mostrar contexto en entornos de producción
si [[ $HOST =~ "prod" ]]; entonces
zstyle ':prompt:pure:user' mostrar verdadero
zstyle ':prompt:pure:host' mostrar verdadero
zstyle ':prompt:pure:host' color rojo
fi
# Evite mostrar caminos sensibles
zstyle ':prompt:pure: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.
### Opciones de visualización
Git Configuration
### Configuración de Git
Execution Time Display
### Visualización del tiempo de ejecución
Path Display
### Pantalla de ruta
Advanced Configuration
Conditional Display
## Configuración avanzada
### Pantalla condicional
Custom Hooks
### Ganchos personalizados
Integration with Other Tools
### Integración con otras herramientas
Performance Optimization
### Optimización del rendimiento
Customization Examples
Minimal Configuration
## Ejemplos de personalización
### Configuración mínima
Developer-Focused Configuration
### Configuración basada en desarrolladores
Production Environment Configuration
### Configuración de Medio Ambiente de Producción
Multi-line Configuration
### Configuración multilínea
Integration with Development Tools
Git Integration
## Integración con Herramientas de Desarrollo
### Git Integration
Docker Integration
### Docker Integration
Kubernetes Integration
### Kubernetes Integration
Python Virtual Environment
### Python Virtual Environment
Troubleshooting
Common Issues
## Solución de problemas
### Cuestiones comunes
Performance Issues
### Cuestiones de ejecución
Async Issues
### Async Issues
Color Issues
### Cuestiones de color
Best Practices
Configuration Management
## Buenas prácticas
### Configuration Management
Environment-Specific Settings
### Ajustes ambientales-específicos
Performance Guidelines
### Directrices de ejecución
Security Considerations
### Consideraciones de seguridad
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.
```
Puro representa la esencia del diseño rápido minimalista, proporcionando información esencial sin desorden visual. Su asincrónico estado de Git, lógica de visualización inteligente y amplias opciones de personalización hacen que sea una excelente opción para los desarrolladores que valoran la estética limpia y el rendimiento óptimo. Ya sea que prefiera la apariencia mínima predeterminada o personalizarla extensamente, Pure mantiene su filosofía central de mostrar sólo lo que importa mientras se mantiene rápido y sensible.