mirror of
https://github.com/dcarrillo/prezto.git
synced 2026-04-18 09:54:05 +00:00
Merge upstream/master
This commit is contained in:
@@ -15,9 +15,9 @@ elif [[ -s /usr/share/doc/pkgfile/command-not-found.zsh ]]; then
|
||||
# Load command-not-found on macOS when Homebrew is present. Check explicitly
|
||||
# for MacOS, since homebrew can be installed on Linux as a supplementary PM
|
||||
elif [[ "$OSTYPE" =~ ^darwin ]] && (( $+commands[brew] )); then
|
||||
homebrew_repo=${HOMEBREW_REPOSITORY:-$commands[brew]:A:h:h/Library}
|
||||
homebrew_repo=${HOMEBREW_REPOSITORY:-$commands[brew]:A:h:h}
|
||||
# Look for handler in Homebrew core (as of >=4.6.12), then in Taps (< 4.6.12)
|
||||
for hb_cnf_handler in "$homebrew_repo"/{Homebrew/command-not-found/handler.sh,Taps/homebrew/homebrew-command-not-found/handler.sh}; do
|
||||
for hb_cnf_handler in "$homebrew_repo"/{Library/Homebrew/command-not-found/handler.sh,Taps/homebrew/homebrew-command-not-found/handler.sh}; do
|
||||
if [ -f "$hb_cnf_handler" ]; then
|
||||
source "$hb_cnf_handler"
|
||||
unset hb_cnf_handler homebrew_repo
|
||||
|
||||
Submodule modules/completion/external updated: c160d09fdd...e461417f4e
@@ -83,8 +83,8 @@ zle -N edit-command-line
|
||||
# Runs bindkey but for all of the keymaps. Running it with no arguments will
|
||||
# print out the mappings for all of the keymaps.
|
||||
function bindkey-all {
|
||||
local keymap=''
|
||||
for keymap in $(bindkey -l); do
|
||||
local keymap
|
||||
for keymap in "${(@f)$(bindkey -l)}"; do
|
||||
[[ "$#" -eq 0 ]] && printf "#### %s\n" "${keymap}" 1>&2
|
||||
bindkey -M "${keymap}" "$@"
|
||||
done
|
||||
|
||||
@@ -318,11 +318,20 @@ zstyle ':prezto:module:git:alias' skip 'yes'
|
||||
index nor the working tree.
|
||||
- `gwR` resets the current HEAD, index and working tree to the specified state.
|
||||
- `gwc` removes untracked files from the working tree (dry-run).
|
||||
- `gwC` removes untracked files from the working tree.
|
||||
- `gwC` removes untracked files and directories from the working tree.
|
||||
- `gwx` removes files from the working tree and from the index recursively.
|
||||
- `gwX` removes files from the working tree and from the index recursively and
|
||||
forcefully.
|
||||
|
||||
### Working tree (W)
|
||||
|
||||
- `gWa` adds a new working tree.
|
||||
- `gWl` lists all working trees.
|
||||
- `gWx` removes a working tree.
|
||||
- `gWX` removes a working tree forcefully.
|
||||
- `gWm` moves a working tree to a new location.
|
||||
- `gWc` prunes stale worktrees and their administrative data.
|
||||
|
||||
### Shadows
|
||||
|
||||
The following aliases may shadow system commands:
|
||||
|
||||
@@ -192,7 +192,7 @@ if ! zstyle -t ':prezto:module:git:alias' skip; then
|
||||
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 glc='git shortlog --summary --numbered'
|
||||
alias glS='git log --show-signature'
|
||||
alias glS='git log --topo-order --show-signature --pretty=format:"${_git_log_medium_format}"'
|
||||
|
||||
# Merge (m)
|
||||
alias gm='git merge'
|
||||
@@ -269,7 +269,15 @@ if ! zstyle -t ':prezto:module:git:alias' skip; then
|
||||
alias gwr='git reset --soft'
|
||||
alias gwR='git reset --hard'
|
||||
alias gwc='git clean --dry-run'
|
||||
alias gwC='git clean --force'
|
||||
alias gwC='git clean -d --force'
|
||||
alias gwx='git rm -r'
|
||||
alias gwX='git rm -r --force'
|
||||
|
||||
# Worktree management (W)
|
||||
alias gWa='git worktree add'
|
||||
alias gWl='git worktree list'
|
||||
alias gWx='git worktree remove'
|
||||
alias gWX='git worktree remove --force'
|
||||
alias gWm='git worktree move'
|
||||
alias gWc='git worktree prune'
|
||||
fi
|
||||
|
||||
@@ -246,7 +246,7 @@ function git-info {
|
||||
fi
|
||||
|
||||
# Get the branch.
|
||||
branch="${$(command git symbolic-ref HEAD 2> /dev/null)#refs/heads/}"
|
||||
branch="$(escape-eval "${$(command git symbolic-ref HEAD 2> /dev/null)#refs/heads/}")"
|
||||
|
||||
# Format branch.
|
||||
zstyle -s ':prezto:module:git:info:branch' format 'branch_format'
|
||||
@@ -257,7 +257,7 @@ function git-info {
|
||||
# Format position.
|
||||
zstyle -s ':prezto:module:git:info:position' format 'position_format'
|
||||
if [[ -z "$branch" && -n "$position_format" ]]; then
|
||||
position="$(command git describe --contains --all HEAD 2> /dev/null)"
|
||||
position="$(escape-eval "$(command git describe --contains --all HEAD 2> /dev/null)")"
|
||||
if [[ -n "$position" ]]; then
|
||||
zformat -f position_formatted "$position_format" "p:$position"
|
||||
fi
|
||||
@@ -268,7 +268,7 @@ function git-info {
|
||||
if [[ -n "$branch" && -n "$remote_format" ]]; then
|
||||
# Gets the remote name.
|
||||
remote_cmd='command git rev-parse --symbolic-full-name --verify HEAD@{upstream}'
|
||||
remote="${$(${(z)remote_cmd} 2> /dev/null)##refs/remotes/}"
|
||||
remote="$(escape-eval "${$(${(z)remote_cmd} 2> /dev/null)##refs/remotes/}")"
|
||||
if [[ -n "$remote" ]]; then
|
||||
zformat -f remote_formatted "$remote_format" "R:$remote"
|
||||
fi
|
||||
|
||||
13
modules/helper/functions/escape-eval
Normal file
13
modules/helper/functions/escape-eval
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# Escapes a string for safe use in ${(e)...} parameter expansion.
|
||||
#
|
||||
# Authors:
|
||||
# Trey Keown <trey@crystalpeaksecurity.com>
|
||||
#
|
||||
|
||||
# function escape-eval {
|
||||
|
||||
setopt LOCAL_OPTIONS EXTENDED_GLOB
|
||||
print -r -- "${1//(#m)[\\\$\`]/\\$MATCH}"
|
||||
|
||||
# }
|
||||
Submodule modules/history-substring-search/external updated: 87ce96b186...14c8d2e0ff
@@ -19,7 +19,7 @@ if (( $#local_nodenv_paths || $+commands[nodenv] )); then
|
||||
# Ensure manually installed nodenv is added to path when present.
|
||||
[[ -s $local_nodenv_paths[1] ]] && path=($local_nodenv_paths[1]:h $path)
|
||||
|
||||
eval "$(nodenv init - zsh)"
|
||||
eval "$(nodenv init - --no-rehash zsh)"
|
||||
|
||||
# Load manually installed nvm into the shell session.
|
||||
elif (( $#local_nvm_paths )); then
|
||||
|
||||
2
modules/prompt/external/pure
vendored
2
modules/prompt/external/pure
vendored
Submodule modules/prompt/external/pure updated: a02209d36c...dbefd0dcaf
@@ -117,7 +117,7 @@ function prompt_cloud_setup {
|
||||
'rprompt' ''
|
||||
|
||||
# Define prompts.
|
||||
PROMPT='%B%F{$primary_color}${prefix}%f%b %B%F{$secondary_color}%c%f%b ${git_info:+${(e)git_info[prompt]}} '
|
||||
PROMPT='%B%F{$primary_color}${prefix}%f%b %B%F{$secondary_color}%c%f%b ${git_info:+$(escape-eval ${(e)git_info[prompt]})} '
|
||||
RPROMPT=''
|
||||
}
|
||||
|
||||
|
||||
@@ -27,11 +27,6 @@ prompt_damoekri_precmd() {
|
||||
if (( $+functions[ruby-info] )); then
|
||||
ruby-info
|
||||
fi
|
||||
|
||||
# Get Openstack tenant information.
|
||||
if (( $+functions[os-info] )); then
|
||||
os-info
|
||||
fi
|
||||
}
|
||||
|
||||
function prompt_damoekri_setup {
|
||||
@@ -65,12 +60,9 @@ function prompt_damoekri_setup {
|
||||
# Set ruby-info parameters.
|
||||
zstyle ':prezto:module:ruby:info:version' format ' %F{yellow}%v%f'
|
||||
|
||||
# Set openstack tenant info
|
||||
zstyle ':prezto:module:openstack:info:tenant' format '%s'
|
||||
|
||||
# Define prompts.
|
||||
PROMPT='${os_info:+${os_info[tenant]} }%F{cyan}${_prompt_damoekri_pwd}%f${editor_info[keymap]} '
|
||||
RPROMPT='${git_info:+${(e)git_info[rprompt]}}${ruby_info:+${ruby_info[version]}}'
|
||||
PROMPT='%F{cyan}${_prompt_damoekri_pwd}%f${editor_info[keymap]} '
|
||||
RPROMPT='${git_info:+$(escape-eval "${(e)git_info[rprompt]}")}${ruby_info:+$(escape-eval "${(e)ruby_info[version]}")}'
|
||||
}
|
||||
|
||||
prompt_damoekri_setup "$@"
|
||||
|
||||
@@ -61,7 +61,7 @@ function prompt_kylewest_setup {
|
||||
zstyle ':prezto:module:ruby:info:version' format '%F{blue}[%v]%f'
|
||||
|
||||
# Define prompts.
|
||||
PROMPT='%F{cyan}%c%f ${git_info:+${(e)git_info[prompt]}}${editor_info[keymap]} '
|
||||
PROMPT='%F{cyan}%c%f ${git_info:+$(escape-eval ${(e)git_info[prompt]})}${editor_info[keymap]} '
|
||||
RPROMPT='${ruby_info[version]}'
|
||||
}
|
||||
|
||||
|
||||
@@ -50,11 +50,11 @@ function prompt_paradox_build_prompt {
|
||||
prompt_paradox_start_segment blue black '$_prompt_paradox_pwd'
|
||||
|
||||
if [[ -n "$git_info" ]]; then
|
||||
prompt_paradox_start_segment green black '${(e)git_info[ref]}${(e)git_info[status]}'
|
||||
prompt_paradox_start_segment green black '$(escape-eval "${(e)git_info[ref]}${(e)git_info[status]}")'
|
||||
fi
|
||||
|
||||
if [[ -n "$python_info" ]]; then
|
||||
prompt_paradox_start_segment white black '${(e)python_info[virtualenv]}'
|
||||
prompt_paradox_start_segment white black '$(escape-eval "${(e)python_info[virtualenv]}")'
|
||||
fi
|
||||
|
||||
prompt_paradox_end_segment
|
||||
|
||||
@@ -71,7 +71,7 @@ function prompt_skwp_setup {
|
||||
zstyle ':prezto:module:ruby:info:version' format '[%v]'
|
||||
|
||||
# Define prompts.
|
||||
PROMPT="${_prompt_skwp_colors[3]}%n%f@${_prompt_skwp_colors[2]}%m%f ${_prompt_skwp_colors[5]}%~%f "'${git_info:+${(e)git_info[prompt]}}'"$ "
|
||||
PROMPT="${_prompt_skwp_colors[3]}%n%f@${_prompt_skwp_colors[2]}%m%f ${_prompt_skwp_colors[5]}%~%f "'${git_info:+$(escape-eval "${(e)git_info[prompt]}")}'"$ "
|
||||
RPROMPT='%F{blue}${ruby_info[version]}'
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ function prompt_smiley_setup {
|
||||
zstyle ':prezto:module:git:info:keys' format 'prompt' '(%b%D)'
|
||||
|
||||
# Define prompts.
|
||||
PROMPT='$python_info[virtualenv]$ruby_info[version]${git_info:+${(e)git_info[prompt]}} %B%c%b %(?:%F{green}ツ%f:%F{red}✖%f) '
|
||||
PROMPT='$python_info[virtualenv]$ruby_info[version]${git_info:+$(escape-eval ${(e)git_info[prompt]})} %B%c%b %(?:%F{green}ツ%f:%F{red}✖%f) '
|
||||
RPROMPT='${editor_info[overwrite]}${VIM:+" %B%F{green}V%f%b"}'
|
||||
SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
|
||||
}
|
||||
|
||||
@@ -56,14 +56,18 @@ FX=(
|
||||
FG[none]="$FX[none]"
|
||||
BG[none]="$FX[none]"
|
||||
colors=(black red green yellow blue magenta cyan white)
|
||||
for color in {0..255}; do
|
||||
if (( $color >= 0 )) && (( $color < $#colors )); then
|
||||
index=$(( $color + 1 ))
|
||||
FG[$colors[$index]]="\e[38;5;${color}m"
|
||||
BG[$colors[$index]]="\e[48;5;${color}m"
|
||||
fi
|
||||
|
||||
# Named ANSI colors (0–7) have both numeric and name keys.
|
||||
for color in {0..7}; do
|
||||
FG[$colors[color+1]]="\e[38;5;${color}m"
|
||||
BG[$colors[color+1]]="\e[48;5;${color}m"
|
||||
FG[$color]="\e[38;5;${color}m"
|
||||
BG[$color]="\e[48;5;${color}m"
|
||||
done
|
||||
unset color{s,} index
|
||||
|
||||
# Remaining 256-color indices have only numeric keys.
|
||||
for color in {8..255}; do
|
||||
FG[$color]="\e[38;5;${color}m"
|
||||
BG[$color]="\e[48;5;${color}m"
|
||||
done
|
||||
unset color{s,}
|
||||
|
||||
@@ -27,19 +27,20 @@ if [[ ! -S "$SSH_AUTH_SOCK" ]]; then
|
||||
# Start ssh-agent if not started.
|
||||
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 "$(print -l "${(@)${(f)"$(ssh-agent)"}:#echo *}" | tee "$_ssh_agent_env")"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create a persistent SSH authentication socket.
|
||||
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.$$"
|
||||
mv -f "$_ssh_agent_sock.$$" "$_ssh_agent_sock"
|
||||
export SSH_AUTH_SOCK="$_ssh_agent_sock"
|
||||
fi
|
||||
|
||||
# Load identities.
|
||||
if ssh-add -l 2>&1 | grep -q 'The agent has no identities'; then
|
||||
if [[ ${(@M)${(f)"$(ssh-add -l 2>&1)"}:#The agent has no identities*} ]]; then
|
||||
zstyle -a ':prezto:module:ssh:load' identities '_ssh_identities'
|
||||
# ssh-add has strange requirements for running SSH_ASKPASS, so we duplicate
|
||||
# them here. Essentially, if the other requirements are met, we redirect stdin
|
||||
|
||||
Submodule modules/syntax-highlighting/external updated: db085e4661...1d85c69261
@@ -8,8 +8,10 @@
|
||||
# function diff {
|
||||
|
||||
if zstyle -t ':prezto:module:utility:diff' color \
|
||||
&& [[ -t 1 ]] \
|
||||
&& (( $+commands[colordiff] )); then
|
||||
command diff "$@" | colordiff
|
||||
return "${pipestatus[1]}"
|
||||
else
|
||||
command diff "$@"
|
||||
fi
|
||||
|
||||
@@ -76,7 +76,9 @@ if zstyle -T ':prezto:module:utility' safe-ops; then
|
||||
fi
|
||||
|
||||
# ls
|
||||
if [[ ${(@M)${(f)"$(ls --version 2>&1)"}:#*(GNU|lsd) *} ]]; then
|
||||
_ls_version="$(ls --version 2>&1)"
|
||||
|
||||
if [[ ${(@M)${(f)_ls_version}:#*(GNU|lsd|uutils) *} ]]; then
|
||||
# GNU Core Utilities
|
||||
|
||||
if zstyle -T ':prezto:module:utility:ls' dirs-first; then
|
||||
@@ -123,10 +125,12 @@ alias lt='ll -tr' # Lists sorted by date, most recent last.
|
||||
alias lc='lt -c' # Lists sorted by date, most recent last, shows change time.
|
||||
alias lu='lt -u' # Lists sorted by date, most recent last, shows access time.
|
||||
|
||||
if [[ ${(@M)${(f)"$(ls --version 2>&1)"}:#*GNU *} ]]; then
|
||||
if [[ ${(@M)${(f)_ls_version}:#*GNU *} ]]; then
|
||||
alias lx='ll -XB' # Lists sorted by extension (GNU only).
|
||||
fi
|
||||
|
||||
unset _ls_version
|
||||
|
||||
# Grep
|
||||
if zstyle -t ':prezto:module:utility:grep' color; then
|
||||
export GREP_COLOR=${GREP_COLOR:-'37;45'} # BSD.
|
||||
|
||||
Reference in New Issue
Block a user