Minor tweaks
This commit is contained in:
10
prompt.zsh
10
prompt.zsh
@@ -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 '
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user