diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7800b818c4..f4dc0d6160 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,7 +32,7 @@ there are a number of additional things to keep in mind. - Prefer `zstyle` over environment variables for configuration. - Prefer (( ... )) over [[ ... ]] for arithmetic expression. - Use the function keyword to define functions. - - The 80 character hard limit can be waved for readability. + - The 80 character hard limit can be waived for readability. #### Using an Alternative zprezto Directory diff --git a/modules/README.md b/modules/README.md index 1c2cdc54d8..1ff4e61225 100644 --- a/modules/README.md +++ b/modules/README.md @@ -20,7 +20,7 @@ Integrates zsh-autosuggestions into Prezto. Command-Not-Found ----------------- -Loads the command-not-found tool on Debian-based distributions. +Loads the command-not-found tool on macOS or Debian-based distributions. Completion ---------- @@ -122,7 +122,7 @@ Initializes OCaml package management. OSX --- -Defines Mac OS X aliases and functions. +Defines macOS aliases and functions. Pacman ------ @@ -132,7 +132,7 @@ Provides aliases and functions for the Pacman package manager and frontends. Perl ---- -Enables local Perl module installation on Mac OS X and defines alises. +Enables local Perl module installation on macOS and defines alises. Prompt ------ diff --git a/modules/command-not-found/init.zsh b/modules/command-not-found/init.zsh index 0e778031f1..2c59a4b31d 100644 --- a/modules/command-not-found/init.zsh +++ b/modules/command-not-found/init.zsh @@ -12,9 +12,9 @@ if [[ -s '/etc/zsh_command_not_found' ]]; then # Load command-not-found on Arch Linux-based distributions. elif [[ -s '/usr/share/doc/pkgfile/command-not-found.zsh' ]]; then source '/usr/share/doc/pkgfile/command-not-found.zsh' -# Load command-not-found on Mac OS X when homebrew tap is configured. -elif (( $+commands[brew] )) && brew command command-not-found-init > /dev/null 2>&1; then - eval "$(brew command-not-found-init)" +# Load command-not-found on macOS when homebrew tap is configured. +elif [[ -s '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh' ]]; then + source '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh' # Return if requirements are not found. else return 1 diff --git a/modules/completion/init.zsh b/modules/completion/init.zsh index e2cc2d4472..48202f3724 100644 --- a/modules/completion/init.zsh +++ b/modules/completion/init.zsh @@ -107,7 +107,7 @@ zstyle ':completion::*:(-command-|export):*' fake-parameters ${${${_comps[(I)-va zstyle -a ':prezto:module:completion:*:hosts' etc-host-ignores '_etc_host_ignores' zstyle -e ':completion:*:hosts' hosts 'reply=( - ${=${=${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) 2> /dev/null)"}%%[#| ]*}//\]:[0-9]*/ }//,/ }//\[/ } + ${=${=${=${${(f)"$(cat {/etc/ssh/ssh_,~/.ssh/}known_hosts(|2)(N) 2> /dev/null)"}%%[#| ]*}//\]:[0-9]*/ }//,/ }//\[/ } ${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2> /dev/null))"}%%(\#${_etc_host_ignores:+|${(j:|:)~_etc_host_ignores}})*} ${=${${${${(@M)${(f)"$(cat ~/.ssh/config 2> /dev/null)"}:#Host *}#Host }:#*\**}:#*\?*}} )' diff --git a/modules/editor/README.md b/modules/editor/README.md index f0799611f9..c27e8642c0 100644 --- a/modules/editor/README.md +++ b/modules/editor/README.md @@ -26,8 +26,6 @@ zstyle ':prezto:module:editor' dot-expansion 'yes' ### PS Context -**NOTE:** *This is deprecated and will be removed in future versions.* - To enable the prompt context to be set, add the following to your *zpreztorc*. diff --git a/modules/editor/init.zsh b/modules/editor/init.zsh index df019e7609..085947ef61 100644 --- a/modules/editor/init.zsh +++ b/modules/editor/init.zsh @@ -116,21 +116,20 @@ function editor-info { } zle -N editor-info -# Reset the prompt based on the current context and whether the prompt utilizes -# the editor:info zstyle. If the prompt does utilize the editor:info, we must -# reset the prompt, otherwise the change in the prompt will never update. If the -# prompt does not utilize the editor:info, we simply redisplay the command line. +# Reset the prompt based on the current context and +# the ps-context option. function zle-reset-prompt { - # Explicitly check to see if there is an editor info keymap set that would - # require a reset of the prompt - if zstyle -L ':prezto:module:editor:info*' | grep -v 'completing' > /dev/null 2>&1; then + if zstyle -t ':prezto:module:editor' ps-context; then # If we aren't within one of the specified contexts, then we want to reset # the prompt with the appropriate editor_info[keymap] if there is one. if [[ $CONTEXT != (select|cont) ]]; then zle reset-prompt + zle -R fi + else + zle reset-prompt + zle -R fi - zle -R } zle -N zle-reset-prompt diff --git a/modules/fasd/init.zsh b/modules/fasd/init.zsh index 113a8716f0..37babd8e3e 100644 --- a/modules/fasd/init.zsh +++ b/modules/fasd/init.zsh @@ -20,7 +20,9 @@ fi # cache_file="${TMPDIR:-/tmp}/prezto-fasd-cache.$UID.zsh" -if [[ "${commands[fasd]}" -nt "$cache_file" || ! -s "$cache_file" ]]; then +if [[ "${commands[fasd]}" -nt "$cache_file" \ + || "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \ + || ! -s "$cache_file" ]]; then # Set the base init arguments. init_args=(zsh-hook) diff --git a/modules/git/README.md b/modules/git/README.md index 1eba33cb78..a497826267 100644 --- a/modules/git/README.md +++ b/modules/git/README.md @@ -82,6 +82,8 @@ zstyle ':prezto:module:git:alias' skip 'yes' - `gcR` removes the *HEAD* commit. - `gcs` displays various types of objects. - `gcl` lists lost commits. + - `gcy` displays commits yet to be applied to upstream in the short format. + - `gcY` displays commits yet to be applied to upstream. ### Conflict @@ -231,7 +233,8 @@ zstyle ':prezto:module:git:alias' skip 'yes' ### Push - `gp` updates remote refs along with associated objects. - - `gpf` forcefully updates remote refs along with associated objects. + - `gpf` forcefully updates remote refs along with associated objects using the safer `--force-with-lease` option. + - `gpF` forcefully updates remote refs along with associated objects using the riskier `--force` option. - `gpa` updates remote branches along with associated objects. - `gpA` updates remote branches and tags along with associated objects. - `gpt` updates remote tags along with associated objects. diff --git a/modules/git/alias.zsh b/modules/git/alias.zsh index a54a2e0828..dde5b351c1 100644 --- a/modules/git/alias.zsh +++ b/modules/git/alias.zsh @@ -69,6 +69,8 @@ if ! zstyle -t ':prezto:module:git:alias' skip 'yes'; then alias gcR='git reset "HEAD^"' alias gcs='git show' alias gcl='git-commit-lost' + alias gcy='git cherry -v --abbrev' + alias gcY='git cherry -v' # Conflict (C) alias gCl='git --no-pager diff --name-only --diff-filter=U' diff --git a/modules/gnu-utility/init.zsh b/modules/gnu-utility/init.zsh index cbf9a4baa8..4675a3ca56 100644 --- a/modules/gnu-utility/init.zsh +++ b/modules/gnu-utility/init.zsh @@ -15,16 +15,16 @@ fi _gnu_utility_cmds=( # Coreutils - '[' 'base64' 'basename' 'cat' 'chcon' 'chgrp' 'chmod' 'chown' + '[' 'b2sum' 'base32' 'base64' 'basename' 'cat' 'chcon' 'chgrp' 'chmod' 'chown' 'chroot' 'cksum' 'comm' 'cp' 'csplit' 'cut' 'date' 'dd' 'df' 'dir' 'dircolors' 'dirname' 'du' 'echo' 'env' 'expand' 'expr' 'factor' 'false' 'fmt' 'fold' 'groups' 'head' 'hostid' 'id' - 'install' 'join' 'kill' 'link' 'ln' 'logname' 'ls' 'md5sum' - 'mkdir' 'mkfifo' 'mknod' 'mktemp' 'mv' 'nice' 'nl' 'nohup' 'nproc' - 'od' 'paste' 'pathchk' 'pinee' 'pr' 'printenv' 'printf' 'ptx' + 'install' 'join' 'kill' 'link' 'ln' 'logname' 'ls' 'md5sum' 'mkdir' + 'mkfifo' 'mknod' 'mktemp' 'mv' 'nice' 'nl' 'nohup' 'nproc' + 'numfmt' 'od' 'paste' 'pathchk' 'pinky' 'pr' 'printenv' 'printf' 'ptx' 'pwd' 'readlink' 'realpath' 'rm' 'rmdir' 'runcon' 'seq' 'sha1sum' 'sha224sum' 'sha256sum' 'sha384sum' 'sha512sum' 'shred' 'shuf' - 'sleep' 'sort' 'split' 'stat' 'stty' 'sum' 'sync' 'tac' 'tail' + 'sleep' 'sort' 'split' 'stat' 'stdbuf' 'stty' 'sum' 'sync' 'tac' 'tail' 'tee' 'test' 'timeout' 'touch' 'tr' 'true' 'truncate' 'tsort' 'tty' 'uname' 'unexpand' 'uniq' 'unlink' 'uptime' 'users' 'vdir' 'wc' 'who' 'whoami' 'yes' diff --git a/modules/node/init.zsh b/modules/node/init.zsh index 578c642436..0a516f0dfb 100644 --- a/modules/node/init.zsh +++ b/modules/node/init.zsh @@ -32,7 +32,9 @@ fi if (( $+commands[npm] )); then cache_file="${TMPDIR:-/tmp}/prezto-node-cache.$UID.zsh" - if [[ "$commands[npm]" -nt "$cache_file" || ! -s "$cache_file" ]]; then + if [[ "$commands[npm]" -nt "$cache_file" \ + || "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \ + || ! -s "$cache_file" ]]; then # npm is slow; cache its output. npm completion >! "$cache_file" 2> /dev/null fi diff --git a/modules/osx/README.md b/modules/osx/README.md index 870b486408..1f93a2c332 100644 --- a/modules/osx/README.md +++ b/modules/osx/README.md @@ -1,7 +1,7 @@ OSX === -Defines [Mac OS X][1] aliases and functions. +Defines [macOS][1] aliases and functions. Settings -------- @@ -34,8 +34,8 @@ Functions - `tab` creates a new tab (works in both _Terminal_ and [_iTerm_][3]). - `ql` previews files in Quick Look. - `osx-rm-dir-metadata` deletes .DS\_Store, \_\_MACOSX cruft. - - `osx-ls-download-history` displays the Mac OS X download history. - - `osx-rm-download-history` deletes the Mac OS X download history. + - `osx-ls-download-history` displays the macOS download history. + - `osx-rm-download-history` deletes the macOS download history. Authors ------- diff --git a/modules/osx/functions/osx-ls-download-history b/modules/osx/functions/osx-ls-download-history index ba6a40c7ea..8b6eaab260 100644 --- a/modules/osx/functions/osx-ls-download-history +++ b/modules/osx/functions/osx-ls-download-history @@ -1,5 +1,5 @@ # -# Displays the Mac OS X download history. +# Displays the macOS download history. # # Authors: # Sorin Ionescu diff --git a/modules/osx/functions/osx-rm-download-history b/modules/osx/functions/osx-rm-download-history index c6a368cafb..068ba3db93 100644 --- a/modules/osx/functions/osx-rm-download-history +++ b/modules/osx/functions/osx-rm-download-history @@ -1,5 +1,5 @@ # -# Deletes the Mac OS X download history. +# Deletes the macOS download history. # # Authors: # Sorin Ionescu diff --git a/modules/osx/init.zsh b/modules/osx/init.zsh index edf6ed3d5f..f7871ca718 100644 --- a/modules/osx/init.zsh +++ b/modules/osx/init.zsh @@ -1,5 +1,5 @@ # -# Defines Mac OS X aliases and functions. +# Defines macOS aliases and functions. # # Authors: # Sorin Ionescu diff --git a/modules/perl/README.md b/modules/perl/README.md index 092c922478..67f2a17798 100644 --- a/modules/perl/README.md +++ b/modules/perl/README.md @@ -1,14 +1,14 @@ Perl ==== -Enables local [Perl][1] module installation on Mac OS X and defines aliases. +Enables local [Perl][1] module installation on macOS and defines aliases. Local Module Installation ------------------------- Perl versions older than 5.14 do not support the local installation of Perl modules natively. This module allows for local installation of Perl modules on -Mac OS X in *~/Library/Perl/5.12* by altering the environment. +macOS in *~/Library/Perl/5.12* by altering the environment. ### Usage diff --git a/modules/perl/init.zsh b/modules/perl/init.zsh index ffd5f0dfd8..b7a794797a 100644 --- a/modules/perl/init.zsh +++ b/modules/perl/init.zsh @@ -1,5 +1,5 @@ # -# Enables local Perl module installation on Mac OS X and defines aliases. +# Enables local Perl module installation on macOS and defines aliases. # # Authors: # Sorin Ionescu @@ -43,7 +43,7 @@ if [[ "$OSTYPE" == darwin* ]]; then perl_path="$HOME/Library/Perl/5.12" if [[ -f "$perl_path/lib/perl5/local/lib.pm" ]]; then - if [[ ! -s "$cache_file" ]]; then + if [[ "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" || ! -s "$cache_file" ]]; then perl -I$perl_path/lib/perl5 -Mlocal::lib=$perl_path >! "$cache_file" fi diff --git a/modules/python/init.zsh b/modules/python/init.zsh index bb48f6cda6..45e9b8dd6b 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -19,7 +19,7 @@ elif (( $+commands[pyenv] )); then eval "$(pyenv init -)" # Prepend PEP 370 per user site packages directory, which defaults to -# ~/Library/Python on Mac OS X and ~/.local elsewhere, to PATH. The +# ~/Library/Python on macOS and ~/.local elsewhere, to PATH. The # path can be overridden using PYTHONUSERBASE. else if [[ -n "$PYTHONUSERBASE" ]]; then @@ -94,7 +94,7 @@ if (( $+VIRTUALENVWRAPPER_VIRTUALENV || $+commands[virtualenv] )) && \ export WORKON_HOME="${WORKON_HOME:-$HOME/.virtualenvs}" # Disable the virtualenv prompt. - VIRTUAL_ENV_DISABLE_PROMPT=1 + export VIRTUAL_ENV_DISABLE_PROMPT=1 # Create a sorted array of available virtualenv related 'pyenv' commands to # look for plugins of interest. Scanning shell '$path' isn't enough as they @@ -149,7 +149,9 @@ if (( $#commands[(i)pip(|[23])] )); then # Detect and use one available from among 'pip', 'pip2', 'pip3' variants pip_command="$commands[(i)pip(|[23])]" - if [[ "$pip_command" -nt "$cache_file" || ! -s "$cache_file" ]]; then + if [[ "$pip_command" -nt "$cache_file" \ + || "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \ + || ! -s "$cache_file" ]]; then # pip is slow; cache its output. And also support 'pip2', 'pip3' variants $pip_command completion --zsh \ | sed -e "s|compctl -K [-_[:alnum:]]* pip|& pip2 pip3|" >! "$cache_file" 2> /dev/null diff --git a/modules/rsync/README.md b/modules/rsync/README.md index b418780b87..77d78ea54c 100644 --- a/modules/rsync/README.md +++ b/modules/rsync/README.md @@ -3,7 +3,7 @@ Rsync Defines [rsync][1] aliases. -Mac OS X users are encouraged to use [Bombich's rsync][2], which has HFS+ +macOS users are encouraged to use [Bombich's rsync][2], which has HFS+ enhancements. Aliases diff --git a/modules/rsync/init.zsh b/modules/rsync/init.zsh index 3afebdb4dd..a802222fac 100644 --- a/modules/rsync/init.zsh +++ b/modules/rsync/init.zsh @@ -20,7 +20,7 @@ if grep -q 'xattrs' <(rsync --help 2>&1); then _rsync_cmd="${_rsync_cmd} --acls --xattrs" fi -# Mac OS X and HFS+ Enhancements +# macOS and HFS+ Enhancements # http://help.bombich.com/kb/overview/credits#opensource if [[ "$OSTYPE" == darwin* ]] && grep -q 'file-flags' <(rsync --help 2>&1); then _rsync_cmd="${_rsync_cmd} --crtimes --fileflags --protect-decmpfs --force-change" diff --git a/modules/syntax-highlighting/README.md b/modules/syntax-highlighting/README.md index 5dad5bbad9..7a28892a46 100644 --- a/modules/syntax-highlighting/README.md +++ b/modules/syntax-highlighting/README.md @@ -3,9 +3,11 @@ Syntax Highlighting Integrates [zsh-syntax-highlighting][1] into Prezto. -This module should be loaded *second to last*, where last is the *prompt* -module, unless used in conjuncture with the *history-substring-search* module -where it must be loaded **before** it. +This module should be loaded before the *prompt* module. + +Additionally, if this module is used in conjunction with the +*history-substring-search* module, this module must be loaded **before** the +*history-substring-search* module. Contributors ------------ diff --git a/modules/tmux/README.md b/modules/tmux/README.md index 3d742ba684..0738d7cfad 100644 --- a/modules/tmux/README.md +++ b/modules/tmux/README.md @@ -62,7 +62,7 @@ Aliases Caveats ------- -On Mac OS X, launching tmux can cause the error **launch_msg(...): Socket is not +On macOS, launching tmux can cause the error **launch_msg(...): Socket is not connected** to be displayed, which can be fixed by installing [reattach-to-user-namespace][3], available in [Homebrew][4], and adding the following to *tmux.conf*: @@ -71,7 +71,7 @@ following to *tmux.conf*: set-option -g default-command "reattach-to-user-namespace -l $SHELL -l" ``` -Furthermore, tmux is known to cause **kernel panics** on Mac OS X. A discussion +Furthermore, tmux is known to cause **kernel panics** on macOS. A discussion about this and Prezto has already been [opened][2]. Authors diff --git a/modules/tmux/init.zsh b/modules/tmux/init.zsh index a361a6a60b..fb56d07603 100644 --- a/modules/tmux/init.zsh +++ b/modules/tmux/init.zsh @@ -23,7 +23,7 @@ if ([[ "$TERM_PROGRAM" = 'iTerm.app' ]] && \ _tmux_iterm_integration='-CC' fi -if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" && -z "$INSIDE_EMACS" ]] && ( \ +if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" && -z "$INSIDE_EMACS" && -z "$VSCODE_PID" ]] && ( \ ( [[ -n "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' remote ) || ( [[ -z "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' local ) \ ); then diff --git a/modules/utility/init.zsh b/modules/utility/init.zsh index c6c87d2ae6..942090d777 100644 --- a/modules/utility/init.zsh +++ b/modules/utility/init.zsh @@ -76,10 +76,13 @@ if is-callable 'dircolors'; then alias ls='ls --group-directories-first' if zstyle -t ':prezto:module:utility:ls' color; then - if [[ -s "$HOME/.dir_colors" ]]; then - eval "$(dircolors --sh "$HOME/.dir_colors")" - else - eval "$(dircolors --sh)" + # Call dircolors to define colors if they're missing + if [[ -z "$LS_COLORS" ]]; then + if [[ -s "$HOME/.dir_colors" ]]; then + eval "$(dircolors --sh "$HOME/.dir_colors")" + else + eval "$(dircolors --sh)" + fi fi alias ls="${aliases[ls]:-ls} --color=auto" @@ -89,11 +92,15 @@ if is-callable 'dircolors'; then else # BSD Core Utilities if zstyle -t ':prezto:module:utility:ls' color; then - # Define colors for BSD ls. - export LSCOLORS='exfxcxdxbxGxDxabagacad' + # Define colors for BSD ls if they're not already defined + if [[ -z "$LSCOLORS" ]]; then + export LSCOLORS='exfxcxdxbxGxDxabagacad' + fi - # Define colors for the completion system. - export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=36;01:cd=33;01:su=31;40;07:sg=36;40;07:tw=32;40;07:ow=33;40;07:' + # Define colors for the completion system if they're not already defined + if [[ -z "$LS_COLORS" ]]; then + export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=36;01:cd=33;01:su=31;40;07:sg=36;40;07:tw=32;40;07:ow=33;40;07:' + fi alias ls="${aliases[ls]:-ls} -G" else @@ -121,7 +128,7 @@ if zstyle -t ':prezto:module:utility:grep' color; then alias grep="${aliases[grep]:-grep} --color=auto" fi -# Mac OS X Everywhere +# macOS Everywhere if [[ "$OSTYPE" == darwin* ]]; then alias o='open' elif [[ "$OSTYPE" == cygwin* ]]; then diff --git a/runcoms/zlogout b/runcoms/zlogout index 56b6b5515e..b5d9858c08 100644 --- a/runcoms/zlogout +++ b/runcoms/zlogout @@ -8,11 +8,12 @@ # Execute code only if STDERR is bound to a TTY. [[ -o INTERACTIVE && -t 2 ]] && { -# Print the message. -cat <<-EOF +SAYINGS=( + "So long and thanks for all the fish.\n -- Douglas Adams" + "Good morning! And in case I don't see ya, good afternoon, good evening and goodnight.\n --Truman Burbank" +) -Thank you. Come again! - -- Dr. Apu Nahasapeemapetilon -EOF +# Print a randomly-chosen message: +echo $SAYINGS[$(($RANDOM % ${#SAYINGS} + 1))] } >&2 diff --git a/runcoms/zpreztorc b/runcoms/zpreztorc index 812a2f03a9..398335ff51 100644 --- a/runcoms/zpreztorc +++ b/runcoms/zpreztorc @@ -83,6 +83,9 @@ zstyle ':prezto:module:editor' dot-expansion 'yes' # Allow the zsh prompt context to be shown. zstyle ':prezto:module:editor' ps-context 'yes' +# Allow the zsh prompt context to be shown. +#zstyle ':prezto:module:editor' ps-context 'yes' + # # Git # @@ -111,7 +114,7 @@ zstyle ':prezto:module:history-substring-search:color' not-found '' zstyle ':prezto:module:history-substring-search' globbing-flags '' # -# OS X +# macOS # # Set the keyword used by `mand` to open man pages in Dash.app