minor tweaks
This commit is contained in:
9
pure.zsh
9
pure.zsh
@@ -23,7 +23,7 @@ prompt_pure_git_dirty() {
|
|||||||
# check if it's dirty
|
# check if it's dirty
|
||||||
command git diff --quiet --ignore-submodules HEAD &>/dev/null
|
command git diff --quiet --ignore-submodules HEAD &>/dev/null
|
||||||
|
|
||||||
(( $? == 1 )) && echo '*'
|
(($? == 1)) && echo '*'
|
||||||
}
|
}
|
||||||
|
|
||||||
# displays the exec time of the last command if set threshold was exceeded
|
# displays the exec time of the last command if set threshold was exceeded
|
||||||
@@ -31,7 +31,7 @@ prompt_pure_cmd_exec_time() {
|
|||||||
local stop=`date +%s`
|
local stop=`date +%s`
|
||||||
local start=${cmd_timestamp:-$stop}
|
local start=${cmd_timestamp:-$stop}
|
||||||
integer elapsed=$stop-$start
|
integer elapsed=$stop-$start
|
||||||
(( $elapsed > ${PURE_CMD_MAX_EXEC_TIME:=5} )) && echo ${elapsed}s
|
(($elapsed > ${PURE_CMD_MAX_EXEC_TIME:=5})) && echo ${elapsed}s
|
||||||
}
|
}
|
||||||
|
|
||||||
prompt_pure_preexec() {
|
prompt_pure_preexec() {
|
||||||
@@ -48,7 +48,6 @@ prompt_pure_precmd() {
|
|||||||
# git info
|
# git info
|
||||||
vcs_info
|
vcs_info
|
||||||
|
|
||||||
# add `%*` to display the time
|
|
||||||
print -P '\n%F{blue}%~%F{8}$vcs_info_msg_0_`prompt_pure_git_dirty` $prompt_pure_username%f %F{yellow}`prompt_pure_cmd_exec_time`%f'
|
print -P '\n%F{blue}%~%F{8}$vcs_info_msg_0_`prompt_pure_git_dirty` $prompt_pure_username%f %F{yellow}`prompt_pure_cmd_exec_time`%f'
|
||||||
|
|
||||||
# reset value since `preexec` isn't always triggered
|
# reset value since `preexec` isn't always triggered
|
||||||
@@ -57,7 +56,7 @@ prompt_pure_precmd() {
|
|||||||
|
|
||||||
|
|
||||||
prompt_pure_setup() {
|
prompt_pure_setup() {
|
||||||
prompt_opts=( cr subst percent )
|
prompt_opts=(cr subst percent)
|
||||||
|
|
||||||
autoload -Uz add-zsh-hook
|
autoload -Uz add-zsh-hook
|
||||||
autoload -Uz vcs_info
|
autoload -Uz vcs_info
|
||||||
@@ -70,7 +69,7 @@ prompt_pure_setup() {
|
|||||||
zstyle ':vcs_info:git*' actionformats ' %b|%a'
|
zstyle ':vcs_info:git*' actionformats ' %b|%a'
|
||||||
|
|
||||||
# show username@host if logged in through SSH
|
# show username@host if logged in through SSH
|
||||||
[[ -n "$SSH_CONNECTION" ]] && prompt_pure_username='%n@%m '
|
[[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username='%n@%m '
|
||||||
|
|
||||||
# prompt turns red if the previous command didn't exit 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 '
|
||||||
|
|||||||
@@ -24,12 +24,12 @@ Most prompts are cluttered, ugly and slow. I wanted something visually pleasing
|
|||||||
|
|
||||||
- Clone this repo, add it as a submodule, or just download `pure.zsh`.
|
- Clone this repo, add it as a submodule, or just download `pure.zsh`.
|
||||||
|
|
||||||
- Symlink `pure.zsh` to somewhere in `$fpath` with the name `prompt_pure_setup`.
|
- Symlink `pure.zsh` to somewhere in [`$fpath`](http://www.refining-linux.org/archives/46/ZSH-Gem-12-Autoloading-functions/) with the name `prompt_pure_setup`.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ ln -s ./pure.zsh /usr/local/share/zsh/site-functions/prompt_pure_setup
|
$ ln -s "$PWD/pure.zsh" /usr/local/share/zsh/site-functions/prompt_pure_setup
|
||||||
```
|
```
|
||||||
*Run `echo $fpath` to see possible locations.*
|
*Run `echo $fpath` to see possible locations.*
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user