Compare commits

...

10 Commits

Author SHA1 Message Date
Daniel Carrillo 83f3dca4a3 Merge upstream/master 2020-07-01 18:05:08 +02:00
Zhiming Wang a132c1007a
git-info: use tab as separator for splitting ahead_and_behind (#902)
The current implementation is not tamper-proof against a modified IFS. See discussion in https://github.com/sorin-ionescu/prezto/pull/902 for details.
2020-06-29 10:26:36 -07:00
Joost Cassee 2d3763380c
Ask pyenv whether pip exists if installed (#1848)
Pyenv will install shims for commands that exist in any interpreter, even if it is not the current one. This means that a command may technically exist, but when executed will tell the user to try a different interpreter. The original check for pip in the Python module can fail for this reason, in particular on Ubuntu 20.04.

This change checks with pyenv whether pip really exists in the current interpreter to work around this problem and fixes a bug in pip command detection.
2020-06-29 10:25:15 -07:00
hidekuro 20a78c04e5
Remove `--all` from git alias `glg` (#1853) 2020-06-29 10:23:08 -07:00
Texas Toland ff91c8d410
Make .zcomp* location configurable (#1842) 2020-06-04 13:53:44 -07:00
Roman Perepelitsa b8f5b31573 prompt: update powerlevel10k submodule to v1.11.0
Release notes: https://github.com/romkatv/powerlevel10k/releases/tag/v1.11.0
2020-05-31 20:19:44 -07:00
Srijan R Shetty cb69d2d3e4
Merge pull request #1836 from diraol/dro/git_pull_autostash
[git] Add git pull autostash alias
2020-05-29 11:56:04 +05:30
romkatv 793f239a5e prompt: update powerlevel10k submodule to v1.10.0
Release notes:

- https://github.com/romkatv/powerlevel10k/releases/tag/v1.8.0
- https://github.com/romkatv/powerlevel10k/releases/tag/v1.8.1
- https://github.com/romkatv/powerlevel10k/releases/tag/v1.8.2
- https://github.com/romkatv/powerlevel10k/releases/tag/v1.9.0
- https://github.com/romkatv/powerlevel10k/releases/tag/v1.9.1
- https://github.com/romkatv/powerlevel10k/releases/tag/v1.10.0
2020-05-20 03:22:52 -07:00
Diego Rabatone Oliveira 649c0e4561 [git] Add git pull autostash alias
Adds the gfma and gfra aliases with the `--autostash` flag.
2020-05-14 15:19:03 -03:00
Amyn 13c61bae30
Do not source history-substring-search if already loaded (#1830) 2020-05-02 11:21:27 -07:00
14 changed files with 50 additions and 27 deletions

View File

@ -21,11 +21,12 @@ elif (( $+commands[brew] )); then
"$(brew --repository 2> /dev/null)"/Library/Taps/*/*/cmd/brew-command-not-found-init(|.rb)(.N) "$(brew --repository 2> /dev/null)"/Library/Taps/*/*/cmd/brew-command-not-found-init(|.rb)(.N)
) )
if (( $#cnf_command )); then 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" \ if [[ "${${(@o)cnf_command}[1]}" -nt "$cache_file" \
|| "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \ || "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \
|| ! -s "$cache_file" ]]; then || ! -s "$cache_file" ]]; then
mkdir -p "$cache_file:h"
# brew command-not-found-init is slow; cache its output. # brew command-not-found-init is slow; cache its output.
brew command-not-found-init >! "$cache_file" 2> /dev/null brew command-not-found-init >! "$cache_file" 2> /dev/null
fi fi

View File

@ -32,13 +32,16 @@ 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 # cache time of 20 hours, so it should almost always regenerate the first time a
# shell is opened each day. # shell is opened each day.
autoload -Uz compinit autoload -Uz compinit
_comp_files=(${ZDOTDIR:-$HOME}/.zcompdump(Nm-20)) _comp_path="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/zcompdump"
if (( $#_comp_files )); then # #q expands globs in conditional expressions
compinit -i -C if [[ $_comp_path(#qNmh-20) ]]; then
# -C (skip function check) implies -i (skip security check).
compinit -C -d "$_comp_path"
else else
compinit -i mkdir -p "$_comp_path:h"
compinit -i -d "$_comp_path"
fi fi
unset _comp_files unset _comp_path
# #
# Styles # Styles
@ -46,7 +49,7 @@ unset _comp_files
# Use caching to make completion for commands such as dpkg and apt usable. # Use caching to make completion for commands such as dpkg and apt usable.
zstyle ':completion::complete:*' use-cache on 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. # Case-insensitive (all), partial-word, and then substring completion.
if zstyle -t ':prezto:module:completion:*' case-sensitive; then if zstyle -t ':prezto:module:completion:*' case-sensitive; then

View File

@ -19,7 +19,7 @@ fi
# Initialization # 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" \ if [[ "${commands[fasd]}" -nt "$cache_file" \
|| "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \ || "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \
|| ! -s "$cache_file" ]]; then || ! -s "$cache_file" ]]; then
@ -31,6 +31,7 @@ if [[ "${commands[fasd]}" -nt "$cache_file" \
init_args+=(zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install) init_args+=(zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install)
fi fi
mkdir -p "$cache_file:h"
# Cache init code. # Cache init code.
fasd --init "$init_args[@]" >! "$cache_file" 2> /dev/null fasd --init "$init_args[@]" >! "$cache_file" 2> /dev/null
fi fi

View File

@ -97,7 +97,9 @@ if ! zstyle -t ':prezto:module:git:alias' skip 'yes'; then
alias gfc='git clone' alias gfc='git clone'
alias gfcr='git clone --recurse-submodules' alias gfcr='git clone --recurse-submodules'
alias gfm='git pull' alias gfm='git pull'
alias gfma='git pull --autostash'
alias gfr='git pull --rebase' alias gfr='git pull --rebase'
alias gfra='git pull --rebase --autostash'
# Flow (F) # Flow (F)
alias gFi='git flow init' alias gFi='git flow init'
@ -188,7 +190,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 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 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 glo='git log --topo-order --pretty=format:"${_git_log_oneline_format}"'
alias glg='git log --topo-order --all --graph --pretty=format:"${_git_log_oneline_format}"' alias glg='git log --topo-order --graph --pretty=format:"${_git_log_oneline_format}"'
alias glb='git log --topo-order --pretty=format:"${_git_log_brief_format}"' alias glb='git log --topo-order --pretty=format:"${_git_log_brief_format}"'
alias glc='git shortlog --summary --numbered' alias glc='git shortlog --summary --numbered'
alias glS='git log --show-signature' alias glS='git log --show-signature'

View File

@ -275,7 +275,7 @@ function git-info {
# Format ahead. # Format ahead.
if [[ -n "$ahead_format" ]]; then if [[ -n "$ahead_format" ]]; then
ahead="$ahead_and_behind[(w)1]" ahead="$ahead_and_behind[(pws:\t:)1]"
if (( ahead > 0 )); then if (( ahead > 0 )); then
zformat -f ahead_formatted "$ahead_format" "A:$ahead" zformat -f ahead_formatted "$ahead_format" "A:$ahead"
fi fi
@ -283,7 +283,7 @@ function git-info {
# Format behind. # Format behind.
if [[ -n "$behind_format" ]]; then if [[ -n "$behind_format" ]]; then
behind="$ahead_and_behind[(w)2]" behind="$ahead_and_behind[(pws:\t:)2]"
if (( behind > 0 )); then if (( behind > 0 )); then
zformat -f behind_formatted "$behind_format" "B:$behind" zformat -f behind_formatted "$behind_format" "B:$behind"
fi fi

View File

@ -12,7 +12,7 @@ fi
# Set the default paths to gpg-agent files. # Set the default paths to gpg-agent files.
_gpg_agent_conf="${GNUPGHOME:-$HOME/.gnupg}/gpg-agent.conf" _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 # Load environment variables from previous run
source "$_gpg_agent_env" 2> /dev/null source "$_gpg_agent_env" 2> /dev/null
@ -21,6 +21,7 @@ source "$_gpg_agent_env" 2> /dev/null
if [[ -z "$GPG_AGENT_INFO" && ! -S "${GNUPGHOME:-$HOME/.gnupg}/S.gpg-agent" ]]; then if [[ -z "$GPG_AGENT_INFO" && ! -S "${GNUPGHOME:-$HOME/.gnupg}/S.gpg-agent" ]]; then
# Start gpg-agent if not started. # Start gpg-agent if not started.
if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${${${(s.:.)GPG_AGENT_INFO}[2]}:--1} gpg-agent"; then 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")" eval "$(gpg-agent --daemon | tee "$_gpg_agent_env")"
fi fi
fi fi

View File

@ -10,7 +10,9 @@
pmodload 'editor' pmodload 'editor'
# Source module files. # 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 # Search

View File

@ -39,12 +39,13 @@ typeset -A compl_commands=(
for compl_command in "${(k)compl_commands[@]}"; do for compl_command in "${(k)compl_commands[@]}"; do
if (( $+commands[$compl_command] )); then 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. # Completion commands are slow; cache their output if old or missing.
if [[ "$commands[$compl_command]" -nt "$cache_file" \ if [[ "$commands[$compl_command]" -nt "$cache_file" \
|| "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \ || "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \
|| ! -s "$cache_file" ]]; then || ! -s "$cache_file" ]]; then
mkdir -p "$cache_file:h"
command ${=compl_commands[$compl_command]} >! "$cache_file" 2> /dev/null command ${=compl_commands[$compl_command]} >! "$cache_file" 2> /dev/null
fi fi

View File

@ -8,11 +8,11 @@
# function pacman-list-disowned { # 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 db="$tmp/db"
local fs="$tmp/fs" local fs="$tmp/fs"
mkdir "$tmp" mkdir -p "$tmp"
trap 'rm -rf "$tmp"' EXIT trap 'rm -rf "$tmp"' EXIT
pacman --quiet --query --list | sort --unique > "$db" pacman --quiet --query --list | sort --unique > "$db"

View File

@ -42,11 +42,12 @@ fi
if is-darwin; then if is-darwin; then
# Perl is slow; cache its output. # 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" perl_path="$HOME/Library/Perl/5.12"
if [[ -f "$perl_path/lib/perl5/local/lib.pm" ]]; then if [[ -f "$perl_path/lib/perl5/local/lib.pm" ]]; then
if [[ "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" || ! -s "$cache_file" ]]; 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" perl -I$perl_path/lib/perl5 -Mlocal::lib=$perl_path >! "$cache_file"
fi fi

@ -1 +1 @@
Subproject commit 7c4b0f36c0b5d3dc1049115ecca192463c19278d Subproject commit 801bfbb2946b10527e75e77838a3657d78cb92e5

View File

@ -147,17 +147,25 @@ if (( $+VIRTUALENVWRAPPER_VIRTUALENV || $+commands[virtualenv] )) && \
fi fi
# Load PIP completion. # Load PIP completion.
if (( $#commands[(i)pip(|[23])] )); then # Detect and use one available from among 'pip', 'pip2', 'pip3' variants
cache_file="${TMPDIR:-/tmp}/prezto-pip-cache.$UID.zsh" if [[ -n "$PYENV_ROOT" ]]; then
for pip in pip{,2,3}; do
# Detect and use one available from among 'pip', 'pip2', 'pip3' variants pip_command="$(pyenv which "$pip" 2>/dev/null)"
[[ -n "$pip_command" ]] && break
done
unset pip
else
pip_command="$commands[(i)pip(|[23])]" 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" \ if [[ "$pip_command" -nt "$cache_file" \
|| "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \ || "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \
|| ! -s "$cache_file" ]]; then || ! -s "$cache_file" ]]; then
mkdir -p "$cache_file:h"
# pip is slow; cache its output. And also support 'pip2', 'pip3' variants # 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}}/" \ | sed -e "s/\(compctl -K [-_[:alnum:]]* pip\).*/\1{,2,3}{,.{0..9}}/" \
>! "$cache_file" \ >! "$cache_file" \
2> /dev/null 2> /dev/null
@ -165,8 +173,9 @@ if (( $#commands[(i)pip(|[23])] )); then
source "$cache_file" source "$cache_file"
unset cache_file pip_command unset cache_file
fi fi
unset pip_command
# Load conda into the shell session, if requested # Load conda into the shell session, if requested
zstyle -T ':prezto:module:python' conda-init zstyle -T ':prezto:module:python' conda-init

View File

@ -14,10 +14,10 @@ fi
_ssh_dir="$HOME/.ssh" _ssh_dir="$HOME/.ssh"
# Set the path to the environment file if not set by another module. # Set the path to the environment file if not set by another module.
_ssh_agent_env="${_ssh_agent_env:-${TMPDIR:-/tmp}/ssh-agent.env.$UID}" _ssh_agent_env="${_ssh_agent_env:-${XDG_CACHE_HOME:-$HOME/.cache}/prezto/ssh-agent.env}"
# Set the path to the persistent authentication socket. # Set the path to the persistent authentication socket.
_ssh_agent_sock="${TMPDIR:-/tmp}/ssh-agent.sock.$UID" _ssh_agent_sock="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/ssh-agent.sock"
# Start ssh-agent if not started. # Start ssh-agent if not started.
if [[ ! -S "$SSH_AUTH_SOCK" ]]; then if [[ ! -S "$SSH_AUTH_SOCK" ]]; then
@ -26,12 +26,14 @@ if [[ ! -S "$SSH_AUTH_SOCK" ]]; then
# Start ssh-agent if not started. # Start ssh-agent if not started.
if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${SSH_AGENT_PID:--1} ssh-agent"; then if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${SSH_AGENT_PID:--1} ssh-agent"; then
mkdir -p "$_ssh_agent_env:h"
eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")" eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")"
fi fi
fi fi
# Create a persistent SSH authentication socket. # Create a persistent SSH authentication socket.
if [[ -S "$SSH_AUTH_SOCK" && "$SSH_AUTH_SOCK" != "$_ssh_agent_sock" ]]; then if [[ -S "$SSH_AUTH_SOCK" && "$SSH_AUTH_SOCK" != "$_ssh_agent_sock" ]]; then
mkdir -p "$_ssh_agent_sock:h"
ln -sf "$SSH_AUTH_SOCK" "$_ssh_agent_sock" ln -sf "$SSH_AUTH_SOCK" "$_ssh_agent_sock"
export SSH_AUTH_SOCK="$_ssh_agent_sock" export SSH_AUTH_SOCK="$_ssh_agent_sock"
fi fi

View File

@ -8,7 +8,7 @@
# Execute code that does not affect the current session in the background. # Execute code that does not affect the current session in the background.
{ {
# Compile the completion dump to increase startup speed. # Compile the completion dump to increase startup speed.
zcompdump="${ZDOTDIR:-$HOME}/.zcompdump" zcompdump="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/zcompdump"
if [[ -s "$zcompdump" && (! -s "${zcompdump}.zwc" || "$zcompdump" -nt "${zcompdump}.zwc") ]]; then if [[ -s "$zcompdump" && (! -s "${zcompdump}.zwc" || "$zcompdump" -nt "${zcompdump}.zwc") ]]; then
zcompile "$zcompdump" zcompile "$zcompdump"
fi fi