Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into master
Browse files Browse the repository at this point in the history
* upstream/master: (25 commits)
  Add ^_ mapping to undo in viins mode (sorin-ionescu#1860)
  Add check for empty WORKON_HOME (sorin-ionescu#1861)
  completion: bump version to tags/0.32.0 (sorin-ionescu#1856)
  README: fix small grammatical error (sorin-ionescu#1857)
  utility, helper: add aliases to use with termux terminal emulator (android) (sorin-ionescu#1859)
  prompt: update powerlevel10k submodule to v1.12.0
  git-info: use tab as separator for splitting ahead_and_behind (sorin-ionescu#902)
  Ask pyenv whether pip exists if installed (sorin-ionescu#1848)
  Remove `--all` from git alias `glg` (sorin-ionescu#1853)
  Make .zcomp* location configurable (sorin-ionescu#1842)
  prompt: update powerlevel10k submodule to v1.11.0
  prompt: update powerlevel10k submodule to v1.10.0
  [git] Add git pull autostash alias
  Do not source history-substring-search if already loaded (sorin-ionescu#1830)
  prompt: update powerlevel10k submodule to v1.7.0
  homebrew: load helper dependency
  Use shallow clone for powerlevel9k and powerlevel10k submodules (sorin-ionescu#1819)
  fix: regression in homebrew module (sorin-ionescu#1816)
  prompt: fix usage of zsh-async in sorin prompt (sorin-ionescu#1810)
  Fix missing dependency on helper module for helpers added in sorin-ionescu#1793 (sorin-ionescu#1811)
  ...
  • Loading branch information
mjwestcott committed Aug 23, 2020
2 parents f7a0e7b + 3888227 commit bfda63b
Show file tree
Hide file tree
Showing 24 changed files with 121 additions and 38 deletions.
2 changes: 2 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
[submodule "modules/prompt/external/powerlevel9k"]
path = modules/prompt/external/powerlevel9k
url = https://github.com/bhilburn/powerlevel9k.git
shallow = true
[submodule "modules/prompt/external/powerlevel10k"]
path = modules/prompt/external/powerlevel10k
url = https://github.com/romkatv/powerlevel10k.git
shallow = true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Updating

Run `zprezto-update` to automatically check if there is an update to zprezto.
If there are no file conflicts, zprezto and its submodules will be
automatically updated. If there are conflicts you will instructed to go into
automatically updated. If there are conflicts you will be instructed to go into
the `$ZPREZTODIR` directory and resolve them yourself.

To pull the latest changes and update submodules manually:
Expand Down
3 changes: 2 additions & 1 deletion modules/command-not-found/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ elif (( $+commands[brew] )); then
"$(brew --repository 2> /dev/null)"/Library/Taps/*/*/cmd/brew-command-not-found-init(|.rb)(.N)
)
if (( $#cnf_command )); then
cache_file="${TMPDIR:-/tmp}/prezto-brew-command-not-found-cache.$UID.zsh"
cache_file="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/brew-command-not-found-cache.zsh"

if [[ "${${(@o)cnf_command}[1]}" -nt "$cache_file" \
|| "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \
|| ! -s "$cache_file" ]]; then
mkdir -p "$cache_file:h"
# brew command-not-found-init is slow; cache its output.
brew command-not-found-init >! "$cache_file" 2> /dev/null
fi
Expand Down
15 changes: 9 additions & 6 deletions modules/completion/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,24 @@ unsetopt FLOW_CONTROL # Disable start/stop characters in shell editor.
# cache time of 20 hours, so it should almost always regenerate the first time a
# shell is opened each day.
autoload -Uz compinit
_comp_files=(${ZDOTDIR:-$HOME}/.zcompdump(Nm-20))
if (( $#_comp_files )); then
compinit -i -C
_comp_path="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/zcompdump"
# #q expands globs in conditional expressions
if [[ $_comp_path(#qNmh-20) ]]; then
# -C (skip function check) implies -i (skip security check).
compinit -C -d "$_comp_path"
else
compinit -i
mkdir -p "$_comp_path:h"
compinit -i -d "$_comp_path"
fi
unset _comp_files
unset _comp_path

#
# Styles
#

# Use caching to make completion for commands such as dpkg and apt usable.
zstyle ':completion::complete:*' use-cache on
zstyle ':completion::complete:*' cache-path "${ZDOTDIR:-$HOME}/.zcompcache"
zstyle ':completion::complete:*' cache-path "${XDG_CACHE_HOME:-$HOME/.cache}/prezto/zcompcache"

# Case-insensitive (all), partial-word, and then substring completion.
if zstyle -t ':prezto:module:completion:*' case-sensitive; then
Expand Down
1 change: 1 addition & 0 deletions modules/editor/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ bindkey -M vicmd "$key_info[Control]X$key_info[Control]E" edit-command-line

# Undo/Redo
bindkey -M vicmd "u" undo
bindkey -M viins "$key_info[Control]_" undo
bindkey -M vicmd "$key_info[Control]R" redo

if (( $+widgets[history-incremental-pattern-search-backward] )); then
Expand Down
3 changes: 2 additions & 1 deletion modules/fasd/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fi
# Initialization
#

cache_file="${TMPDIR:-/tmp}/prezto-fasd-cache.$UID.zsh"
cache_file="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/fasd-cache.zsh"
if [[ "${commands[fasd]}" -nt "$cache_file" \
|| "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \
|| ! -s "$cache_file" ]]; then
Expand All @@ -31,6 +31,7 @@ if [[ "${commands[fasd]}" -nt "$cache_file" \
init_args+=(zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install)
fi

mkdir -p "$cache_file:h"
# Cache init code.
fasd --init "$init_args[@]" >! "$cache_file" 2> /dev/null
fi
Expand Down
4 changes: 3 additions & 1 deletion modules/git/alias.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ if ! zstyle -t ':prezto:module:git:alias' skip 'yes'; then
alias gfc='git clone'
alias gfcr='git clone --recurse-submodules'
alias gfm='git pull'
alias gfma='git pull --autostash'
alias gfr='git pull --rebase'
alias gfra='git pull --rebase --autostash'

# Flow (F)
alias gFi='git flow init'
Expand Down Expand Up @@ -191,7 +193,7 @@ if ! zstyle -t ':prezto:module:git:alias' skip 'yes'; then
alias gls='git log --topo-order --stat --pretty=format:"${_git_log_medium_format}"'
alias gld='git log --topo-order --stat --patch --full-diff --pretty=format:"${_git_log_medium_format}"'
alias glo='git log --topo-order --pretty=format:"${_git_log_oneline_format}"'
alias glg='git log --topo-order --all --graph --pretty=format:"${_git_log_graph_format}"'
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 --patch --pretty=format:"${_git_log_oneline_format}" -S'
Expand Down
4 changes: 2 additions & 2 deletions modules/git/functions/git-info
Original file line number Diff line number Diff line change
Expand Up @@ -275,15 +275,15 @@ function git-info {

# Format ahead.
if [[ -n "$ahead_format" ]]; then
ahead="$ahead_and_behind[(w)1]"
ahead="$ahead_and_behind[(pws:\t:)1]"
if (( ahead > 0 )); then
zformat -f ahead_formatted "$ahead_format" "A:$ahead"
fi
fi

# Format behind.
if [[ -n "$behind_format" ]]; then
behind="$ahead_and_behind[(w)2]"
behind="$ahead_and_behind[(pws:\t:)2]"
if (( behind > 0 )); then
zformat -f behind_formatted "$behind_format" "B:$behind"
fi
Expand Down
3 changes: 2 additions & 1 deletion modules/gpg/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fi

# Set the default paths to gpg-agent files.
_gpg_agent_conf="${GNUPGHOME:-$HOME/.gnupg}/gpg-agent.conf"
_gpg_agent_env="${TMPDIR:-/tmp}/gpg-agent.env.$UID"
_gpg_agent_env="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/gpg-agent.env"

# Load environment variables from previous run
source "$_gpg_agent_env" 2> /dev/null
Expand All @@ -21,6 +21,7 @@ source "$_gpg_agent_env" 2> /dev/null
if [[ -z "$GPG_AGENT_INFO" && ! -S "${GNUPGHOME:-$HOME/.gnupg}/S.gpg-agent" ]]; then
# Start gpg-agent if not started.
if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${${${(s.:.)GPG_AGENT_INFO}[2]}:--1} gpg-agent"; then
mkdir -p "$_gpg_agent_env:h"
eval "$(gpg-agent --daemon | tee "$_gpg_agent_env")"
fi
fi
Expand Down
5 changes: 4 additions & 1 deletion modules/haskell/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ if (( ! $+commands[ghc] )); then
return 1
fi

# Load dependencies.
pmodload 'helper'

# Prepend Cabal per user directories to PATH.
if [[ "$OSTYPE" == darwin* && -d $HOME/Library/Haskell ]]; then
if is-darwin && [[ -d $HOME/Library/Haskell ]]; then
path=($HOME/Library/Haskell/bin(/N) $path)
else
path=($HOME/.cabal/bin(/N) $path)
Expand Down
25 changes: 25 additions & 0 deletions modules/helper/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,28 @@ function coalesce {
done
return 1
}

# is true on MacOS Darwin
function is-darwin {
[[ "$OSTYPE" == darwin* ]]
}

# is true on Linux's
function is-linux {
[[ "$OSTYPE" == linux* ]]
}

# is true on BSD's
function is-bsd {
[[ "$OSTYPE" == *bsd* ]]
}

# is true on Cygwin (Windows)
function is-cygwin {
[[ "$OSTYPE" == cygwin* ]]
}

# is true on termux (Android)
function is-termux {
[[ "$OSTYPE" == linux-android ]]
}
4 changes: 3 additions & 1 deletion modules/history-substring-search/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
pmodload 'editor'

# Source module files.
source "${0:h}/external/zsh-history-substring-search.zsh" || return 1
if (( ! $+functions[history-substring-search-up] )); then
source "${0:h}/external/zsh-history-substring-search.zsh" || return 1
fi

#
# Search
Expand Down
5 changes: 4 additions & 1 deletion modules/homebrew/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
# Sorin Ionescu <sorin.ionescu@gmail.com>
#

# Load dependencies.
pmodload 'helper'

# Return if requirements are not found.
if [[ "$OSTYPE" != (darwin|linux)* ]]; then
if ! is-darwin && ! is-linux; then
return 1
fi

Expand Down
5 changes: 4 additions & 1 deletion modules/macports/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
# Sorin Ionescu <sorin.ionescu@gmail.com>
#

# Load dependencies.
pmodload 'helper'

# Return if requirements are not found.
if [[ "$OSTYPE" != darwin* ]]; then
if ! is-darwin; then
return 1
fi

Expand Down
3 changes: 2 additions & 1 deletion modules/node/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ typeset -A compl_commands=(

for compl_command in "${(k)compl_commands[@]}"; do
if (( $+commands[$compl_command] )); then
cache_file="${TMPDIR:-/tmp}/prezto-$compl_command-cache.$UID.zsh"
cache_file="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/$compl_command-cache.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
mkdir -p "$cache_file:h"
command ${=compl_commands[$compl_command]} >! "$cache_file" 2> /dev/null
fi

Expand Down
5 changes: 4 additions & 1 deletion modules/osx/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
# Sorin Ionescu <sorin.ionescu@gmail.com>
#

# Load dependencies.
pmodload 'helper'

# Return if requirements are not found.
if [[ "$OSTYPE" != darwin* ]]; then
if ! is-darwin; then
return 1
fi

Expand Down
4 changes: 2 additions & 2 deletions modules/pacman/functions/pacman-list-disowned
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

# function pacman-list-disowned {

local tmp="${TMPDIR:-/tmp}/pacman-disowned-$UID-$$"
local tmp="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/pacman-disowned-$$"
local db="$tmp/db"
local fs="$tmp/fs"

mkdir "$tmp"
mkdir -p "$tmp"
trap 'rm -rf "$tmp"' EXIT

pacman --quiet --query --list | sort --unique > "$db"
Expand Down
8 changes: 6 additions & 2 deletions modules/perl/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ if (( ! $+commands[perl] )); then
return 1
fi

# Load dependencies.
pmodload 'helper'

#
# Load Perlbrew or plenv
#
Expand Down Expand Up @@ -37,13 +40,14 @@ fi
# Local Module Installation
#

if [[ "$OSTYPE" == darwin* ]]; then
if is-darwin; then
# Perl is slow; cache its output.
cache_file="${TMPDIR:-/tmp}/prezto-perl-cache.$UID.zsh"
cache_file="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/perl-cache.zsh"
perl_path="$HOME/Library/Perl/5.12"

if [[ -f "$perl_path/lib/perl5/local/lib.pm" ]]; then
if [[ "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" || ! -s "$cache_file" ]]; then
mkdir -p "$cache_file:h"
perl -I$perl_path/lib/perl5 -Mlocal::lib=$perl_path >! "$cache_file"
fi

Expand Down
7 changes: 7 additions & 0 deletions modules/prompt/functions/prompt_sorin_setup
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ function prompt_sorin_async_callback {
zle && zle reset-prompt
fi
;;
"[async]")
# Code is 1 for corrupted worker output and 2 for dead worker.
if [[ $2 -eq 2 ]]; then
# Our worker died unexpectedly.
typeset -g prompt_prezto_async_init=0
fi
;;
esac
}

Expand Down
28 changes: 20 additions & 8 deletions modules/python/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
# Patrick Bos <egpbos@gmail.com>
#

# Load dependencies
pmodload 'helper'

# Load manually installed pyenv into the path
if [[ -s "${PYENV_ROOT:=$HOME/.pyenv}/bin/pyenv" ]]; then
path=("${PYENV_ROOT}/bin" $path)
Expand All @@ -22,7 +25,7 @@ elif (( $+commands[pyenv] )); then
else
if [[ -n "$PYTHONUSERBASE" ]]; then
path=($PYTHONUSERBASE/bin $path)
elif [[ "$OSTYPE" == darwin* ]]; then
elif is-darwin; then
path=($HOME/Library/Python/*/bin(N) $path)
else
# This is subject to change.
Expand Down Expand Up @@ -68,7 +71,7 @@ function _python-workon-cwd {
if [[ "$ENV_NAME" != "" ]]; then
# Activate the environment only if it is not already active
if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
if [[ -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then
if [[ -n "$WORKON_HOME" && -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then
workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME"
elif [[ -e "$ENV_NAME/bin/activate" ]]; then
source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME"
Expand Down Expand Up @@ -144,26 +147,35 @@ if (( $+VIRTUALENVWRAPPER_VIRTUALENV || $+commands[virtualenv] )) && \
fi

# Load PIP completion.
if (( $#commands[(i)pip(|[23])] )); then
cache_file="${TMPDIR:-/tmp}/prezto-pip-cache.$UID.zsh"

# Detect and use one available from among 'pip', 'pip2', 'pip3' variants
# Detect and use one available from among 'pip', 'pip2', 'pip3' variants
if [[ -n "$PYENV_ROOT" ]]; then
for pip in pip{,2,3}; do
pip_command="$(pyenv which "$pip" 2>/dev/null)"
[[ -n "$pip_command" ]] && break
done
unset pip
else
pip_command="$commands[(i)pip(|[23])]"
fi
if [[ -n "$pip_command" ]]; then
cache_file="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/pip-cache.zsh"

if [[ "$pip_command" -nt "$cache_file" \
|| "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \
|| ! -s "$cache_file" ]]; then
mkdir -p "$cache_file:h"
# pip is slow; cache its output. And also support 'pip2', 'pip3' variants
$pip_command completion --zsh \
"$pip_command" completion --zsh \
| sed -e "s/\(compctl -K [-_[:alnum:]]* pip\).*/\1{,2,3}{,.{0..9}}/" \
>! "$cache_file" \
2> /dev/null
fi

source "$cache_file"

unset cache_file pip_command
unset cache_file
fi
unset pip_command

# Load conda into the shell session, if requested
zstyle -T ':prezto:module:python' conda-init
Expand Down
5 changes: 4 additions & 1 deletion modules/rsync/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ if (( ! $+commands[rsync] )); then
return 1
fi

# Load dependencies.
pmodload 'helper'

#
# Aliases
#
Expand All @@ -23,7 +26,7 @@ fi

# macOS and HFS+ Enhancements
# https://bombich.com/kb/ccc5/credits
if [[ "$OSTYPE" == darwin* ]] && grep -q 'file-flags' <(rsync --help 2>&1); then
if is-darwin && grep -q 'file-flags' <(rsync --help 2>&1); then
_rsync_cmd="${_rsync_cmd} --crtimes --fileflags --protect-decmpfs --force-change"
fi

Expand Down
Loading

0 comments on commit bfda63b

Please sign in to comment.