diff --git a/.editorconfig b/.editorconfig index 86c8f59..1c6314a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,9 +7,6 @@ charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true -[package.json] +[*.yml] indent_style = space indent_size = 2 - -[*.md] -trim_trailing_whitespace = false diff --git a/.gitattributes b/.gitattributes index 176a458..6313b56 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -* text=auto +* text=auto eol=lf diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/license b/license index 654d0bf..e7af2f7 100644 --- a/license +++ b/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus (sindresorhus.com) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/package.json b/package.json index 5f8228e..a6b41fb 100644 --- a/package.json +++ b/package.json @@ -1,45 +1,42 @@ { - "name": "pure-prompt", - "version": "1.9.0", - "description": "Pretty, minimal and fast ZSH prompt", - "license": "MIT", - "repository": "sindresorhus/pure", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "maintainers": [ - { - "name": "Mathias Fredriksson", - "url": "github.com/mafredri" - } - ], - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "postinstall": "PURE_DEST=/usr/local/share/zsh/site-functions npm run --silent postinstall-link && exit 0; PURE_DEST=\"$PWD/functions\" npm run postinstall-link && npm run postinstall-fail-instructions", - "postinstall-link": "mkdir -p \"$PURE_DEST\" && ln -sf \"$PWD/pure.zsh\" \"$PURE_DEST/prompt_pure_setup\" && ln -sf \"$PWD/async.zsh\" \"$PURE_DEST/async\"", - "postinstall-fail-instructions": "echo \"ERROR: Could not automagically symlink the prompt. Either:\\n1. Check out the readme on how to do it manually: https://github.com/sindresorhus/pure#manually\\n2. Or add the following to your \\`.zshrc\\`:\\n\\n fpath+=('$PWD/functions')\"" - }, - "files": [ - "pure.zsh", - "async.zsh" - ], - "keywords": [ - "zsh", - "zshell", - "sh", - "shell", - "bash", - "pure", - "prompt", - "theme", - "git", - "async", - "fast", - "minimal", - "pretty" - ] + "name": "pure-prompt", + "version": "1.9.0", + "description": "Pretty, minimal and fast ZSH prompt", + "license": "MIT", + "repository": "sindresorhus/pure", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "maintainers": [ + { + "name": "Mathias Fredriksson", + "url": "https://github.com/mafredri" + } + ], + "scripts": { + "postinstall": "PURE_DEST=/usr/local/share/zsh/site-functions npm run --silent postinstall-link && exit 0; PURE_DEST=\"$PWD/functions\" npm run postinstall-link && npm run postinstall-fail-instructions", + "postinstall-link": "mkdir -p \"$PURE_DEST\" && ln -sf \"$PWD/pure.zsh\" \"$PURE_DEST/prompt_pure_setup\" && ln -sf \"$PWD/async.zsh\" \"$PURE_DEST/async\"", + "postinstall-fail-instructions": "echo \"ERROR: Could not automagically symlink the prompt. Either:\\n1. Check out the readme on how to do it manually: https://github.com/sindresorhus/pure#manually\\n2. Or add the following to your \\`.zshrc\\`:\\n\\n fpath+=('$PWD/functions')\"" + }, + "files": [ + "pure.zsh", + "async.zsh" + ], + "keywords": [ + "zsh", + "zshell", + "sh", + "shell", + "bash", + "pure", + "prompt", + "theme", + "git", + "async", + "fast", + "minimal", + "pretty" + ] } diff --git a/pure.zsh b/pure.zsh index 8bfb03f..6d20b78 100644 --- a/pure.zsh +++ b/pure.zsh @@ -24,7 +24,7 @@ # \e[2K => clear everything on the current line -# turns seconds into human readable time +# Turns seconds into human readable time. # 165392 => 1d 21h 56m 32s # https://github.com/sindresorhus/pretty-time-zsh prompt_pure_human_time_to_var() { @@ -38,11 +38,12 @@ prompt_pure_human_time_to_var() { (( minutes > 0 )) && human+="${minutes}m " human+="${seconds}s" - # store human readable time in variable as specified by caller + # Store human readable time in a variable as specified by the caller typeset -g "${var}"="${human}" } -# stores (into prompt_pure_cmd_exec_time) the exec time of the last command if set threshold was exceeded +# Stores (into prompt_pure_cmd_exec_time) the execution +# time of the last command if set threshold was exceeded. prompt_pure_check_cmd_exec_time() { integer elapsed (( elapsed = EPOCHSECONDS - ${prompt_pure_cmd_timestamp:-$EPOCHSECONDS} )) @@ -55,7 +56,7 @@ prompt_pure_check_cmd_exec_time() { prompt_pure_set_title() { setopt localoptions noshwordsplit - # emacs terminal does not support settings the title + # Emacs terminal does not support settings the title. (( ${+EMACS} )) && return case $TTY in @@ -63,7 +64,7 @@ prompt_pure_set_title() { /dev/ttyS[0-9]*) return;; esac - # Show hostname if connected via ssh. + # Show hostname if connected via SSH. local hostname= if [[ -n $prompt_pure_state[username] ]]; then # Expand in-place in case ignore-escape is used. @@ -76,17 +77,16 @@ prompt_pure_set_title() { ignore-escape) opts=(-r);; esac - # Set title atomically in one print statement so that it works - # when XTRACE is enabled. + # Set title atomically in one print statement so that it works when XTRACE is enabled. print -n $opts $'\e]0;'${hostname}${2}$'\a' } prompt_pure_preexec() { if [[ -n $prompt_pure_git_fetch_pattern ]]; then - # detect when git is performing pull/fetch (including git aliases). + # Detect when Git is performing pull/fetch, including Git aliases. local -H MATCH MBEGIN MEND match mbegin mend if [[ $2 =~ (git|hub)\ (.*\ )?($prompt_pure_git_fetch_pattern)(\ .*)?$ ]]; then - # we must flush the async jobs to cancel our git fetch in order + # We must flush the async jobs to cancel our git fetch in order # to avoid conflicts with the user issued pull / fetch. async_flush_jobs 'prompt_pure' fi @@ -94,25 +94,25 @@ prompt_pure_preexec() { typeset -g prompt_pure_cmd_timestamp=$EPOCHSECONDS - # shows the current dir and executed command in the title while a process is active + # Shows the current directory and executed command in the title while a process is active. prompt_pure_set_title 'ignore-escape' "$PWD:t: $2" - # Disallow python virtualenv from updating the prompt, set it to 12 if + # Disallow Python virtualenv from updating the prompt. Set it to 12 if # untouched by the user to indicate that Pure modified it. Here we use - # magic number 12, same as in psvar. + # the magic number 12, same as in `psvar`. export VIRTUAL_ENV_DISABLE_PROMPT=${VIRTUAL_ENV_DISABLE_PROMPT:-12} } -# Change the colors if their value are different from the current ones +# Change the colors if their value are different from the current ones. prompt_pure_set_colors() { local color_temp for key value in ${(kv)prompt_pure_colors}; do zstyle -t ":prompt:pure:$key" color "$value" case $? in - 1) # The current style is different from the one from zstyle + 1) # The current style is different from the one from zstyle. zstyle -s ":prompt:pure:$key" color color_temp prompt_pure_colors[$key]=$color_temp ;; - 2) # No style is defined + 2) # No style is defined. prompt_pure_colors[$key]=$prompt_pure_colors_default[$key] ;; esac done @@ -121,8 +121,7 @@ prompt_pure_set_colors() { prompt_pure_preprompt_render() { setopt localoptions noshwordsplit - # Set color for git branch/dirty status, change color if dirty checking has - # been delayed. + # Set color for Git branch/dirty status and change color if dirty checking has been delayed. local git_color=$prompt_pure_colors[git:branch] [[ -n ${prompt_pure_git_last_dirty_check_timestamp+x} ]] && git_color=$prompt_pure_colors[git:branch:cached] @@ -132,7 +131,7 @@ prompt_pure_preprompt_render() { # Set the path. preprompt_parts+=('%F{${prompt_pure_colors[path]}}%~%f') - # Add git branch and dirty status info. + # Add Git branch and dirty status info. typeset -gA prompt_pure_vcs_info if [[ -n $prompt_pure_vcs_info[branch] ]]; then preprompt_parts+=("%F{$git_color}"'${prompt_pure_vcs_info[branch]}${prompt_pure_git_dirty}%f') @@ -182,23 +181,23 @@ prompt_pure_preprompt_render() { } prompt_pure_precmd() { - # check exec time and store it in a variable + # Check execution time and store it in a variable. prompt_pure_check_cmd_exec_time unset prompt_pure_cmd_timestamp - # shows the full path in the title + # Shows the full path in the title. prompt_pure_set_title 'expand-prompt' '%~' - # Modify the colors if some have changed + # Modify the colors if some have changed.. prompt_pure_set_colors - # preform async git dirty check and fetch + # Perform async Git dirty check and fetch. prompt_pure_async_tasks - # Check if we should display the virtual env, we use a sufficiently high + # Check if we should display the virtual env. We use a sufficiently high # index of psvar (12) here to avoid collisions with user defined entries. psvar[12]= - # Check if a conda environment is active and display it's name + # Check if a Conda environment is active and display its name. if [[ -n $CONDA_DEFAULT_ENV ]]; then psvar[12]="${CONDA_DEFAULT_ENV//[$'\t\r\n']}" fi @@ -212,7 +211,7 @@ prompt_pure_precmd() { # Make sure VIM prompt is reset. prompt_pure_reset_prompt_symbol - # print the preprompt + # Print the preprompt. prompt_pure_preprompt_render "precmd" if [[ -n $ZSH_THEME ]]; then @@ -226,32 +225,32 @@ prompt_pure_async_git_aliases() { setopt localoptions noshwordsplit local -a gitalias pullalias - # list all aliases and split on newline. + # List all aliases and split on newline. gitalias=(${(@f)"$(command git config --get-regexp "^alias\.")"}) for line in $gitalias; do - parts=(${(@)=line}) # split line on spaces - aliasname=${parts[1]#alias.} # grab the name (alias.[name]) - shift parts # remove aliasname + parts=(${(@)=line}) # Split line on spaces. + aliasname=${parts[1]#alias.} # Grab the name (alias.[name]). + shift parts # Remove `aliasname` - # check alias for pull or fetch (must be exact match). + # Check alias for pull or fetch. Must be exact match. if [[ $parts =~ ^(.*\ )?(pull|fetch)(\ .*)?$ ]]; then pullalias+=($aliasname) fi done - print -- ${(j:|:)pullalias} # join on pipe (for use in regex). + print -- ${(j:|:)pullalias} # Join on pipe, for use in regex. } prompt_pure_async_vcs_info() { setopt localoptions noshwordsplit - # configure vcs_info inside async task, this frees up vcs_info + # Configure `vcs_info` inside an async task. This frees up `vcs_info` # to be used or configured as the user pleases. zstyle ':vcs_info:*' enable git zstyle ':vcs_info:*' use-simple true - # only export two msg variables from vcs_info + # Only export two message variables from `vcs_info`. zstyle ':vcs_info:*' max-exports 2 - # export branch (%b) and git toplevel (%R) + # Export branch (%b) and Git toplevel (%R). zstyle ':vcs_info:git*' formats '%b' '%R' zstyle ':vcs_info:git*' actionformats '%b|%a' '%R' @@ -265,7 +264,7 @@ prompt_pure_async_vcs_info() { print -r - ${(@kvq)info} } -# fastest possible way to check if repo is dirty +# Fastest possible way to check if a Git repo is dirty. prompt_pure_async_git_dirty() { setopt localoptions noshwordsplit local untracked_dirty=$1 @@ -282,12 +281,12 @@ prompt_pure_async_git_dirty() { prompt_pure_async_git_fetch() { setopt localoptions noshwordsplit - # set GIT_TERMINAL_PROMPT=0 to disable auth prompting for git fetch (git 2.3+) + # Sets `GIT_TERMINAL_PROMPT=0` to disable authentication prompt for Git fetch (Git 2.3+). export GIT_TERMINAL_PROMPT=0 - # set ssh BachMode to disable all interactive ssh password prompting + # Set SSH `BachMode` to disable all interactive SSH password prompting. export GIT_SSH_COMMAND="${GIT_SSH_COMMAND:-"ssh"} -o BatchMode=yes" - # Default return code, indicates Git fetch failure. + # Default return code, which indicates Git fetch failure. local fail_code=99 # Guard against all forms of password prompts. By setting the shell into @@ -317,7 +316,7 @@ prompt_pure_async_git_fetch() { unsetopt monitor - # check arrow status after a successful git fetch + # Check arrow status after a successful `git fetch`. prompt_pure_async_git_arrows } @@ -329,7 +328,7 @@ prompt_pure_async_git_arrows() { prompt_pure_async_tasks() { setopt localoptions noshwordsplit - # initialize async worker + # Initialize the async worker. ((!${prompt_pure_async_init:-0})) && { async_start_worker "prompt_pure" -u -n async_register_callback "prompt_pure" prompt_pure_async_callback @@ -343,10 +342,10 @@ prompt_pure_async_tasks() { local -H MATCH MBEGIN MEND if [[ $PWD != ${prompt_pure_vcs_info[pwd]}* ]]; then - # stop any running async jobs + # Stop any running async jobs. async_flush_jobs "prompt_pure" - # reset git preprompt variables, switching working tree + # Reset Git preprompt variables, switching working tree. unset prompt_pure_git_dirty unset prompt_pure_git_last_dirty_check_timestamp unset prompt_pure_git_arrows @@ -358,7 +357,7 @@ prompt_pure_async_tasks() { async_job "prompt_pure" prompt_pure_async_vcs_info - # # only perform tasks inside git working tree + # Only perform tasks inside a Git working tree. [[ -n $prompt_pure_vcs_info[top] ]] || return prompt_pure_async_refresh @@ -368,25 +367,26 @@ prompt_pure_async_refresh() { setopt localoptions noshwordsplit if [[ -z $prompt_pure_git_fetch_pattern ]]; then - # we set the pattern here to avoid redoing the pattern check until the - # working three has changed. pull and fetch are always valid patterns. + # We set the pattern here to avoid redoing the pattern check until the + # working three has changed. Pull and fetch are always valid patterns. typeset -g prompt_pure_git_fetch_pattern="pull|fetch" async_job "prompt_pure" prompt_pure_async_git_aliases fi async_job "prompt_pure" prompt_pure_async_git_arrows - # do not preform git fetch if it is disabled or in home folder. + # Do not preform `git fetch` if it is disabled or in home folder. if (( ${PURE_GIT_PULL:-1} )) && [[ $prompt_pure_vcs_info[top] != $HOME ]]; then - # tell worker to do a git fetch + # Tell the async worker to do a `git fetch`. async_job "prompt_pure" prompt_pure_async_git_fetch fi - # if dirty checking is sufficiently fast, tell worker to check it again, or wait for timeout + # If dirty checking is sufficiently fast, + # tell the worker to check it again, or wait for timeout. integer time_since_last_dirty_check=$(( EPOCHSECONDS - ${prompt_pure_git_last_dirty_check_timestamp:-0} )) if (( time_since_last_dirty_check > ${PURE_GIT_DELAY_DIRTY_CHECK:-1800} )); then unset prompt_pure_git_last_dirty_check_timestamp - # check check if there is anything to pull + # Check check if there is anything to pull. async_job "prompt_pure" prompt_pure_async_git_dirty ${PURE_GIT_UNTRACKED_DIRTY:-1} fi } @@ -409,9 +409,9 @@ prompt_pure_async_callback() { case $job in \[async]) - # code is 1 for corrupted worker output and 2 for dead worker + # Code is 1 for corrupted worker output and 2 for dead worker. if [[ $code -eq 2 ]]; then - # our worker died unexpectedly + # Our worker died unexpectedly. typeset -g prompt_pure_async_init=0 fi ;; @@ -419,31 +419,31 @@ prompt_pure_async_callback() { local -A info typeset -gA prompt_pure_vcs_info - # parse output (z) and unquote as array (Q@) + # Parse output (z) and unquote as array (Q@). info=("${(Q@)${(z)output}}") local -H MATCH MBEGIN MEND if [[ $info[pwd] != $PWD ]]; then # The path has changed since the check started, abort. return fi - # check if git toplevel has changed + # Check if Git top-level has changed. if [[ $info[top] = $prompt_pure_vcs_info[top] ]]; then - # if stored pwd is part of $PWD, $PWD is shorter and likelier - # to be toplevel, so we update pwd + # If the stored pwd is part of $PWD, $PWD is shorter and likelier + # to be top-level, so we update pwd. if [[ $prompt_pure_vcs_info[pwd] = ${PWD}* ]]; then prompt_pure_vcs_info[pwd]=$PWD fi else - # store $PWD to detect if we (maybe) left the git path + # Store $PWD to detect if we (maybe) left the Git path. prompt_pure_vcs_info[pwd]=$PWD fi unset MATCH MBEGIN MEND - # update has a git toplevel set which means we just entered a new - # git directory, run the async refresh tasks + # The update has a Git top-level set, which means we just entered a new + # Git directory. Run the async refresh tasks. [[ -n $info[top] ]] && [[ -z $prompt_pure_vcs_info[top] ]] && prompt_pure_async_refresh - # always update branch and toplevel + # Always update branch and top-level. prompt_pure_vcs_info[branch]=$info[branch] prompt_pure_vcs_info[top]=$info[top] @@ -451,7 +451,7 @@ prompt_pure_async_callback() { ;; prompt_pure_async_git_aliases) if [[ -n $output ]]; then - # append custom git aliases to the predefined ones. + # Append custom Git aliases to the predefined ones. prompt_pure_git_fetch_pattern+="|$output" fi ;; @@ -465,13 +465,14 @@ prompt_pure_async_callback() { [[ $prev_dirty != $prompt_pure_git_dirty ]] && do_render=1 - # When prompt_pure_git_last_dirty_check_timestamp is set, the git info is displayed in a different color. - # To distinguish between a "fresh" and a "cached" result, the preprompt is rendered before setting this - # variable. Thus, only upon next rendering of the preprompt will the result appear in a different color. + # When `prompt_pure_git_last_dirty_check_timestamp` is set, the Git info is displayed + # in a different color. To distinguish between a "fresh" and a "cached" result, the + # preprompt is rendered before setting this variable. Thus, only upon the next + # rendering of the preprompt will the result appear in a different color. (( $exec_time > 5 )) && prompt_pure_git_last_dirty_check_timestamp=$EPOCHSECONDS ;; prompt_pure_async_git_fetch|prompt_pure_async_git_arrows) - # prompt_pure_async_git_fetch executes prompt_pure_async_git_arrows + # `prompt_pure_async_git_fetch` executes `prompt_pure_async_git_arrows` # after a successful fetch. case $code in 0) @@ -486,7 +487,7 @@ prompt_pure_async_callback() { # Git fetch failed. ;; *) - # Non-zero exit status from prompt_pure_async_git_arrows, + # Non-zero exit status from `prompt_pure_async_git_arrows`, # indicating that there is no upstream configured. if [[ -n $prompt_pure_git_arrows ]]; then unset prompt_pure_git_arrows @@ -547,7 +548,7 @@ prompt_pure_state_setup() { local username hostname if [[ -z $ssh_connection ]] && (( $+commands[who] )); then # When changing user on a remote system, the $SSH_CONNECTION - # environment variable can be lost, attempt detection via who. + # environment variable can be lost. Attempt detection via `who`. local who_out who_out=$(who -m 2>/dev/null) if (( $? )); then @@ -560,7 +561,7 @@ prompt_pure_state_setup() { local reIPv6='(([0-9a-fA-F]+:)|:){2,}[0-9a-fA-F]+' # Simplified, only checks partial pattern. local reIPv4='([0-9]{1,3}\.){3}[0-9]+' # Simplified, allows invalid ranges. # Here we assume two non-consecutive periods represents a - # hostname. This matches foo.bar.baz, but not foo.bar. + # hostname. This matches `foo.bar.baz`, but not `foo.bar`. local reHostname='([.][^. ]+){2}' # Usually the remote address is surrounded by parenthesis, but @@ -578,10 +579,10 @@ prompt_pure_state_setup() { fi hostname='%F{$prompt_pure_colors[host]}@%m%f' - # show username@host if logged in through SSH + # Show `username@host` if logged in through SSH. [[ -n $ssh_connection ]] && username='%F{$prompt_pure_colors[user]}%n%f'"$hostname" - # show username@host if root, with username in default color + # Show `username@host` if root, with username in default color. [[ $UID -eq 0 ]] && username='%F{$prompt_pure_colors[user:root]}%n%f'"$hostname" typeset -gA prompt_pure_state @@ -642,8 +643,8 @@ prompt_pure_setup() { prompt_opts=(subst percent) - # borrowed from promptinit, sets the prompt options in case pure was not - # initialized via promptinit. + # Borrowed from `promptinit`. Sets the prompt options in case Pure was not + # initialized via `promptinit`. setopt noprompt{bang,cr,percent,subst} "prompt${^prompt_opts[@]}" if [[ -z $prompt_newline ]]; then @@ -660,11 +661,11 @@ prompt_pure_setup() { autoload -Uz vcs_info autoload -Uz async && async - # The add-zle-hook-widget function is not guaranteed - # to be available, it was added in Zsh 5.3. + # The `add-zle-hook-widget` function is not guaranteed to be available. + # It was added in Zsh 5.3. autoload -Uz +X add-zle-hook-widget 2>/dev/null - # Set the colors + # Set the colors. typeset -gA prompt_pure_colors_default prompt_pure_colors prompt_pure_colors_default=( execution_time yellow @@ -694,10 +695,10 @@ prompt_pure_setup() { add-zle-hook-widget zle-keymap-select prompt_pure_update_vim_prompt_widget fi - # if a virtualenv is activated, display it in grey + # If a virtualenv is activated, display it in grey. PROMPT='%(12V.%F{$prompt_pure_colors[virtualenv]}%12v%f .)' - # 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{$prompt_pure_colors[prompt:success]}.%F{$prompt_pure_colors[prompt:error]})${prompt_pure_state[prompt]}%f ' # Indicate continuation prompt by ... and use a darker color for it. @@ -709,7 +710,7 @@ prompt_pure_setup() { prompt_pure_debug_depth=('%e' '%N' '%x') # Compare is used to check if %N equals %x. When they differ, the main - # prompt is used to allow displaying both file name and function. When + # prompt is used to allow displaying both filename and function. When # they match, we use the secondary prompt to avoid displaying duplicate # information. local -A ps4_parts @@ -730,7 +731,8 @@ prompt_pure_setup() { # add colors to highlight essential parts like file and function name. PROMPT4="${ps4_parts[depth]} ${ps4_symbols}${ps4_parts[prompt]}" - unset ZSH_THEME # Guard against Oh My Zsh themes overriding Pure. + # Guard against Oh My Zsh themes overriding Pure. + unset ZSH_THEME } prompt_pure_setup "$@" diff --git a/readme.md b/readme.md index 99f5d82..f2caeef 100644 --- a/readme.md +++ b/readme.md @@ -58,7 +58,7 @@ For a user-specific installation (which would not require escalated privileges), ```sh # .zshenv or .zshrc -fpath=( "$HOME/.zfunctions" $fpath ) +fpath=("$HOME/.zfunctions" $fpath) ``` Then install the theme there: @@ -231,12 +231,14 @@ zplugin ice pick"async.zsh" src"pure.zsh" zplugin light sindresorhus/pure ``` + ## FAQ There are currently no FAQs. See [FAQ Archive](https://github.com/sindresorhus/pure/wiki/FAQ-Archive) for previous FAQs. + ## Ports - **ZSH** @@ -257,13 +259,9 @@ See [FAQ Archive](https://github.com/sindresorhus/pure/wiki/FAQ-Archive) for pre - **PowerShell** - [nickcox/pure-pwsh](https://github.com/nickcox/pure-pwsh/) - PowerShell/PS Core implementation of the Pure prompt. + ## Team [![Sindre Sorhus](https://github.com/sindresorhus.png?size=100)](http://sindresorhus.com) | [![Mathias Fredriksson](https://github.com/mafredri.png?size=100)](https://github.com/mafredri) ---|--- [Sindre Sorhus](https://github.com/sindresorhus) | [Mathias Fredriksson](https://github.com/mafredri) - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com)