From 3de1e24965ae42337287160b155b16b1f054cff2 Mon Sep 17 00:00:00 2001 From: Diego Rabatone Oliveira Date: Wed, 5 Dec 2018 09:38:07 -0200 Subject: [PATCH 01/11] Update submodules versions --- modules/autosuggestions/external | 2 +- modules/prompt/external/powerlevel9k | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/autosuggestions/external b/modules/autosuggestions/external index d7c7967..a7f0106 160000 --- a/modules/autosuggestions/external +++ b/modules/autosuggestions/external @@ -1 +1 @@ -Subproject commit d7c796719e6352666f7a9c94da9ddaed10f3217d +Subproject commit a7f0106b31c2538a36cab30428e6ca65d9a2ae60 diff --git a/modules/prompt/external/powerlevel9k b/modules/prompt/external/powerlevel9k index 358c105..2f4b150 160000 --- a/modules/prompt/external/powerlevel9k +++ b/modules/prompt/external/powerlevel9k @@ -1 +1 @@ -Subproject commit 358c105de7aa5e8109788adf65c08c44e368d418 +Subproject commit 2f4b15041fe31d85dc9ef705b818c3a0e6985da3 From 2286662b807d0edc4436df6277c863ddddb66ce0 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Tue, 31 Jul 2018 20:29:01 -0500 Subject: [PATCH 02/11] command-not-found: Restore idiomatic homebrewed handler loading on MacOS As is the convention in prezto, we cache the command-not-found handler to avoid incurring the performance penalty of loading ruby interpreter on every call. This restores the 'Homebrew way' of loading command-not-found handler. Further, the formally recommended command lookup mechanism in Homebrew (viz., `brew command command-not-found-init`) is ruby based and is super slow. To avoid performance penalty, we `find` it ourselves from `TAP_DIRECTORY` defined internally in Homebrew. This also reinstates support for custom taps or non-standard Homebrew location. --- modules/command-not-found/init.zsh | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/modules/command-not-found/init.zsh b/modules/command-not-found/init.zsh index 2c59a4b..dc3c2b4 100644 --- a/modules/command-not-found/init.zsh +++ b/modules/command-not-found/init.zsh @@ -12,9 +12,28 @@ 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 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' +# Load command-not-found on macOS when Homebrew tap is configured. +# To avoid performance penalty, we do not use Homebrew's ruby based command +# lookup mechanism (viz., `brew command command-not-found-init`) and instead +# `find` it ourselves from `TAP_DIRECTORY` defined internally in Homebrew. +elif (( $+commands[brew] )); then + cnf_command="$(brew --repository 2> /dev/null)"/Library/Taps/homebrew/homebrew-command-not-found/cmd/brew-command-not-found-init.rb + if [[ -s "$cnf_command" ]]; then + cache_file="${TMPDIR:-/tmp}/prezto-brew-command-not-found-cache.$UID.zsh" + + if [[ "$cnf_command" -nt "$cache_file" \ + || "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \ + || ! -s "$cache_file" ]]; then + # brew command-not-found-init is slow; cache its output. + brew command-not-found-init >! "$cache_file" 2> /dev/null + fi + + source "$cache_file" + + unset cache_file + fi + + unset cnf_command # Return if requirements are not found. else return 1 From 53286ebbdb18e9744182734082713d569ee0880b Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Fri, 7 Dec 2018 15:45:06 -0600 Subject: [PATCH 03/11] python: Make cached completion file mangling more reliable While mangling cached completion file, we cannot just assume that `$pip_command` would resolve to `pip` -- it might be `pip2` or `pip3` depending on the relative position in zsh `$commands` array. Thus replace the whole of 'pip*' with 'pip pip2 pip3' for compctl assignment. --- modules/python/init.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/python/init.zsh b/modules/python/init.zsh index 9796294..d78c0dc 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -160,10 +160,11 @@ if (( $#commands[(i)pip(|[23])] )); then || ! -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 + | sed -e "s|\(compctl -K [-_[:alnum:]]*\) pip|\1 pip pip2 pip3|" >! "$cache_file" 2> /dev/null fi source "$cache_file" + unset cache_file pip_command fi From e7fea3343f57461d8f3fa50d1a22b2c8490f9ecd Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Sun, 9 Dec 2018 17:16:21 -0600 Subject: [PATCH 04/11] python: Use more apropriate filename for pip completion --- modules/python/init.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/python/init.zsh b/modules/python/init.zsh index d78c0dc..302aff4 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -150,7 +150,7 @@ fi # Load PIP completion. if (( $#commands[(i)pip(|[23])] )); then - cache_file="${TMPDIR:-/tmp}/prezto-python-cache.$UID.zsh" + cache_file="${TMPDIR:-/tmp}/prezto-pip-cache.$UID.zsh" # Detect and use one available from among 'pip', 'pip2', 'pip3' variants pip_command="$commands[(i)pip(|[23])]" From a2398fc0454a641b020ee2d96489524bead8f3f9 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Fri, 7 Dec 2018 17:08:12 -0600 Subject: [PATCH 05/11] node: Cache completion for additional helpers Add support for npm and additional well-known helper commands --- modules/node/init.zsh | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/modules/node/init.zsh b/modules/node/init.zsh index 0a516f0..75a7ebb 100644 --- a/modules/node/init.zsh +++ b/modules/node/init.zsh @@ -28,18 +28,28 @@ elif (( ! $+commands[node] )); then return 1 fi -# Load NPM completion. -if (( $+commands[npm] )); then - cache_file="${TMPDIR:-/tmp}/prezto-node-cache.$UID.zsh" +# Load NPM and known helper completions. +typeset -A compl_commands=( + npm 'npm completion' + grunt 'grunt --completion=zsh' + gupl 'gulp --completion=zsh' +) - 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 +for compl_command in "${(k)compl_commands[@]}"; do + if (( $+commands[$compl_command] )); then + cache_file="${TMPDIR:-/tmp}/prezto-$compl_command-cache.$UID.zsh" + + # Completion commands are slow; cache their output if old or missing. + if [[ "$commands[$compl_command]" -nt "$cache_file" \ + || "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \ + || ! -s "$cache_file" ]]; then + command ${=compl_commands[$compl_command]} >! "$cache_file" 2> /dev/null + fi + + source "$cache_file" + + unset cache_file fi +done - source "$cache_file" - - unset cache_file -fi +unset compl_command{s,} From f7456453428a48cbb6d45829711a1fcbb908613e Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Tue, 11 Dec 2018 11:02:37 -0600 Subject: [PATCH 06/11] command-not-found: Support custom Homebrew tap on MacOS Added support for homebrew-command-not-found from a non-default tap --- modules/command-not-found/init.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/command-not-found/init.zsh b/modules/command-not-found/init.zsh index dc3c2b4..bcb0dea 100644 --- a/modules/command-not-found/init.zsh +++ b/modules/command-not-found/init.zsh @@ -17,11 +17,11 @@ elif [[ -s '/usr/share/doc/pkgfile/command-not-found.zsh' ]]; then # lookup mechanism (viz., `brew command command-not-found-init`) and instead # `find` it ourselves from `TAP_DIRECTORY` defined internally in Homebrew. elif (( $+commands[brew] )); then - cnf_command="$(brew --repository 2> /dev/null)"/Library/Taps/homebrew/homebrew-command-not-found/cmd/brew-command-not-found-init.rb - if [[ -s "$cnf_command" ]]; then + cnf_command=("$(brew --repository 2> /dev/null)"/Library/Taps/*/*/cmd/brew-command-not-found-init(|.rb)(.NL+0)) + if (( $#cnf_command )); then cache_file="${TMPDIR:-/tmp}/prezto-brew-command-not-found-cache.$UID.zsh" - if [[ "$cnf_command" -nt "$cache_file" \ + if [[ "${${(@o)cnf_command}[1]}" -nt "$cache_file" \ || "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \ || ! -s "$cache_file" ]]; then # brew command-not-found-init is slow; cache its output. From a987c8bc8a142d2792c4d067998959971dbc91fa Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Wed, 12 Dec 2018 16:18:58 -0600 Subject: [PATCH 07/11] python: Fix pip compctl file match pattern Make `sed` match more reliable while replacing the whole of 'pip*' with 'pip pip2 pip3' for `compctl` assignment --- modules/python/init.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/python/init.zsh b/modules/python/init.zsh index 302aff4..d61488e 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -160,7 +160,7 @@ if (( $#commands[(i)pip(|[23])] )); then || ! -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|\1 pip pip2 pip3|" >! "$cache_file" 2> /dev/null + | sed -e "s|\(compctl -K [-_[:alnum:]]*\) pip.*|\1 pip pip2 pip3|" >! "$cache_file" 2> /dev/null fi source "$cache_file" From d45d87b08feb3a0361e0564678e6d7e3a18e3751 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Wed, 12 Dec 2018 22:17:16 -0600 Subject: [PATCH 08/11] node: Make nvm lookup mechanism more efficient in homebrewed environment In homebrewed environment, avoid using `brew --prefix nvm` which is ruby based and is super slow. Instead, rely on homebrew standard behavior wherein all installed packages are available in canonical path $(brew --prefix)/opt/ (for nvm it would obviously be `$(brew --prefix)/opt/nvm`). NB: `$(brew --prefix)` (without additional argument) is a simple shell shortcut and doesn't have the same performance impact. --- modules/node/init.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/node/init.zsh b/modules/node/init.zsh index 75a7ebb..f452ec5 100644 --- a/modules/node/init.zsh +++ b/modules/node/init.zsh @@ -11,8 +11,10 @@ if [[ -s "$HOME/.nvm/nvm.sh" ]]; then source "$HOME/.nvm/nvm.sh" # Load package manager installed NVM into the shell session. -elif (( $+commands[brew] )) && [[ -d "$(brew --prefix nvm 2> /dev/null)" ]]; then +elif (( $+commands[brew] )) && \ + [[ -d "${nvm_prefix::="$(brew --prefix 2> /dev/null)"/opt/nvm}" ]]; then source "$(brew --prefix nvm)/nvm.sh" + unset nvm_prefix # Load manually installed nodenv into the shell session. elif [[ -s "$HOME/.nodenv/bin/nodenv" ]]; then From 6a2cc2e14611e7ea5742a49759180772b3fda2a4 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Wed, 12 Dec 2018 22:42:02 -0600 Subject: [PATCH 09/11] rsync: Update link to Bombich rsync page again --- modules/rsync/init.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/rsync/init.zsh b/modules/rsync/init.zsh index 3618812..b3010ed 100644 --- a/modules/rsync/init.zsh +++ b/modules/rsync/init.zsh @@ -22,7 +22,7 @@ if grep -q 'xattrs' <(rsync --help 2>&1); then fi # macOS and HFS+ Enhancements -# http://help.bombich.com/kb/overview/credits#opensource +# https://bombich.com/kb/ccc5/credits if [[ "$OSTYPE" == darwin* ]] && grep -q 'file-flags' <(rsync --help 2>&1); then _rsync_cmd="${_rsync_cmd} --crtimes --fileflags --protect-decmpfs --force-change" fi From d275f316ffdd0bbd075afbff677c3e00791fba16 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Wed, 12 Dec 2018 23:02:59 -0600 Subject: [PATCH 10/11] syntax-highlighting: Further clarify relative module ordering --- modules/syntax-highlighting/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/syntax-highlighting/README.md b/modules/syntax-highlighting/README.md index 7a28892..7a5a30c 100644 --- a/modules/syntax-highlighting/README.md +++ b/modules/syntax-highlighting/README.md @@ -9,6 +9,9 @@ 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. +To elaborate: The relative order of loading the modules would be +'syntax-highlighting', 'history-substring-search' and 'prompt'. + Contributors ------------ From 39e1a633494e5ba492fe826e0ceb104ad5318ada Mon Sep 17 00:00:00 2001 From: Bruno Oliveira da Silva Date: Thu, 13 Dec 2018 16:43:23 -0200 Subject: [PATCH 11/11] Aliases to digital sign/verify commits and tags (#651) --- modules/git/alias.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/git/alias.zsh b/modules/git/alias.zsh index dde5b35..4e4f482 100644 --- a/modules/git/alias.zsh +++ b/modules/git/alias.zsh @@ -68,10 +68,11 @@ if ! zstyle -t ':prezto:module:git:alias' skip 'yes'; then alias gcr='git revert' alias gcR='git reset "HEAD^"' alias gcs='git show' + alias gpS='git show --pretty=short --show-signature' 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' alias gCa='git add $(gCl)' @@ -190,6 +191,7 @@ if ! zstyle -t ':prezto:module:git:alias' skip 'yes'; then alias glg='git log --topo-order --all --graph --pretty=format:"${_git_log_oneline_format}"' alias glb='git log --topo-order --pretty=format:"${_git_log_brief_format}"' alias glc='git shortlog --summary --numbered' + alias glS='git log --show-signature' # Merge (m) alias gm='git merge' @@ -255,6 +257,8 @@ if ! zstyle -t ':prezto:module:git:alias' skip 'yes'; then # Tag (t) alias gt='git tag' alias gtl='git tag -l' + alias gts='git tag -s' + alias gtv='git verify-tag' # Working Copy (w) alias gws='git status --ignore-submodules=${_git_status_ignore_submodules} --short'