From b3c27bb16460c677eabbe3d8e210f79fb5e8189b Mon Sep 17 00:00:00 2001 From: Diego Rabatone Oliveira Date: Mon, 5 Mar 2018 05:56:25 -0300 Subject: [PATCH 1/6] Replace git with 'command git' (#1551) to improve performance if git is aliased to hub or other wrappers. --- modules/git/functions/_git-hub-browse | 8 +++--- modules/git/functions/_git-info | 2 +- modules/git/functions/_git-submodule-move | 4 +-- modules/git/functions/_git-submodule-remove | 4 +-- modules/git/functions/git-branch-current | 4 +-- modules/git/functions/git-commit-lost | 6 ++-- modules/git/functions/git-dir | 2 +- modules/git/functions/git-hub-browse | 10 +++---- modules/git/functions/git-info | 28 +++++++++---------- modules/git/functions/git-root | 2 +- .../git/functions/git-stash-clear-interactive | 6 ++-- modules/git/functions/git-stash-dropped | 6 ++-- modules/git/functions/git-stash-recover | 6 ++-- modules/git/functions/git-submodule-move | 6 ++-- modules/git/functions/git-submodule-remove | 12 ++++---- modules/utility/functions/wdiff | 2 +- 16 files changed, 54 insertions(+), 54 deletions(-) diff --git a/modules/git/functions/_git-hub-browse b/modules/git/functions/_git-hub-browse index 9e6d6f0d5c..075314bb90 100644 --- a/modules/git/functions/_git-hub-browse +++ b/modules/git/functions/_git-hub-browse @@ -8,7 +8,7 @@ # Sorin Ionescu # -if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then +if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then return 1 fi @@ -21,7 +21,7 @@ _arguments -C -s -S \ case "$state" in (remote) - remotes=($(git config --get-regexp 'remote.*.url' | cut -d. -f2)) + remotes=($(command git config --get-regexp 'remote.*.url' | cut -d. -f2)) _describe -t branch 'remotes' remotes && ret=0 ;; @@ -29,7 +29,7 @@ case "$state" in remote="$words[(($CURRENT - 1))]" branches_or_tags=($( - git ls-remote --heads --tags "$remote" 2> /dev/null | cut -f2 + command git ls-remote --heads --tags "$remote" 2> /dev/null | cut -f2 )) branches=(HEAD ${${(M)branches_or_tags[@]##refs/heads/?##}##refs/heads/}) @@ -39,7 +39,7 @@ case "$state" in _describe -t tag 'tags' tags && ret=0 ;; (file) - files=(${(0)"$(_call_program files git ls-files -z --exclude-standard 2> /dev/null)"}) + files=(${(0)"$(_call_program files command git ls-files -z --exclude-standard 2> /dev/null)"}) _wanted file expl 'file' _multi_parts - / files && ret=0 ;; esac diff --git a/modules/git/functions/_git-info b/modules/git/functions/_git-info index 1e21bfeb1a..ef6d97026b 100644 --- a/modules/git/functions/_git-info +++ b/modules/git/functions/_git-info @@ -8,7 +8,7 @@ # Sorin Ionescu # -if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then +if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then return 1 fi diff --git a/modules/git/functions/_git-submodule-move b/modules/git/functions/_git-submodule-move index 44eddb5402..5f2122c4d1 100644 --- a/modules/git/functions/_git-submodule-move +++ b/modules/git/functions/_git-submodule-move @@ -8,7 +8,7 @@ # Sorin Ionescu # -if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then +if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then return 1 fi @@ -25,7 +25,7 @@ case "$state" in while IFS=$'\n' read submodule; do submodules+=("$submodule") done < <( - git config --file "$(git-root)/.gitmodules" --list \ + command git config --file "$(git-root)/.gitmodules" --list \ | grep '.path=' \ | cut -d= -f2- ) diff --git a/modules/git/functions/_git-submodule-remove b/modules/git/functions/_git-submodule-remove index 87bd7cb006..819dfd8e36 100644 --- a/modules/git/functions/_git-submodule-remove +++ b/modules/git/functions/_git-submodule-remove @@ -8,7 +8,7 @@ # Sorin Ionescu # -if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then +if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then return 1 fi @@ -18,7 +18,7 @@ local submodule while IFS=$'\n' read submodule; do submodules+=("$submodule") done < <( - git config --file "$(git-root)/.gitmodules" --list \ + command git config --file "$(git-root)/.gitmodules" --list \ | grep '.path=' \ | cut -d= -f2- ) diff --git a/modules/git/functions/git-branch-current b/modules/git/functions/git-branch-current index cadb6f63df..3cf2e191d1 100644 --- a/modules/git/functions/git-branch-current +++ b/modules/git/functions/git-branch-current @@ -7,12 +7,12 @@ # function git-branch-current { -if ! git rev-parse 2> /dev/null; then +if ! command git rev-parse 2> /dev/null; then print "$0: not a repository: $PWD" >&2 return 1 fi -local ref="$(git symbolic-ref HEAD 2> /dev/null)" +local ref="$(command git symbolic-ref HEAD 2> /dev/null)" if [[ -n "$ref" ]]; then print "${ref#refs/heads/}" diff --git a/modules/git/functions/git-commit-lost b/modules/git/functions/git-commit-lost index 62789ac916..1f086d3b95 100644 --- a/modules/git/functions/git-commit-lost +++ b/modules/git/functions/git-commit-lost @@ -7,15 +7,15 @@ # function git-commit-lost { -if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then +if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then print "$0: not a repository work tree: $PWD" >&2 return 1 fi -git fsck 2> /dev/null \ +command git fsck 2> /dev/null \ | grep "^dangling commit" \ | awk '{print $3}' \ - | git log \ + | command git log \ --date-order \ --no-walk \ --stdin \ diff --git a/modules/git/functions/git-dir b/modules/git/functions/git-dir index fdb515c5d4..aacaaa8866 100644 --- a/modules/git/functions/git-dir +++ b/modules/git/functions/git-dir @@ -7,7 +7,7 @@ # function git-dir { -local git_dir="${$(git rev-parse --git-dir):A}" +local git_dir="${$(command git rev-parse --git-dir):A}" if [[ -n "$git_dir" ]]; then print "$git_dir" diff --git a/modules/git/functions/git-hub-browse b/modules/git/functions/git-hub-browse index a365a5a9ae..cb3fc60de8 100644 --- a/modules/git/functions/git-hub-browse +++ b/modules/git/functions/git-hub-browse @@ -7,7 +7,7 @@ # function git-hub-browse { -if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then +if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then print "$0: not a repository work tree: $PWD" >&2 return 1 fi @@ -15,7 +15,7 @@ fi local remotes remote references reference file url remote="${1:-origin}" -remotes=($(git config --get-regexp 'remote.*.url' | cut -d. -f2)) +remotes=($(command git config --get-regexp 'remote.*.url' | cut -d. -f2)) if (( $remotes[(i)$remote] == $#remotes + 1 )); then print "$0: remote not found: $remote" >&2 @@ -23,14 +23,14 @@ if (( $remotes[(i)$remote] == $#remotes + 1 )); then fi url=$( - git config --get "remote.${remote}.url" \ + command git config --get "remote.${remote}.url" \ | sed -En "s/(git|https?)(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\4\/\5/p" ) reference="${${2:-$(git-branch-current)}:-HEAD}" references=( HEAD - ${$(git ls-remote --heads --tags "$remote" | awk '{print $2}')##refs/(heads|tags)/} + ${$(command git ls-remote --heads --tags "$remote" | awk '{print $2}')##refs/(heads|tags)/} ) if (( $references[(i)$reference] == $#references + 1 )); then @@ -39,7 +39,7 @@ if (( $references[(i)$reference] == $#references + 1 )); then fi if [[ "$reference" == 'HEAD' ]]; then - reference="$(git rev-parse HEAD 2> /dev/null)" + reference="$(command git rev-parse HEAD 2> /dev/null)" fi file="$3" diff --git a/modules/git/functions/git-info b/modules/git/functions/git-info index d27365c243..a173c20f14 100644 --- a/modules/git/functions/git-info +++ b/modules/git/functions/git-info @@ -178,15 +178,15 @@ function git-info { typeset -gA git_info # Return if not inside a Git repository work tree. - if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then + if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then return 1 fi if (( $# > 0 )); then if [[ "$1" == [Oo][Nn] ]]; then - git config --bool prompt.showinfo true + command git config --bool prompt.showinfo true elif [[ "$1" == [Oo][Ff][Ff] ]]; then - git config --bool prompt.showinfo false + command git config --bool prompt.showinfo false else print "usage: $0 [ on | off ]" >&2 fi @@ -194,7 +194,7 @@ function git-info { fi # Return if git-info is disabled. - if ! is-true "${$(git config --bool prompt.showinfo):-true}"; then + if ! is-true "${$(command git config --bool prompt.showinfo):-true}"; then return 1 fi @@ -204,7 +204,7 @@ function git-info { # Format commit. zstyle -s ':prezto:module:git:info:commit' format 'commit_format' if [[ -n "$commit_format" ]]; then - commit="$(git rev-parse HEAD 2> /dev/null)" + commit="$(command git rev-parse HEAD 2> /dev/null)" if [[ -n "$commit" ]]; then zformat -f commit_formatted "$commit_format" "c:$commit" fi @@ -213,7 +213,7 @@ function git-info { # Format stashed. zstyle -s ':prezto:module:git:info:stashed' format 'stashed_format' if [[ -n "$stashed_format" && -f "$(git-dir)/refs/stash" ]]; then - stashed="$(git stash list 2> /dev/null | wc -l | awk '{print $1}')" + stashed="$(command git stash list 2> /dev/null | wc -l | awk '{print $1}')" if [[ -n "$stashed" ]]; then zformat -f stashed_formatted "$stashed_format" "S:$stashed" fi @@ -229,7 +229,7 @@ function git-info { fi # Get the branch. - branch="${$(git symbolic-ref HEAD 2> /dev/null)#refs/heads/}" + branch="${$(command git symbolic-ref HEAD 2> /dev/null)#refs/heads/}" # Format branch. zstyle -s ':prezto:module:git:info:branch' format 'branch_format' @@ -240,7 +240,7 @@ function git-info { # Format position. zstyle -s ':prezto:module:git:info:position' format 'position_format' if [[ -z "$branch" && -n "$position_format" ]]; then - position="$(git describe --contains --all HEAD 2> /dev/null)" + position="$(command git describe --contains --all HEAD 2> /dev/null)" if [[ -n "$position" ]]; then zformat -f position_formatted "$position_format" "p:$position" fi @@ -250,7 +250,7 @@ function git-info { zstyle -s ':prezto:module:git:info:remote' format 'remote_format' if [[ -n "$branch" && -n "$remote_format" ]]; then # Gets the remote name. - remote_cmd='git rev-parse --symbolic-full-name --verify HEAD@{upstream}' + remote_cmd='command git rev-parse --symbolic-full-name --verify HEAD@{upstream}' remote="${$(${(z)remote_cmd} 2> /dev/null)##refs/remotes/}" if [[ -n "$remote" ]]; then zformat -f remote_formatted "$remote_format" "R:$remote" @@ -261,7 +261,7 @@ function git-info { zstyle -s ':prezto:module:git:info:behind' format 'behind_format' if [[ -n "$branch" && ( -n "$ahead_format" || -n "$behind_format" ) ]]; then # Gets the commit difference counts between local and remote. - ahead_and_behind_cmd='git rev-list --count --left-right HEAD...@{upstream}' + ahead_and_behind_cmd='command git rev-list --count --left-right HEAD...@{upstream}' # Get ahead and behind counts. ahead_and_behind="$(${(z)ahead_and_behind_cmd} 2> /dev/null)" @@ -290,7 +290,7 @@ function git-info { if [[ -n "$indexed_format" ]]; then (( indexed+=$( - git diff-index \ + command git diff-index \ --no-ext-diff \ --name-only \ --cached \ @@ -310,7 +310,7 @@ function git-info { if [[ -n "$unindexed_format" ]]; then (( unindexed+=$( - git diff-files \ + command git diff-files \ --no-ext-diff \ --name-only \ --ignore-submodules=${ignore_submodules:-none} \ @@ -328,7 +328,7 @@ function git-info { if [[ -n "$untracked_format" ]]; then (( untracked+=$( - git ls-files \ + command git ls-files \ --other \ --exclude-standard \ 2> /dev/null \ @@ -343,7 +343,7 @@ function git-info { (( dirty = indexed + unindexed + untracked )) else # Use porcelain status for easy parsing. - status_cmd="git status --porcelain --ignore-submodules=${ignore_submodules:-none}" + status_cmd="command git status --porcelain --ignore-submodules=${ignore_submodules:-none}" # Get current status. while IFS=$'\n' read line; do diff --git a/modules/git/functions/git-root b/modules/git/functions/git-root index f749457205..643f346b36 100644 --- a/modules/git/functions/git-root +++ b/modules/git/functions/git-root @@ -7,7 +7,7 @@ # function git-root { -local root="$(git rev-parse --show-toplevel 2> /dev/null)" +local root="$(command git rev-parse --show-toplevel 2> /dev/null)" if [[ -n "$root" ]]; then print "$root" diff --git a/modules/git/functions/git-stash-clear-interactive b/modules/git/functions/git-stash-clear-interactive index 71468aa0e0..cc665a1829 100644 --- a/modules/git/functions/git-stash-clear-interactive +++ b/modules/git/functions/git-stash-clear-interactive @@ -7,7 +7,7 @@ # function git-stash-clear-interactive { -if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then +if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then print "$0: not a repository work tree: $PWD" >&2 return 1 fi @@ -15,10 +15,10 @@ fi local stashed if [[ -f "$(git-dir)/refs/stash" ]]; then - stashed="$(git stash list 2> /dev/null | wc -l | awk '{print $1}')" + stashed="$(command git stash list 2> /dev/null | wc -l | awk '{print $1}')" if (( $stashed > 0 )); then if read -q "?Clear $stashed stashed state(s) [y/N]? "; then - git stash clear + command git stash clear fi fi fi diff --git a/modules/git/functions/git-stash-dropped b/modules/git/functions/git-stash-dropped index 2a0b7a94e7..d9e759e872 100644 --- a/modules/git/functions/git-stash-dropped +++ b/modules/git/functions/git-stash-dropped @@ -7,15 +7,15 @@ # function git-stash-dropped { -if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then +if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then print "$0: not a repository work tree: $PWD" >&2 return 1 fi -git fsck --unreachable 2> /dev/null \ +command git fsck --unreachable 2> /dev/null \ | grep 'commit' \ | awk '{print $3}' \ - | git log \ + | command git log \ --pretty=format:${_git_log_oneline_format} \ --extended-regexp \ --grep="${1:-(WIP )?[Oo]n [^:]+:}" \ diff --git a/modules/git/functions/git-stash-recover b/modules/git/functions/git-stash-recover index 5cc949a730..6cb5416e6c 100644 --- a/modules/git/functions/git-stash-recover +++ b/modules/git/functions/git-stash-recover @@ -7,7 +7,7 @@ # function git-stash-recover { -if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then +if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then print "$0: not a repository work tree: $PWD" >&2 return 1 fi @@ -15,8 +15,8 @@ fi local commit for commit in "$@"; do - git update-ref \ - -m "$(git log -1 --pretty="format:%s" "$commit")" refs/stash "$commit" + command git update-ref \ + -m "$(command git log -1 --pretty="format:%s" "$commit")" refs/stash "$commit" done # } diff --git a/modules/git/functions/git-submodule-move b/modules/git/functions/git-submodule-move index ec6048e68e..746f46e512 100644 --- a/modules/git/functions/git-submodule-move +++ b/modules/git/functions/git-submodule-move @@ -7,7 +7,7 @@ # function git-submodule-move { -if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then +if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then print "$0: not a repository work tree: $PWD" >&2 return 1 elif [[ "$PWD" != "$(git-root)" ]]; then @@ -19,7 +19,7 @@ local src="$1" local dst="$2" local url -url="$(git config --file "$(git-root)/.gitmodules" --get "submodule.${src}.url")" +url="$(command git config --file "$(git-root)/.gitmodules" --get "submodule.${src}.url")" if [[ -z "$url" ]]; then print "$0: submodule not found: $src" >&2 @@ -29,7 +29,7 @@ fi mkdir -p "${dst:h}" git-submodule-remove "$src" -git submodule add "$url" "$dst" +command git submodule add "$url" "$dst" return 0 diff --git a/modules/git/functions/git-submodule-remove b/modules/git/functions/git-submodule-remove index 2490e78c87..c8c11aa8c3 100644 --- a/modules/git/functions/git-submodule-remove +++ b/modules/git/functions/git-submodule-remove @@ -7,22 +7,22 @@ # function git-submodule-remove { -if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then +if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then print "$0: not a repository work tree: $PWD" >&2 return 1 elif [[ "$PWD" != "$(git-root)" ]]; then print "$0: must be run from the root of the work tree" >&2 return 1 -elif ! git config --file .gitmodules --get "submodule.${1}.path" &>/dev/null; then +elif ! command git config --file .gitmodules --get "submodule.${1}.path" &> /dev/null; then print "$0: submodule not found: $1" >&2 return 1 fi -git config --file "$(git-dir)/config" --remove-section "submodule.${1}" &>/dev/null -git config --file "$(git-root)/.gitmodules" --remove-section "submodule.${1}" &>/dev/null -git add .gitmodules +command git config --file "$(git-dir)/config" --remove-section "submodule.${1}" &> /dev/null +command git config --file "$(git-root)/.gitmodules" --remove-section "submodule.${1}" &> /dev/null +command git add .gitmodules -git rm --cached -rf "${1}" +command git rm --cached -rf "${1}" rm -rf "${1}" rm -rf "$(git-dir)/modules/${1}" diff --git a/modules/utility/functions/wdiff b/modules/utility/functions/wdiff index c93ead1c6d..ebfad0b82f 100644 --- a/modules/utility/functions/wdiff +++ b/modules/utility/functions/wdiff @@ -17,7 +17,7 @@ function wdiff { "$@" \ | sed 's/^\(@@\( [+-][[:digit:]]*,[[:digit:]]*\)\{2\} @@\)$/;5;6m\10m/g' elif (( $+commands[git] )); then - git --no-pager diff --color=auto --no-ext-diff --no-index --color-words "$@" + command git --no-pager diff --color=auto --no-ext-diff --no-index --color-words "$@" else command wdiff "$@" fi From a0977cb92e0e4a8483bd256a472119451cf3e933 Mon Sep 17 00:00:00 2001 From: Roman Peshkov Date: Sat, 31 Mar 2018 02:37:05 +0200 Subject: [PATCH 2/6] Ignore tmux autostart in vscode terminal --- modules/tmux/init.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 443021237a38e04522bb76f77c3f146d64edba29 Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Fri, 30 Mar 2018 17:47:05 -0700 Subject: [PATCH 3/6] Allow users to easily define LS_COLORS and LSCOLORS (#1546) --- modules/utility/init.zsh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/modules/utility/init.zsh b/modules/utility/init.zsh index c6c87d2ae6..7f75fb83af 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 From 1b441e7654b6b1c8e766d68d548abd7e5597604e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20VANTOMME?= Date: Thu, 5 Apr 2018 00:20:21 +0200 Subject: [PATCH 4/6] Feat (git): add an alias displaying the commits yet to be applied to upstream (#1565) --- modules/git/README.md | 2 ++ modules/git/alias.zsh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/modules/git/README.md b/modules/git/README.md index 1eba33cb78..1d4b7ba562 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 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' From 054eb351f1d7d92d810259e3a5fbfd9e025b2d08 Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Fri, 6 Apr 2018 11:33:02 -0700 Subject: [PATCH 5/6] Revert "Only call reset-prompt when the appropriate zstyle is set" This reverts commit 6d00fdf8c8e4003a89d622590265d80356a7a95f. As unfortunate as it is, this workaround was a hack and doesn't take into account prompts like spaceship which don't use $editor_info but rely on $KEYMAP directly. We'll need to find a more consistent solution to fix this. --- modules/editor/README.md | 2 -- modules/editor/init.zsh | 15 +++++++-------- modules/prompt/functions/prompt_smiley_setup | 2 +- runcoms/zpreztorc | 3 +++ 4 files changed, 11 insertions(+), 11 deletions(-) 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/prompt/functions/prompt_smiley_setup b/modules/prompt/functions/prompt_smiley_setup index 3d41b3af46..3066a2dc2b 100644 --- a/modules/prompt/functions/prompt_smiley_setup +++ b/modules/prompt/functions/prompt_smiley_setup @@ -36,7 +36,7 @@ function prompt_smiley_precmd { function prompt_smiley_setup { unsetopt XTRACE KSH_ARRAYS - prompt_opts=(cr percent sp subst) + prompt_opts=(percent subst) # Add hook for calling git-info before each command. add-zsh-hook precmd prompt_smiley_precmd diff --git a/runcoms/zpreztorc b/runcoms/zpreztorc index d2a1572936..c109155565 100644 --- a/runcoms/zpreztorc +++ b/runcoms/zpreztorc @@ -62,6 +62,9 @@ zstyle ':prezto:module:editor' key-bindings 'emacs' # Auto convert .... to ../.. # zstyle ':prezto:module:editor' dot-expansion 'yes' +# Allow the zsh prompt context to be shown. +#zstyle ':prezto:module:editor' ps-context 'yes' + # # Git # From 300102897a4710e1559e4435c686f794d126d3c3 Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Fri, 6 Apr 2018 11:35:39 -0700 Subject: [PATCH 6/6] Add proper prompt_opts to smiley prompt --- modules/prompt/functions/prompt_smiley_setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/prompt/functions/prompt_smiley_setup b/modules/prompt/functions/prompt_smiley_setup index 3066a2dc2b..3d41b3af46 100644 --- a/modules/prompt/functions/prompt_smiley_setup +++ b/modules/prompt/functions/prompt_smiley_setup @@ -36,7 +36,7 @@ function prompt_smiley_precmd { function prompt_smiley_setup { unsetopt XTRACE KSH_ARRAYS - prompt_opts=(percent subst) + prompt_opts=(cr percent sp subst) # Add hook for calling git-info before each command. add-zsh-hook precmd prompt_smiley_precmd