diff --git a/pure.zsh b/pure.zsh index a8dd55a..9c2a752 100644 --- a/pure.zsh +++ b/pure.zsh @@ -23,7 +23,7 @@ prompt_pure_git_dirty() { # check if it's dirty 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 @@ -31,7 +31,7 @@ prompt_pure_cmd_exec_time() { local stop=`date +%s` local start=${cmd_timestamp:-$stop} 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() { @@ -48,7 +48,6 @@ prompt_pure_precmd() { # git 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' # reset value since `preexec` isn't always triggered @@ -57,7 +56,7 @@ prompt_pure_precmd() { prompt_pure_setup() { - prompt_opts=( cr subst percent ) + prompt_opts=(cr subst percent) autoload -Uz add-zsh-hook autoload -Uz vcs_info @@ -70,7 +69,7 @@ prompt_pure_setup() { zstyle ':vcs_info:git*' actionformats ' %b|%a' # 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='%(?.%F{magenta}.%F{red})❯%f ' diff --git a/readme.md b/readme.md index dffd643..5e645ba 100644 --- a/readme.md +++ b/readme.md @@ -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`. -- 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: ```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.*