Minor tweaks

This commit is contained in:
Sindre Sorhus
2012-10-17 22:56:08 +02:00
parent fce3351be3
commit dc2a50ad35
2 changed files with 6 additions and 6 deletions

View File

@@ -1,11 +1,11 @@
# Pure # Pure
# by Sindre Sorhus # by Sindre Sorhus
# https://github.com/sindresorhus/pure/ # https://github.com/sindresorhus/pure
# MIT License # MIT License
# Change this to your own username # Change this to your own username
local default_username='sindresorhus' DEFAULT_USERNAME='sindresorhus'
# Threshold (sec) for showing cmd exec time # Threshold (sec) for showing cmd exec time
CMD_MAX_EXEC_TIME=5 CMD_MAX_EXEC_TIME=5
@@ -30,7 +30,7 @@ zstyle ':vcs_info:git*' formats ' %b'
zstyle ':vcs_info:git*' actionformats ' %b|%a' zstyle ':vcs_info:git*' actionformats ' %b|%a'
# Only show username if not default # Only show username if not default
[ $USER != $default_username ] && local username='%n@%m ' [ $USER != $DEFAULT_USERNAME ] && local username='%n@%m '
# Fastest possible way to check if repo is dirty # Fastest possible way to check if repo is dirty
git_dirty() { git_dirty() {
@@ -51,13 +51,13 @@ preexec() {
precmd() { precmd() {
vcs_info vcs_info
# Add `%*` to show the time # Add `%*` to display the time
print -P '\n%F{blue}%~%F{236}$vcs_info_msg_0_`git_dirty` $username%f %F{yellow}`cmd_exec_time`%f' print -P '\n%F{blue}%~%F{236}$vcs_info_msg_0_`git_dirty` $username%f %F{yellow}`cmd_exec_time`%f'
# Reset value since `preexec` isn't always triggered # Reset value since `preexec` isn't always triggered
unset cmd_timestamp unset cmd_timestamp
} }
# Turns the prompt red if the last command exited with 0 # Prompt turns red if the previous command didn't exit with 0
PROMPT='%(?.%F{magenta}.%F{red})%f ' PROMPT='%(?.%F{magenta}.%F{red})%f '
# Can be disabled: # Can be disabled:
# PROMPT='%F{magenta}%f ' # PROMPT='%F{magenta}%f '

View File

@@ -23,7 +23,7 @@ Most prompts are cluttered, ugly and slow. I wanted something visually pleasing
- Download `prompt.zsh` or submodule this repo - Download `prompt.zsh` or submodule this repo
- In your `.zshrc` add `. path/to/prompt.zsh` - In your `.zshrc` add `. path/to/prompt.zsh`
- Add your username to the `default_username` variable - Add your username to `DEFAULT_USERNAME`
## Tip ## Tip