Introduction to Pure
Pure is a ZSH prompt designed to be aesthetically pleasing, minimalistic, and fast. Unlike many cluttered and slow prompts, Pure aims to present only essential information in an elegant manner while staying out of the user's way.
Key Features
- Prompt Character: Pure features a carefully chosen prompt character that stands out visually.
- Git Integration: It displays the current git branch and indicates if it's dirty with an asterisk (*). It also uses up and down arrows to show if there are unpushed or unpulled commits, with these checks being performed asynchronously to ensure prompt speed.
- Command Status: The prompt character changes to red if the last command did not exit successfully (exit code not 0).
- Execution Time: If a command takes longer than a specified threshold to execute, its runtime will be displayed.
- Context Aware: Pure shows the username and host only when you're in an SSH session or container.
- Title Information: The current path is displayed in the terminal's title, and it updates with the folder and command during process execution.
- VI-Mode Support: Indicates VI-mode by reversing the prompt symbol for users who prefer using the VI-mode feature in ZSH.
- Customizability: Provides an excellent starting point for users to customize their prompts further according to personal preferences.
Installation
Pure can be installed using npm
, Homebrew
, or manually. It requires ZSH version 5.2 or greater and Git version 2.15.2 or newer. Here are some installation options:
npm
To install Pure using npm, run:
npm install --global pure-prompt
Homebrew
For Homebrew users, use the following command:
brew install pure
If ZSH isn't installed via Homebrew, remember to update your fpath
in $HOME/.zshrc
:
fpath+=("$(brew --prefix)/share/zsh/site-functions")
Manual Installation
- Clone the repository into a directory such as
$HOME/.zsh/pure
.
mkdir -p "$HOME/.zsh"
git clone https://github.com/sindresorhus/pure.git "$HOME/.zsh/pure"
- Add this path to your
fpath
in the.zshrc
file:
# .zshrc
fpath+=($HOME/.zsh/pure)
Getting Started
To start using Pure, initialize the prompt system and set Pure as the prompt:
# .zshrc
autoload -U promptinit; promptinit
prompt pure
Customization
Pure offers several customization options, allowing users to adjust aspects such as the execution time threshold, git settings, and prompt symbols. Some configurations you can use include:
PURE_CMD_MAX_EXEC_TIME
: Set the max execution time before displaying it on the prompt.PURE_GIT_PULL
: Decide whether to check for remote git updates.PURE_PROMPT_SYMBOL
: Customize the prompt symbol.PURE_GIT_UP_ARROW
andPURE_GIT_DOWN_ARROW
: Define symbols for git commit status.
These options provide flexibility to tailor the prompt's appearance and functionality to suit individual workflows.
Integration
Pure can be seamlessly integrated with popular ZSH frameworks such as oh-my-zsh, prezto, zim, zplug, and others. Instructions for each are provided for those wanting to combine Pure with these environments.
Color Customization
Pure supports color customization using ZSH's zstyle
commands, allowing users to change color settings for different components of the prompt. This can be achieved using color names or RGB values where supported, allowing for a personalized and visually appealing prompt configuration.
In conclusion, Pure offers a streamlined and customizable prompt experience for ZSH users. With its focus on minimalism and speed, coupled with powerful git integrations and customizable options, it provides a high-quality tool for enhancing terminal productivity.