From d7d85f517a47220cc80f28775b189ec87b0573b8 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 25 Sep 2012 00:42:03 -0400 Subject: [PATCH 01/56] [Fix #289] Describe all modules in a README --- modules/README.md | 170 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 modules/README.md diff --git a/modules/README.md b/modules/README.md new file mode 100644 index 0000000000..9e048d2ffa --- /dev/null +++ b/modules/README.md @@ -0,0 +1,170 @@ +Modules +======= + +Load modules in *zpreztorc*. The order matters. + + zstyle ':prezto:load' pmodule 'environment' 'terminal' + +Archive +------- + +Provides functions to extract and list popular archive formats. + +Command-Not-Found +----------------- + +Loads the command-not-found tool on Debian-based distributions. + +Completion +---------- + +Loads and configures tab completion and provides additional completions from +the zsh-completions project. + +Directory +--------- + +Sets directory options and defines directory aliases. + +Dpkg +---- + +Defines dpkg aliases and functions. + +Environment +----------- + +Sets general shell options and defines environment variables. + +GNU Utility +----------- + +Provides for the interactive use of GNU utilities on non-GNU systems. + +GPG-Agent +--------- + +Provides for an easier use of gpg-agent. + +Haskell +------- + +Enables local Haskell package installation. + +Helper +------ + +Provides helper functions for developing modules. + +History Substring Search +------------------------ + +Integrates zsh-history-substring-search into Prezto. + +History +------- + +Sets history options and defines history aliases. + +Macports +-------- + +Defines MacPorts aliases and adds MacPorts directories to path variables. + +Node.js +------- + +Provides utility functions for Node.js and loads npm completion. + +OSX +--- + +Defines Mac OS X aliases and functions. + +Pacman +------ + +Provides aliases and functions for the Pacman package manager and frontends. + +Perl +---- + +Enables local Perl module installation on Mac OS X and defines alises. + +Prompt +------ + +Loads prompt themes. + +Python +------ + +Enables local Python and local Python package installation. + +Ruby on Rails +------------- + +Defines Ruby on Rails aliases. + +Rsync +----- + +Defines rsync aliases. + +Ruby +---- + +Configures Ruby local gem installation, loads version managers, and defines +aliases. + +GNU Screen +---------- + +Defines GNU Screen aliases and provides for auto launching it at start-up. + +Spectrum +-------- + +Provides for easier use of 256 colors and effects. + +SSH-Agent +--------- + +Provides for an easier use of ssh-agent. + +Syntax Highlighting +------------------- + +Integrates zsh-syntax-highlighting into Prezto. + +Terminal +-------- + +Sets terminal window and tab titles. + +Tmux +---- + +Defines tmux aliases and provides for auto launching it at start-up. + +Utility +------- + +Defines general aliases and functions. + +Wake-on-LAN +----------- + +This module provides a wrapper around the wakeonlan tool. + +Yum +--- + +Defines yum aliases. + +Z +- + +Integrates z into Prezto, which maintains a frequently used directory list for +fast directory changes. + From 52a8c983376cbbc7b76a7f6097081e6b36feaeca Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 25 Sep 2012 00:54:49 -0400 Subject: [PATCH 02/56] [Fix #290] Add fish shell style PWD to sorin theme --- modules/prompt/functions/prompt_sorin_setup | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/prompt/functions/prompt_sorin_setup b/modules/prompt/functions/prompt_sorin_setup index dedd704f5b..28979fa7ca 100644 --- a/modules/prompt/functions/prompt_sorin_setup +++ b/modules/prompt/functions/prompt_sorin_setup @@ -11,10 +11,24 @@ # Load dependencies. pmodload 'helper' +function prompt_sorin_pwd { + local pwd="${PWD/#$HOME/~}" + + if [[ "$pwd" == (#m)[/~] ]]; then + _prompt_sorin_pwd="$MATCH" + else + _prompt_sorin_pwd="${${(@j:/:M)${(@s:/:)pwd}##.#?}:h}/${pwd:t}" + fi +} + function prompt_sorin_precmd { setopt LOCAL_OPTIONS unsetopt XTRACE KSH_ARRAYS + # Format PWD. + prompt_sorin_pwd + + # Get Git repository information. if (( $+functions[git-info] )); then git-info fi @@ -49,11 +63,11 @@ function prompt_sorin_setup { zstyle ':prezto:module:git' unmerged ' %%B%F{yellow}═%f%%b' zstyle ':prezto:module:git' untracked ' %%B%F{white}◼%f%%b' zstyle ':prezto:module:git' info \ - 'prompt' ' %F{blue}git%f$(coalesce "%b" "%p" "%c")%s' \ + 'prompt' ' %F{blue}git%f$(coalesce "%b" "%p" "%c")%s' \ 'rprompt' '%A%B%S%a%d%m%r%U%u' # Define prompts. - PROMPT='%F{cyan}%1~%f${git_info:+${(e)git_info[prompt]}}%(!. %B%F{red}#%f%b.)${editor_info[keymap]} ' + PROMPT='%F{cyan}${_prompt_sorin_pwd}%f${git_info:+${(e)git_info[prompt]}}%(!. %B%F{red}#%f%b.)${editor_info[keymap]} ' RPROMPT='${editor_info[overwrite]}%(?:: %F{red}⏎%f)${VIM:+" %B%F{green}V%f%b"}${git_info[rprompt]}' SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' } From 4cc8167739a08776091fe34c81f41c587283bf1f Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 25 Sep 2012 01:30:20 -0400 Subject: [PATCH 03/56] Refactor terminal --- modules/terminal/README.md | 10 ++++++ modules/terminal/init.zsh | 73 ++++++++++++++++++++++---------------- 2 files changed, 53 insertions(+), 30 deletions(-) diff --git a/modules/terminal/README.md b/modules/terminal/README.md index d42645bac6..f1256c69e2 100644 --- a/modules/terminal/README.md +++ b/modules/terminal/README.md @@ -13,6 +13,16 @@ directory, add the following to *zpreztorc*: zstyle ':prezto:module:terminal' auto-title 'yes' +Functions +--------- + +- `set-screen-window-title` sets the screen title. +- `set-terminal-tab-title` sets the terminal tab title. +- `set-terminal-window-title` sets the terminal window title. +- `set-titles-with-command` sets the screen and terminal titles with + a given command. +- `set-titles-with-path` sets the screen and terminal titles with a given path. + Authors ------- diff --git a/modules/terminal/init.zsh b/modules/terminal/init.zsh index 5c03b28ead..ebb014bfd4 100644 --- a/modules/terminal/init.zsh +++ b/modules/terminal/init.zsh @@ -19,28 +19,34 @@ else fi # Sets the GNU Screen title. -function set-screen-title { +function set-screen-window-title { if [[ "$TERM" == screen* ]]; then printf "\ek%s\e\\" ${(V)argv} fi } # Sets the terminal window title. -function set-window-title { +function set-terminal-window-title { if [[ "$TERM" == ((x|a|ml|dt|E)term*|(u|)rxvt*) ]]; then printf "\e]2;%s\a" ${(V)argv} fi } # Sets the terminal tab title. -function set-tab-title { +function set-terminal-tab-title { if [[ "$TERM" == ((x|a|ml|dt|E)term*|(u|)rxvt*) ]]; then printf "\e]1;%s\a" ${(V)argv} fi } -# Sets the tab and window titles with the command name. -function set-title-by-command { +# Sets the tab and window titles with a given command. +function set-titles-with-command { + # Do not set the window and tab titles in Terminal.app because they are not + # reset upon command termination. + if [[ "$TERM_PROGRAM" == 'Apple_Terminal' ]]; then + return 1 + fi + emulate -L zsh setopt LOCAL_OPTIONS EXTENDED_GLOB @@ -56,20 +62,38 @@ function set-title-by-command { jobs $job_name 2>/dev/null > >( read index discarded # The index is already surrounded by brackets: [1]. - set-title-by-command "${(e):-\$jobtexts_from_parent_shell$index}" + set-titles-with-command "${(e):-\$jobtexts_from_parent_shell$index}" ) else # Set the command name, or in the case of sudo or ssh, the next command. - local cmd=${1[(wr)^(*=*|sudo|ssh|-*)]} + local cmd=${${1[(wr)^(*=*|sudo|ssh|-*)]}:t} + local truncated_cmd="${cmd/(#m)?(#c15,)/${MATCH[1,12]}...}" - # Right-truncate the command name to 15 characters. - if (( $#cmd > 15 )); then - cmd="${cmd[1,15]}..." + if [[ "$TERM" == screen* ]]; then + set-screen-window-title "$truncated_cmd" + else + set-terminal-window-title "$cmd" + set-terminal-tab-title "$truncated_cmd" fi + fi +} + +# Sets the tab and window titles with a given path. +function set-titles-with-path { + local absolute_path="${${1:a}:-$PWD}" - for kind in window tab screen; do - set-${kind}-title "$cmd" - done + if [[ "$TERM_PROGRAM" == 'Apple_Terminal' ]]; then + printf '\e]7;%s\a' "file://$HOST${absolute_path// /%20}" + else + local abbreviated_path="${absolute_path/#$HOME/~}" + local truncated_path="${abbreviated_path/(#m)?(#c15,)/...${MATCH[-12,-1]}}" + + if [[ "$TERM" == screen* ]]; then + set-screen-window-title "$truncated_path" + else + set-terminal-window-title "$abbreviated_path" + set-terminal-tab-title "$truncated_path" + fi fi } @@ -77,29 +101,18 @@ function set-title-by-command { autoload -Uz add-zsh-hook # Sets the tab and window titles before the prompt is displayed. -function set-title-precmd { +function set-titles-precmd { if zstyle -t ':prezto:module:terminal' auto-title; then - if [[ "$TERM_PROGRAM" == 'Apple_Terminal' && "$TERM" != screen* ]]; then - # Set the current working directory in Apple Terminal. - printf '\e]7;%s\a' "file://$HOST${PWD// /%20}" - else - set-window-title "${(%):-%~}" - for kind in tab screen; do - # Left-truncate the current working directory to 15 characters. - set-${kind}-title "${(%):-%15<...<%~%<<}" - done - fi + set-titles-with-path fi } -add-zsh-hook precmd set-title-precmd +add-zsh-hook precmd set-titles-precmd # Sets the tab and window titles before command execution. -function set-title-preexec { +function set-titles-preexec { if zstyle -t ':prezto:module:terminal' auto-title; then - if [[ "$TERM_PROGRAM" != 'Apple_Terminal' || "$TERM" == screen* ]]; then - set-title-by-command "$2" - fi + set-titles-with-command "$2" fi } -add-zsh-hook preexec set-title-preexec +add-zsh-hook preexec set-titles-preexec From 224dc2eafff0db2717e03855005ccc42f11a4029 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 24 Sep 2012 01:46:24 -0400 Subject: [PATCH 04/56] Use Git porcelain commands in git-hub --- modules/git/functions/_git-hub | 13 +++++-------- modules/git/functions/git-hub | 8 ++++---- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/modules/git/functions/_git-hub b/modules/git/functions/_git-hub index ac17fd27a2..abefd03f51 100644 --- a/modules/git/functions/_git-hub +++ b/modules/git/functions/_git-hub @@ -18,19 +18,16 @@ _arguments -C -s -S \ case "$state" in (remote) remotes=($( - git config -l \ - | grep 'remote\.[^.]*\.url' \ - | cut -d'.' -f2)) + git config --local --get-regexp 'remote.*.url' \ + | awk 'BEGIN {FS="."} ; {print $2}' + )) _describe -t branch 'remotes' remotes && ret=0 ;; (branch) remote="$words[(($CURRENT - 1))]" branches=($( - git branch -r \ - | grep "${remote}/" \ - | sed \ - -e "/${remote}\/HEAD -> ${remote}/d" \ - -e "s/^[[:space:]]*${remote}\///g" + git ls-remote --heads "$remote" \ + | awk '{gsub(/refs\/heads\//, "", $2)} ; {print $2}' )) _describe -t branch 'branches' branches && ret=0 ;; diff --git a/modules/git/functions/git-hub b/modules/git/functions/git-hub index 8d2e494769..95a7d52556 100644 --- a/modules/git/functions/git-hub +++ b/modules/git/functions/git-hub @@ -9,12 +9,12 @@ local remote branches branch current_branch file url remote="${1:-origin}" url=$( - git config -l \ - | grep "remote.${remote}.url" \ - | sed -En "s/remote.${remote}.url=(git|https?)(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\4\/\5/p" + git config --local --get "remote.${remote}.url" \ + | sed -En "s/(git|https?)(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\4\/\5/p" ) branches=($( - git branch -r | sed -e "/${remote}\/HEAD -> ${remote}/d" -e "s/^[[:space:]]*${remote}\///g" + git ls-remote --heads "$remote" \ + | awk '{gsub(/refs\/heads\//, "", $2)} ; {print $2}' )) current_branch="$(git-branch-current)" branch="${2:-master}" From e43f2b265972429339b02220ae573b4c9d9297c7 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 24 Sep 2012 17:57:48 -0400 Subject: [PATCH 05/56] Add support for browsing GitHub tags --- modules/git/functions/_git-hub | 17 ++++++++----- modules/git/functions/git-hub | 44 +++++++++++++++++++++------------- 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/modules/git/functions/_git-hub b/modules/git/functions/_git-hub index abefd03f51..a4d9473d21 100644 --- a/modules/git/functions/_git-hub +++ b/modules/git/functions/_git-hub @@ -8,11 +8,11 @@ # Sorin Ionescu # -local state remotes remote branches files ret=1 +local state remotes remote branches_or_tags branches tags files ret=1 _arguments -C -s -S \ '1::args:->remote' \ - '2::args:->branch' \ + '2::args:->branch-or-tag' \ '3::args:->file' && ret=0 case "$state" in @@ -23,13 +23,18 @@ case "$state" in )) _describe -t branch 'remotes' remotes && ret=0 ;; - (branch) + (branch-or-tag) remote="$words[(($CURRENT - 1))]" - branches=($( - git ls-remote --heads "$remote" \ - | awk '{gsub(/refs\/heads\//, "", $2)} ; {print $2}' + + branches_or_tags=($( + git ls-remote --heads --tags "$remote" | awk '{print $2}' )) + + branches=(HEAD ${${(M)branches_or_tags[@]##refs/heads/?##}##refs/heads/}) + tags=(${${(M)branches_or_tags[@]##refs/tags/?##}##refs/tags/}) + _describe -t branch 'branches' branches && ret=0 + _describe -t tag 'tags' tags && ret=0 ;; (file) files=(${(0)"$(_call_program files git ls-files -z --exclude-standard 2>/dev/null)"}) diff --git a/modules/git/functions/git-hub b/modules/git/functions/git-hub index 95a7d52556..bc2a070163 100644 --- a/modules/git/functions/git-hub +++ b/modules/git/functions/git-hub @@ -5,31 +5,43 @@ # Sorin Ionescu # -local remote branches branch current_branch file url +local remotes remote references reference file url remote="${1:-origin}" +remotes=($( + git config --local --get-regexp 'remote.*.url' \ + | awk 'BEGIN {FS="."} ; {print $2}' +)) + +if (( $remotes[(i)$remote] == $#remotes + 1 )); then + print "$0: remote not found: $remote" >&2 + return 1 +fi + url=$( git config --local --get "remote.${remote}.url" \ | sed -En "s/(git|https?)(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\4\/\5/p" ) -branches=($( - git ls-remote --heads "$remote" \ - | awk '{gsub(/refs\/heads\//, "", $2)} ; {print $2}' -)) -current_branch="$(git-branch-current)" -branch="${2:-master}" -file="$3" -if [[ -z "$2" ]]; then - if (( $branches[(I)$current_branch] != 0 )); then - branch="$current_branch" - else - branch='master' - fi +reference="${${2:-$(git-branch-current)}:-HEAD}" +references=( + HEAD + ${$(git ls-remote --heads --tags "$remote" | awk '{print $2}')##refs/(heads|tags)/} +) + +if (( $references[(i)$reference] == $#references + 1 )); then + print "$0: branch or tag not found: $reference" >&2 + return 1 fi +if [[ "$reference" == 'HEAD' ]]; then + reference="$(git rev-parse HEAD 2>/dev/null)" +fi + +file="$3" + if [[ -n "$url" ]]; then - url="${url}/tree/${branch}/${file}" + url="${url}/tree/${reference}/${file}" if (( $+commands[$BROWSER] )); then "$BROWSER" "$url" @@ -39,7 +51,7 @@ if [[ -n "$url" ]]; then return 1 fi else - print "$0: not a Git repository or remote origin not set" >&2 + print "$0: not a Git repository or remote not set" >&2 return 1 fi From 7dd78595ae75e2d81910197b3b59f2b43b95dfc2 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 24 Sep 2012 18:10:01 -0400 Subject: [PATCH 06/56] Rename git-hub to git-hub-browse --- modules/git/alias.zsh | 2 +- modules/git/functions/{_git-hub => _git-hub-browse} | 2 +- modules/git/functions/{git-hub => git-hub-browse} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename modules/git/functions/{_git-hub => _git-hub-browse} (97%) rename modules/git/functions/{git-hub => git-hub-browse} (100%) diff --git a/modules/git/alias.zsh b/modules/git/alias.zsh index 9608c5a765..d594555341 100644 --- a/modules/git/alias.zsh +++ b/modules/git/alias.zsh @@ -115,7 +115,7 @@ alias gRm='git remote rename' alias gRu='git remote update' alias gRc='git remote prune' alias gRs='git remote show' -alias gRb='git-hub' +alias gRb='git-hub-browse' # Stash (s) alias gs='git stash' diff --git a/modules/git/functions/_git-hub b/modules/git/functions/_git-hub-browse similarity index 97% rename from modules/git/functions/_git-hub rename to modules/git/functions/_git-hub-browse index a4d9473d21..ab743d9401 100644 --- a/modules/git/functions/_git-hub +++ b/modules/git/functions/_git-hub-browse @@ -2,7 +2,7 @@ #autoload # -# Completes git-hub. +# Completes git-hub-browse # # Authors: # Sorin Ionescu diff --git a/modules/git/functions/git-hub b/modules/git/functions/git-hub-browse similarity index 100% rename from modules/git/functions/git-hub rename to modules/git/functions/git-hub-browse From 978545493809f4cf99c482e2e978290a4cc69825 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 24 Sep 2012 18:19:41 -0400 Subject: [PATCH 07/56] Rename git-hub-short-url to git-hub-shorten-url --- .../functions/{_git-hub-short-url => _git-hub-shorten-url} | 4 ++-- .../git/functions/{git-hub-short-url => git-hub-shorten-url} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename modules/git/functions/{_git-hub-short-url => _git-hub-shorten-url} (63%) rename modules/git/functions/{git-hub-short-url => git-hub-shorten-url} (100%) diff --git a/modules/git/functions/_git-hub-short-url b/modules/git/functions/_git-hub-shorten-url similarity index 63% rename from modules/git/functions/_git-hub-short-url rename to modules/git/functions/_git-hub-shorten-url index b0f997f04b..32199cee7a 100644 --- a/modules/git/functions/_git-hub-short-url +++ b/modules/git/functions/_git-hub-shorten-url @@ -1,8 +1,8 @@ -#compdef git-hub-short-url +#compdef git-hub-shorten-url #autoload # -# Completes git-hub-short-url. +# Completes git-hub-shorten-url. # # Authors: # Sorin Ionescu diff --git a/modules/git/functions/git-hub-short-url b/modules/git/functions/git-hub-shorten-url similarity index 100% rename from modules/git/functions/git-hub-short-url rename to modules/git/functions/git-hub-shorten-url From deeb115ae21654dc24554f4b1eb85015b90421c8 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 24 Sep 2012 18:45:36 -0400 Subject: [PATCH 08/56] Add Git submodule moving and removing --- modules/git/alias.zsh | 2 ++ modules/git/functions/git-submodule-move | 30 ++++++++++++++++++++++ modules/git/functions/git-submodule-remove | 27 +++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 modules/git/functions/git-submodule-move create mode 100644 modules/git/functions/git-submodule-remove diff --git a/modules/git/alias.zsh b/modules/git/alias.zsh index d594555341..b87baa0e00 100644 --- a/modules/git/alias.zsh +++ b/modules/git/alias.zsh @@ -136,9 +136,11 @@ alias gSa='git submodule add' alias gSf='git submodule foreach' alias gSi='git submodule init' alias gSl='git submodule status' +alias gSm='git-submodule-move' alias gSs='git submodule sync' alias gSu='git submodule update --init --recursive' alias gSU='git submodule foreach git pull origin master' +alias gSx='git-submodule-remove' # Working Copy (w) alias gws='git status --short' diff --git a/modules/git/functions/git-submodule-move b/modules/git/functions/git-submodule-move new file mode 100644 index 0000000000..4c94ed25fa --- /dev/null +++ b/modules/git/functions/git-submodule-move @@ -0,0 +1,30 @@ +# +# Moves a Git submodule. +# +# Authors: +# Sorin Ionescu +# + +local src="$1" +local dst="$2" +local url + +if [[ "$PWD" != "$(git-root)" ]]; then + print "$0: must be run from the root of the working tree" >&2 + return 1 +fi + +url="$(git config --file "$(git-root)/.gitmodules" --get "submodule.${src}.url")" + +if [[ -z "$url" ]]; then + print "$0: submodule not found: $src" >&2 + return 1 +fi + +mkdir -p "${dst:h}" + +git-submodule-remove "$src" +git submodule add "$url" "$dst" + +return 0 + diff --git a/modules/git/functions/git-submodule-remove b/modules/git/functions/git-submodule-remove new file mode 100644 index 0000000000..26fca233f2 --- /dev/null +++ b/modules/git/functions/git-submodule-remove @@ -0,0 +1,27 @@ +# +# Removes a Git submodule. +# +# Authors: +# Sorin Ionescu +# + +if [[ "$PWD" != "$(git-root)" ]]; then + print "$0: must be run from the root of the working tree" >&2 + return 1 +fi + +if ! 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 + +git rm --cached -rf "${1}" +rm -rf "${1}" +rm -rf "$(git-dir)/modules/${1}" + +return 0 + From 003ca8365bbeae5439a58d46eb56b5cb19694616 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 24 Sep 2012 23:49:23 -0400 Subject: [PATCH 09/56] Add an alias for stashing the Git working copy --- modules/git/alias.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/git/alias.zsh b/modules/git/alias.zsh index b87baa0e00..e191a7ffcd 100644 --- a/modules/git/alias.zsh +++ b/modules/git/alias.zsh @@ -129,6 +129,7 @@ alias gsp='git stash pop' alias gsr='git-stash-recover' alias gss='git stash save --include-untracked' alias gsS='git stash save --patch --no-keep-index' +alias gsw='git stash save --include-untracked --keep-index' # Submodule (S) alias gS='git submodule' From 7b453c10730f26d3e026c879caa6309a10c9145b Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 24 Sep 2012 23:49:58 -0400 Subject: [PATCH 10/56] Add git-grep aliases --- modules/git/alias.zsh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/git/alias.zsh b/modules/git/alias.zsh index e191a7ffcd..6a3694f013 100644 --- a/modules/git/alias.zsh +++ b/modules/git/alias.zsh @@ -49,6 +49,14 @@ alias gfc='git clone' alias gfm='git pull' alias gfr='git pull --rebase' +# Grep (g) +alias gg='git grep' +alias ggi='git grep --ignore-case' +alias ggl='git grep --files-with-matches' +alias ggL='git grep --files-without-matches' +alias ggv='git grep --invert-match' +alias ggw='git grep --word-regexp' + # Index (i) alias gia='git add' alias giA='git add --patch' @@ -154,5 +162,4 @@ alias gwc='git clean -n' alias gwC='git clean -f' alias gwx='git rm -r' alias gwX='git rm -rf' -alias gwg='git grep' From eb0856d2f552190d269756ed91526a3a8a35d3bb Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 25 Sep 2012 01:46:41 -0400 Subject: [PATCH 11/56] Add a missing '.' --- modules/git/functions/_git-hub-browse | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/git/functions/_git-hub-browse b/modules/git/functions/_git-hub-browse index ab743d9401..35f3a9bebe 100644 --- a/modules/git/functions/_git-hub-browse +++ b/modules/git/functions/_git-hub-browse @@ -2,7 +2,7 @@ #autoload # -# Completes git-hub-browse +# Completes git-hub-browse. # # Authors: # Sorin Ionescu From d48a162366bb70d25f03ad6f4c50bc40c9fcc294 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 25 Sep 2012 11:04:50 -0400 Subject: [PATCH 12/56] [Fix #299] Set EXTENDED_GLOB in set-titles-with-path --- modules/terminal/init.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/terminal/init.zsh b/modules/terminal/init.zsh index ebb014bfd4..98571c9940 100644 --- a/modules/terminal/init.zsh +++ b/modules/terminal/init.zsh @@ -80,6 +80,9 @@ function set-titles-with-command { # Sets the tab and window titles with a given path. function set-titles-with-path { + emulate -L zsh + setopt EXTENDED_GLOB + local absolute_path="${${1:a}:-$PWD}" if [[ "$TERM_PROGRAM" == 'Apple_Terminal' ]]; then From 6b0b6c2f9aea9568e44d80d331df3c1a58ad3545 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 25 Sep 2012 12:30:19 -0400 Subject: [PATCH 13/56] Do not setopt LOCAL_OPTIONS in set-titles-with-command emulate -L zsh sets LOCAL_OPTIONS and LOCAL_TRAPS --- modules/terminal/init.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/terminal/init.zsh b/modules/terminal/init.zsh index 98571c9940..d5cd3ecec7 100644 --- a/modules/terminal/init.zsh +++ b/modules/terminal/init.zsh @@ -48,7 +48,7 @@ function set-titles-with-command { fi emulate -L zsh - setopt LOCAL_OPTIONS EXTENDED_GLOB + setopt EXTENDED_GLOB # Get the command name that is under job control. if [[ "${1[(w)1]}" == (fg|%*)(\;|) ]]; then From 8ff60ad95657db4483dfc16cefbafd80e41dcd4b Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 25 Sep 2012 12:33:23 -0400 Subject: [PATCH 14/56] [#297] Check for RVM and rbenv before returning --- modules/ruby/init.zsh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/ruby/init.zsh b/modules/ruby/init.zsh index 7b19d7deec..b5ab77d0dd 100644 --- a/modules/ruby/init.zsh +++ b/modules/ruby/init.zsh @@ -5,11 +5,6 @@ # Authors: Sorin Ionescu # -# Return if requirements are not found. -if (( ! $+commands[ruby] )); then - return 1 -fi - # Load RVM into the shell session. if [[ -s "$HOME/.rvm/scripts/rvm" ]]; then # Unset AUTO_NAME_DIRS since auto adding variable-stored paths to ~ list @@ -36,6 +31,11 @@ else fi fi +# Return if requirements are not found. +if (( ! $+commands[ruby] && ! ( $+commands[rvm] || $+commands[rbenv] ) )); then + return 1 +fi + # # Aliases # From 7d68d3ff52b9468f6c0551fa81022d5c300fa1ba Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 25 Sep 2012 12:57:57 -0400 Subject: [PATCH 15/56] [Fix #297] Check for pythonz before returning --- modules/python/init.zsh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/python/init.zsh b/modules/python/init.zsh index 927dc9d952..11875612b7 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -6,8 +6,13 @@ # Sebastian Wiesner # +# Load pythonz into the shell session. +if [[ -s $HOME/.pythonz/bin/pythonz ]]; then + path=($HOME/.pythonz/bin $path) +fi + # Return if requirements are not found. -if (( ! $+commands[python] )); then +if (( ! $+commands[python] && ! $+commands[pythonz] )); then return 1 fi @@ -33,11 +38,6 @@ if (( $+commands[virtualenvwrapper_lazy.sh] )); then source "$commands[virtualenvwrapper_lazy.sh]" fi -# Load pythonz into the shell session. -if [[ -s $HOME/.pythonz/bin/pythonz ]]; then - path=($HOME/.pythonz/bin $path) -fi - # # Aliases # From 2037e693e8aae6767b92599ed827acfda1c9b521 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 25 Sep 2012 13:12:35 -0400 Subject: [PATCH 16/56] [Fix #293] Add CONTRIBUTING.md --- CONTRIBUTING.md | 42 ++++++++++++++++++++++++++++++++++++++++++ README.md | 42 ------------------------------------------ 2 files changed, 42 insertions(+), 42 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..07e21976f9 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,42 @@ +Contributing +------------ + +This project would not exist without all of its users and [contributors][1]. + +If you have ideas on how to make the configuration easier to maintain or +improve its performance, do not hesitate to fork and send pull requests. + +### Issue Reporting + + - Check that the issue has not already been reported. + - Check that the issue has not already been fixed in the latest code. + - Open an issue with a clear title and description in grammatically correct, + complete sentences. + +### Pull Request + + - Read [how to properly contribute to open source projects on GitHub][2]. + - Use a topic branch to easily amend a pull request later, if necessary. + - Write [good commit messages][3]. + - Squash commits on the topic branch before opening a pull request. + - Use the same coding style and spacing. + - Open a [pull request][4] that relates to but one subject with a clear + title and description in grammatically correct, complete sentences. + +#### Modules + + - A *README.md* must be present. + - Large functions must be placed in a *functions* directory. + - Functions that take arguments must have completion. + +#### Themes + + - A screenshots section must be present in the file header. + - The pull request description must have [embedded screenshots][5]. + +[1]: https://github.com/sorin-ionescu/prezto/contributors +[2]: http://gun.io/blog/how-to-github-fork-branch-and-pull-request +[3]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html +[4]: https://help.github.com/articles/using-pull-requests +[5]: http://daringfireball.net/projects/markdown/syntax#img + diff --git a/README.md b/README.md index 5172bd46f4..a38a06e2d2 100644 --- a/README.md +++ b/README.md @@ -91,43 +91,6 @@ Resources The [Zsh Reference Card][7] and the [zsh-lovers][8] man page are indispensable. -Contribute ----------- - -This project would not exist without all of its users and [contributors][9]. - -If you have ideas on how to make the configuration easier to maintain or -improve its performance, do not hesitate to fork and send pull requests. - -### Issue Reporting - - - Check that the issue has not already been reported. - - Check that the issue has not already been fixed in the latest code. - - Open an issue with a clear title and description in grammatically correct, - complete sentences. - -### Pull Request - - - Read [how to properly contribute to open source projects on GitHub][10]. - - Use a topic branch to easily amend a pull request later, if necessary. - - Write [good commit messages][11]. - - Squash commits on the topic branch before opening a pull request. - - Use the same coding style and spacing. - - Open a [pull request][12] that relates to but one subject with a clear - title and description in grammatically correct, complete sentences. - -#### Modules - - - A *README.md* must be present. - - Large functions must be placed in a *functions* directory. - - Functions that take arguments must have completion. - -#### Themes - - - A screenshots section must be present in the file header. - - The pull request description must have [embedded - screenshots][13]. - License ------- @@ -161,9 +124,4 @@ SOFTWARE. [6]: http://gitref.org [7]: http://www.bash2zsh.com/zsh_refcard/refcard.pdf [8]: http://grml.org/zsh/zsh-lovers.html -[9]: https://github.com/sorin-ionescu/prezto/contributors -[10]: http://gun.io/blog/how-to-github-fork-branch-and-pull-request -[11]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html -[12]: https://help.github.com/articles/using-pull-requests -[13]: http://daringfireball.net/projects/markdown/syntax#img From bc8533c30eaff98479935e37edfb98c6980a4b35 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 25 Sep 2012 17:25:29 -0400 Subject: [PATCH 17/56] Update sorin theme screenshot --- README.md | 2 +- modules/prompt/functions/prompt_sorin_setup | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a38a06e2d2..2955fe57dd 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. [1]: http://www.zsh.org -[2]: http://i.imgur.com/ij8Lv.png "sorin theme" +[2]: http://i.imgur.com/nBEEZ.png "sorin theme" [3]: http://git-scm.com [4]: https://github.com [5]: http://gitimmersion.com diff --git a/modules/prompt/functions/prompt_sorin_setup b/modules/prompt/functions/prompt_sorin_setup index 28979fa7ca..afc531c71e 100644 --- a/modules/prompt/functions/prompt_sorin_setup +++ b/modules/prompt/functions/prompt_sorin_setup @@ -5,7 +5,7 @@ # Sorin Ionescu # # Screenshots: -# http://i.imgur.com/ij8Lv.png +# http://i.imgur.com/nBEEZ.png # # Load dependencies. From b1b5af23b61269f50c73c59be427f0c3d7f6275c Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 25 Sep 2012 17:27:16 -0400 Subject: [PATCH 18/56] Check for empty values in $key_info properly --- modules/editor/init.zsh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/editor/init.zsh b/modules/editor/init.zsh index 5f035b677e..b36cfa2d07 100644 --- a/modules/editor/init.zsh +++ b/modules/editor/init.zsh @@ -95,9 +95,10 @@ key_info=( ) # Do not bind any keys if there are empty values in $key_info. -for key in "$key_info[@]"; do - if [[ -z "$key" ]]; then +for key in "${(k)key_info[@]}"; do + if [[ -z "$key_info[$key]" ]]; then print "prezto: one or more keys are non-bindable" >&2 + unset key{,_info} return 1 fi done From 4711d6ba66c553312901b2199b9ca944c9273659 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 25 Sep 2012 17:31:46 -0400 Subject: [PATCH 19/56] Load external editor support after $key_info definition --- modules/editor/init.zsh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/editor/init.zsh b/modules/editor/init.zsh index b36cfa2d07..870448e92b 100644 --- a/modules/editor/init.zsh +++ b/modules/editor/init.zsh @@ -53,10 +53,6 @@ fi # Beep on error in line editor. setopt BEEP -# Allow command line editing in an external editor. -autoload -Uz edit-command-line -zle -N edit-command-line - # # Variables # @@ -103,6 +99,14 @@ for key in "${(k)key_info[@]}"; do fi done +# +# External Editor +# + +# Allow command line editing in an external editor. +autoload -Uz edit-command-line +zle -N edit-command-line + # # Functions # From 6f916355b257b19fbee278579a4a656fa9d32311 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 25 Sep 2012 17:33:10 -0400 Subject: [PATCH 20/56] Do not attempt to reload modules that failed to load --- init.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.zsh b/init.zsh index 4c19daf3ce..fc12297c6f 100644 --- a/init.zsh +++ b/init.zsh @@ -47,7 +47,7 @@ function pmodload { # Load Prezto modules. for pmodule in "$pmodules[@]"; do - if zstyle -t ":prezto:module:$pmodule" loaded; then + if zstyle -t ":prezto:module:$pmodule" loaded 'yes' 'no'; then continue elif [[ ! -d "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule" ]]; then print "$0: no such module: $pmodule" >&2 From 1dfc0bf7848a00ced9bd5c810a04fafc6df7e1e2 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 25 Sep 2012 20:14:07 -0400 Subject: [PATCH 21/56] Ensure $key_info is populated before use --- modules/history-substring-search/init.zsh | 28 ++++++++++++----------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/modules/history-substring-search/init.zsh b/modules/history-substring-search/init.zsh index 842ee1c545..ea20fffd26 100644 --- a/modules/history-substring-search/init.zsh +++ b/modules/history-substring-search/init.zsh @@ -28,17 +28,19 @@ fi # Key Bindings # -# Emacs -bindkey -M emacs "$key_info[Control]P" history-substring-search-up -bindkey -M emacs "$key_info[Control]N" history-substring-search-down - -# Vi -bindkey -M vicmd "k" history-substring-search-up -bindkey -M vicmd "j" history-substring-search-down - -# Emacs and Vi -for keymap in 'emacs' 'viins'; do - bindkey -M "$keymap" "$key_info[Up]" history-substring-search-up - bindkey -M "$keymap" "$key_info[Down]" history-substring-search-down -done +if [[ -n $key_info ]]; then + # Emacs + bindkey -M emacs "$key_info[Control]P" history-substring-search-up + bindkey -M emacs "$key_info[Control]N" history-substring-search-down + + # Vi + bindkey -M vicmd "k" history-substring-search-up + bindkey -M vicmd "j" history-substring-search-down + + # Emacs and Vi + for keymap in 'emacs' 'viins'; do + bindkey -M "$keymap" "$key_info[Up]" history-substring-search-up + bindkey -M "$keymap" "$key_info[Down]" history-substring-search-down + done +fi From be0e4245a6b693a0e0fd5cfa2cad8add503442ef Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 26 Sep 2012 16:51:32 -0400 Subject: [PATCH 22/56] [Fix #301] Unset $MATCH after use --- modules/prompt/functions/prompt_sorin_setup | 1 + modules/terminal/init.zsh | 2 ++ 2 files changed, 3 insertions(+) diff --git a/modules/prompt/functions/prompt_sorin_setup b/modules/prompt/functions/prompt_sorin_setup index afc531c71e..6b776877b9 100644 --- a/modules/prompt/functions/prompt_sorin_setup +++ b/modules/prompt/functions/prompt_sorin_setup @@ -16,6 +16,7 @@ function prompt_sorin_pwd { if [[ "$pwd" == (#m)[/~] ]]; then _prompt_sorin_pwd="$MATCH" + unset MATCH else _prompt_sorin_pwd="${${(@j:/:M)${(@s:/:)pwd}##.#?}:h}/${pwd:t}" fi diff --git a/modules/terminal/init.zsh b/modules/terminal/init.zsh index d5cd3ecec7..dc78a3bec0 100644 --- a/modules/terminal/init.zsh +++ b/modules/terminal/init.zsh @@ -68,6 +68,7 @@ function set-titles-with-command { # Set the command name, or in the case of sudo or ssh, the next command. local cmd=${${1[(wr)^(*=*|sudo|ssh|-*)]}:t} local truncated_cmd="${cmd/(#m)?(#c15,)/${MATCH[1,12]}...}" + unset MATCH if [[ "$TERM" == screen* ]]; then set-screen-window-title "$truncated_cmd" @@ -90,6 +91,7 @@ function set-titles-with-path { else local abbreviated_path="${absolute_path/#$HOME/~}" local truncated_path="${abbreviated_path/(#m)?(#c15,)/...${MATCH[-12,-1]}}" + unset MATCH if [[ "$TERM" == screen* ]]; then set-screen-window-title "$truncated_path" From eb93677e4a5c4b276e3d7c33c89a3bfad207a672 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 28 Sep 2012 18:24:02 -0400 Subject: [PATCH 23/56] [Fix #303] Remove extra '/' in sorin theme --- modules/prompt/functions/prompt_sorin_setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/prompt/functions/prompt_sorin_setup b/modules/prompt/functions/prompt_sorin_setup index 6b776877b9..c4d856cdb1 100644 --- a/modules/prompt/functions/prompt_sorin_setup +++ b/modules/prompt/functions/prompt_sorin_setup @@ -18,7 +18,7 @@ function prompt_sorin_pwd { _prompt_sorin_pwd="$MATCH" unset MATCH else - _prompt_sorin_pwd="${${(@j:/:M)${(@s:/:)pwd}##.#?}:h}/${pwd:t}" + _prompt_sorin_pwd="${${${(@j:/:M)${(@s:/:)pwd}##.#?}:h}%/}/${pwd:t}" fi } From b0a71cae3c17b6d0cfea880d6df3a83181309ea7 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sat, 29 Sep 2012 13:07:31 -0400 Subject: [PATCH 24/56] Load dependencies in Git init --- modules/git/functions/git-info | 3 --- modules/git/init.zsh | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/git/functions/git-info b/modules/git/functions/git-info index 07ebf80325..6c7a1f685c 100644 --- a/modules/git/functions/git-info +++ b/modules/git/functions/git-info @@ -64,9 +64,6 @@ # 'rprompt' '' # -# Load dependencies. -pmodload 'helper' - # Gets the Git special action (am, bisect, cherry, merge, rebase). # Borrowed from vcs_info and edited. function _git-action { diff --git a/modules/git/init.zsh b/modules/git/init.zsh index 81a7b737df..3a618f23fa 100644 --- a/modules/git/init.zsh +++ b/modules/git/init.zsh @@ -10,6 +10,9 @@ if (( ! $+commands[git] )); then return 1 fi +# Load dependencies. +pmodload 'helper' + # Source module files. source "${0:h}/alias.zsh" From c6cdd47b2400955d97bd2d54799491ad1d0bdc9c Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sat, 29 Sep 2012 13:42:15 -0400 Subject: [PATCH 25/56] Define variable expl as local --- modules/git/functions/_git-hub-browse | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/git/functions/_git-hub-browse b/modules/git/functions/_git-hub-browse index 35f3a9bebe..dfe612e53e 100644 --- a/modules/git/functions/_git-hub-browse +++ b/modules/git/functions/_git-hub-browse @@ -8,7 +8,7 @@ # Sorin Ionescu # -local state remotes remote branches_or_tags branches tags files ret=1 +local state expl remotes remote branches_or_tags branches tags files ret=1 _arguments -C -s -S \ '1::args:->remote' \ From 26d3d161544fc02ba5547538f45cde9dc56cdf5b Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sat, 29 Sep 2012 13:45:49 -0400 Subject: [PATCH 26/56] Add missing backslashes --- modules/git/functions/git-stash-dropped | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/git/functions/git-stash-dropped b/modules/git/functions/git-stash-dropped index bdba23862f..ce3a52b1e5 100644 --- a/modules/git/functions/git-stash-dropped +++ b/modules/git/functions/git-stash-dropped @@ -5,11 +5,11 @@ # Sorin Ionescu # -git fsck --unreachable 2> /dev/null +git fsck --unreachable 2> /dev/null \ | grep 'commit' \ | awk '{print $3}' \ | git log \ - ${git_log_format_oneline} + ${git_log_format_oneline} \ --extended-regexp \ --grep="${1:-(WIP )?[Oo]n [^:]+:}" \ --merges \ From 2bee82dc2acf5a522033d5cf31def340125a88be Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sat, 29 Sep 2012 14:00:38 -0400 Subject: [PATCH 27/56] Fix a #compdef bug introduced in 7dd7859 --- modules/git/functions/_git-hub-browse | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/git/functions/_git-hub-browse b/modules/git/functions/_git-hub-browse index dfe612e53e..f54daebdf1 100644 --- a/modules/git/functions/_git-hub-browse +++ b/modules/git/functions/_git-hub-browse @@ -1,4 +1,4 @@ -#compdef git-hub +#compdef git-hub-browse #autoload # From 39a793af0ab13a19537271deae55609203a7c41c Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sat, 29 Sep 2012 23:17:39 -0400 Subject: [PATCH 28/56] Simplify git-config calls --- modules/git/functions/_git-hub-browse | 8 +++----- modules/git/functions/git-hub-browse | 7 ++----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/modules/git/functions/_git-hub-browse b/modules/git/functions/_git-hub-browse index f54daebdf1..e3c41d8a29 100644 --- a/modules/git/functions/_git-hub-browse +++ b/modules/git/functions/_git-hub-browse @@ -17,17 +17,15 @@ _arguments -C -s -S \ case "$state" in (remote) - remotes=($( - git config --local --get-regexp 'remote.*.url' \ - | awk 'BEGIN {FS="."} ; {print $2}' - )) + remotes=($(git config --get-regexp 'remote.*.url' | cut -d. -f2)) + _describe -t branch 'remotes' remotes && ret=0 ;; (branch-or-tag) remote="$words[(($CURRENT - 1))]" branches_or_tags=($( - git ls-remote --heads --tags "$remote" | awk '{print $2}' + git ls-remote --heads --tags "$remote" 2>/dev/null | cut -f2 )) branches=(HEAD ${${(M)branches_or_tags[@]##refs/heads/?##}##refs/heads/}) diff --git a/modules/git/functions/git-hub-browse b/modules/git/functions/git-hub-browse index bc2a070163..ee4f9f634a 100644 --- a/modules/git/functions/git-hub-browse +++ b/modules/git/functions/git-hub-browse @@ -8,10 +8,7 @@ local remotes remote references reference file url remote="${1:-origin}" -remotes=($( - git config --local --get-regexp 'remote.*.url' \ - | awk 'BEGIN {FS="."} ; {print $2}' -)) +remotes=($(git config --get-regexp 'remote.*.url' | cut -d. -f2)) if (( $remotes[(i)$remote] == $#remotes + 1 )); then print "$0: remote not found: $remote" >&2 @@ -19,7 +16,7 @@ if (( $remotes[(i)$remote] == $#remotes + 1 )); then fi url=$( - git config --local --get "remote.${remote}.url" \ + git config --get "remote.${remote}.url" \ | sed -En "s/(git|https?)(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\4\/\5/p" ) From 6c1a81b5cfb9fcba800b72f14ed2337ff0f985a4 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sat, 29 Sep 2012 23:37:28 -0400 Subject: [PATCH 29/56] Return inside of the if statement --- modules/git/functions/git-dir | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/git/functions/git-dir b/modules/git/functions/git-dir index a52e6c2eef..e096752f92 100644 --- a/modules/git/functions/git-dir +++ b/modules/git/functions/git-dir @@ -10,7 +10,7 @@ local git_dir="${$(git rev-parse --git-dir):A}" if [[ -n "$git_dir" ]]; then print "$git_dir" return 0 +else + return 1 fi -return 1 - From 102da8bea01f787f40eadd1817d0ae93d0371c86 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 30 Sep 2012 15:30:18 -0400 Subject: [PATCH 30/56] Make sure that the current directory is a Git repository --- modules/git/functions/_git-hub-browse | 4 ++++ modules/git/functions/_git-info | 4 ++++ modules/git/functions/git-branch-current | 6 ++++++ modules/git/functions/git-commit-lost | 5 +++++ modules/git/functions/git-dir | 1 + modules/git/functions/git-hub-browse | 5 +++++ modules/git/functions/git-root | 1 + modules/git/functions/git-stash-clear-interactive | 5 +++++ modules/git/functions/git-stash-dropped | 5 +++++ modules/git/functions/git-stash-recover | 5 +++++ modules/git/functions/git-submodule-move | 13 ++++++++----- modules/git/functions/git-submodule-remove | 11 ++++++----- 12 files changed, 55 insertions(+), 10 deletions(-) diff --git a/modules/git/functions/_git-hub-browse b/modules/git/functions/_git-hub-browse index e3c41d8a29..0085c18886 100644 --- a/modules/git/functions/_git-hub-browse +++ b/modules/git/functions/_git-hub-browse @@ -8,6 +8,10 @@ # Sorin Ionescu # +if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then + return 1 +fi + local state expl remotes remote branches_or_tags branches tags files ret=1 _arguments -C -s -S \ diff --git a/modules/git/functions/_git-info b/modules/git/functions/_git-info index 0357c6d8f4..c1467e84bb 100644 --- a/modules/git/functions/_git-info +++ b/modules/git/functions/_git-info @@ -8,6 +8,10 @@ # Sorin Ionescu # +if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then + return 1 +fi + _arguments "1:toggle:(( on\:'enable in-prompt information for the current repository' off\:'disable in-prompt information for the current repository' diff --git a/modules/git/functions/git-branch-current b/modules/git/functions/git-branch-current index 3078ad13b8..c731958d90 100644 --- a/modules/git/functions/git-branch-current +++ b/modules/git/functions/git-branch-current @@ -5,7 +5,13 @@ # Sorin Ionescu # +if ! 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)" + if [[ -n "$ref" ]]; then print "${ref#refs/heads/}" return 0 diff --git a/modules/git/functions/git-commit-lost b/modules/git/functions/git-commit-lost index ed9b0766e1..0984ab923c 100644 --- a/modules/git/functions/git-commit-lost +++ b/modules/git/functions/git-commit-lost @@ -5,6 +5,11 @@ # Sorin Ionescu # +if ! is-true "$(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 \ | grep "^dangling commit" \ | awk '{print $3}' \ diff --git a/modules/git/functions/git-dir b/modules/git/functions/git-dir index e096752f92..79b36d7bf4 100644 --- a/modules/git/functions/git-dir +++ b/modules/git/functions/git-dir @@ -11,6 +11,7 @@ if [[ -n "$git_dir" ]]; then print "$git_dir" return 0 else + print "$0: not a repository: $PWD" >&2 return 1 fi diff --git a/modules/git/functions/git-hub-browse b/modules/git/functions/git-hub-browse index ee4f9f634a..80fddca044 100644 --- a/modules/git/functions/git-hub-browse +++ b/modules/git/functions/git-hub-browse @@ -5,6 +5,11 @@ # Sorin Ionescu # +if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then + print "$0: not a repository work tree: $PWD" >&2 + return 1 +fi + local remotes remote references reference file url remote="${1:-origin}" diff --git a/modules/git/functions/git-root b/modules/git/functions/git-root index c5aa48f0d2..6ba52ef418 100644 --- a/modules/git/functions/git-root +++ b/modules/git/functions/git-root @@ -11,6 +11,7 @@ if [[ -n "$root" ]]; then print "$root" return 0 else + print "$0: not a repository work tree: $PWD" >&2 return 1 fi diff --git a/modules/git/functions/git-stash-clear-interactive b/modules/git/functions/git-stash-clear-interactive index 82d055cafc..effd038f7f 100644 --- a/modules/git/functions/git-stash-clear-interactive +++ b/modules/git/functions/git-stash-clear-interactive @@ -5,6 +5,11 @@ # Sorin Ionescu # +if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then + print "$0: not a repository work tree: $PWD" >&2 + return 1 +fi + local stashed if [[ -f "$(git-dir)/refs/stash" ]]; then diff --git a/modules/git/functions/git-stash-dropped b/modules/git/functions/git-stash-dropped index ce3a52b1e5..9867ad04a9 100644 --- a/modules/git/functions/git-stash-dropped +++ b/modules/git/functions/git-stash-dropped @@ -5,6 +5,11 @@ # Sorin Ionescu # +if ! is-true "$(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 \ | grep 'commit' \ | awk '{print $3}' \ diff --git a/modules/git/functions/git-stash-recover b/modules/git/functions/git-stash-recover index dd50a1bcc7..0709440638 100644 --- a/modules/git/functions/git-stash-recover +++ b/modules/git/functions/git-stash-recover @@ -5,6 +5,11 @@ # Sorin Ionescu # +if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then + print "$0: not a repository work tree: $PWD" >&2 + return 1 +fi + local commit for commit in "$@"; do diff --git a/modules/git/functions/git-submodule-move b/modules/git/functions/git-submodule-move index 4c94ed25fa..c3db972d02 100644 --- a/modules/git/functions/git-submodule-move +++ b/modules/git/functions/git-submodule-move @@ -5,15 +5,18 @@ # Sorin Ionescu # +if ! is-true "$(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 +fi + local src="$1" local dst="$2" local url -if [[ "$PWD" != "$(git-root)" ]]; then - print "$0: must be run from the root of the working tree" >&2 - return 1 -fi - url="$(git config --file "$(git-root)/.gitmodules" --get "submodule.${src}.url")" if [[ -z "$url" ]]; then diff --git a/modules/git/functions/git-submodule-remove b/modules/git/functions/git-submodule-remove index 26fca233f2..3f72fb6d87 100644 --- a/modules/git/functions/git-submodule-remove +++ b/modules/git/functions/git-submodule-remove @@ -5,12 +5,13 @@ # Sorin Ionescu # -if [[ "$PWD" != "$(git-root)" ]]; then - print "$0: must be run from the root of the working tree" >&2 +if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then + print "$0: not a repository work tree: $PWD" >&2 return 1 -fi - -if ! git config --file .gitmodules --get "submodule.${1}.path" &>/dev/null; then +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 print "$0: submodule not found: $1" >&2 return 1 fi From 6cf368cf4d504686a4ab53b4acd28bc98c8ae2a5 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 30 Sep 2012 15:32:43 -0400 Subject: [PATCH 31/56] Silence git-branch-current in aliases --- modules/git/alias.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/git/alias.zsh b/modules/git/alias.zsh index 6a3694f013..ad07862c9b 100644 --- a/modules/git/alias.zsh +++ b/modules/git/alias.zsh @@ -104,8 +104,8 @@ alias gpf='git push --force' alias gpa='git push --all' alias gpA='git push --all && git push --tags' alias gpt='git push --tags' -alias gpc='git push --set-upstream origin "$(git-branch-current)"' -alias gpp='git pull origin "$(git-branch-current)" && git push origin "$(git-branch-current)"' +alias gpc='git push --set-upstream origin "$(git-branch-current 2> /dev/null)"' +alias gpp='git pull origin "$(git-branch-current 2> /dev/null)" && git push origin "$(git-branch-current 2> /dev/null)"' # Rebase (r) alias gr='git rebase' From 8b8a883718609bc7c185360647157be490f6ac14 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 30 Sep 2012 15:53:26 -0400 Subject: [PATCH 32/56] Add completion for Git submodule moving and removing --- modules/git/functions/_git-submodule-move | 41 +++++++++++++++++++++ modules/git/functions/_git-submodule-remove | 27 ++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 modules/git/functions/_git-submodule-move create mode 100644 modules/git/functions/_git-submodule-remove diff --git a/modules/git/functions/_git-submodule-move b/modules/git/functions/_git-submodule-move new file mode 100644 index 0000000000..ab8cd1ba17 --- /dev/null +++ b/modules/git/functions/_git-submodule-move @@ -0,0 +1,41 @@ +#compdef git-submodule-move +#autoload + +# +# Completes git-submodule-move. +# +# Authors: +# Sorin Ionescu +# + +if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then + return 1 +fi + +local state expl ret=1 +local -a submodules +local submodule + +_arguments -C -s -S \ + '1::args:->submodule' \ + '2::args:->directory' && ret=0 + +case "$state" in + (submodule) + while IFS=$'\n' read submodule; do + submodules+=("$submodule") + done < <( + git config --file "$(git-root)/.gitmodules" --list \ + | grep '.path=' \ + | cut -d= -f2- + ) + + _describe -t submodule 'submodules' submodules && ret=0 + ;; + (directory) + _wanted directories expl 'directory' _path_files -/ || _message 'directory' + ;; +esac + +return $ret + diff --git a/modules/git/functions/_git-submodule-remove b/modules/git/functions/_git-submodule-remove new file mode 100644 index 0000000000..1460dd0ec4 --- /dev/null +++ b/modules/git/functions/_git-submodule-remove @@ -0,0 +1,27 @@ +#compdef git-submodule-remove +#autoload + +# +# Completes git-submodule-remove. +# +# Authors: +# Sorin Ionescu +# + +if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then + return 1 +fi + +local -a submodules +local submodule + +while IFS=$'\n' read submodule; do + submodules+=("$submodule") +done < <( + git config --file "$(git-root)/.gitmodules" --list \ + | grep '.path=' \ + | cut -d= -f2- +) + +_describe -t submodule 'submodules' submodules && return 0 + From d0535dd2fdcd90bb8812e06ffe5834e0d5f62b2f Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 30 Sep 2012 16:05:36 -0400 Subject: [PATCH 33/56] Simplify mkdcd completion --- modules/utility/functions/_mkdcd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/utility/functions/_mkdcd b/modules/utility/functions/_mkdcd index 81912375db..5b20ee2305 100644 --- a/modules/utility/functions/_mkdcd +++ b/modules/utility/functions/_mkdcd @@ -8,7 +8,7 @@ # Sorin Ionescu # -_wanted directories expl \ - 'parent directory (alternatively specify name of directory)' \ - _path_files -/ || _message 'name of directory' +local expl + +_wanted directories expl 'directory' _path_files -/ || _message 'directory' From d7fb7cd215f68c3177b0f10c1f270e80995162ac Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 30 Sep 2012 16:06:12 -0400 Subject: [PATCH 34/56] Add a missing space to peepcode --- modules/prompt/functions/prompt_peepcode_setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/prompt/functions/prompt_peepcode_setup b/modules/prompt/functions/prompt_peepcode_setup index 0dd7e747ac..bcedeec71b 100644 --- a/modules/prompt/functions/prompt_peepcode_setup +++ b/modules/prompt/functions/prompt_peepcode_setup @@ -13,7 +13,7 @@ function +vi-git-status() { # Check for untracked files or updated submodules since vcs_info does not. if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then - hook_com[unstaged]='%F{8}✗%f' + hook_com[unstaged]=' %F{8}✗%f' fi } From 875def4f4347a819db94d1b247320fb59ee8d9d4 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 30 Sep 2012 16:08:27 -0400 Subject: [PATCH 35/56] Load dependencies after requirements check --- modules/ssh-agent/init.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/ssh-agent/init.zsh b/modules/ssh-agent/init.zsh index 43ca43909a..56215a4f74 100644 --- a/modules/ssh-agent/init.zsh +++ b/modules/ssh-agent/init.zsh @@ -11,14 +11,14 @@ # Sorin Ionescu # -# Load dependencies. -pmodload 'helper' - # Return if requirements are not found. if (( ! $+commands[ssh-agent] )); then return 1 fi +# Load dependencies. +pmodload 'helper' + _ssh_agent_env="${HOME}/.ssh/environment-${HOST}" _ssh_agent_forwarding= From b967c50fafa778b8e208bf2e28d4477195ff5027 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 30 Sep 2012 16:15:20 -0400 Subject: [PATCH 36/56] [#129, #211] Remove z --- .gitmodules | 3 --- modules/z/README.md | 21 --------------------- modules/z/external | 1 - modules/z/init.zsh | 19 ------------------- 4 files changed, 44 deletions(-) delete mode 100644 modules/z/README.md delete mode 160000 modules/z/external delete mode 100644 modules/z/init.zsh diff --git a/.gitmodules b/.gitmodules index a898a30646..7a7a7b5ecb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,6 +7,3 @@ [submodule "modules/completion/external"] path = modules/completion/external url = https://github.com/zsh-users/zsh-completions.git -[submodule "modules/z/external"] - path = modules/z/external - url = https://github.com/rupa/z.git diff --git a/modules/z/README.md b/modules/z/README.md deleted file mode 100644 index e17aa0ecd6..0000000000 --- a/modules/z/README.md +++ /dev/null @@ -1,21 +0,0 @@ -Z -= - -Integrates [z][1] into Prezto, which maintains a frequently used directory -list for fast directory changes. - -Aliases -------- - - - `j` changes the current working directory to the most *frecent* match. - -Authors -------- - -*The authors of this module should be contacted via the [issue tracker][2].* - - - [Sorin Ionescu](https://github.com/sorin-ionescu) - -[1]: https://github.com/rupa/z -[2]: https://github.com/sorin-ionescu/prezto/issues - diff --git a/modules/z/external b/modules/z/external deleted file mode 160000 index 9bf5feb86a..0000000000 --- a/modules/z/external +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9bf5feb86ac05ad32cd8fbf46d459eb415eed749 diff --git a/modules/z/init.zsh b/modules/z/init.zsh deleted file mode 100644 index df1e570960..0000000000 --- a/modules/z/init.zsh +++ /dev/null @@ -1,19 +0,0 @@ -# -# Maintains a frequently used directory list for fast directory changes. -# -# Authors: -# Sorin Ionescu -# - -# Set the directory changing command. -_Z_CMD='j' - -# Prevent symbolic link resolution. -_Z_NO_RESOLVE_SYMLINKS=1 - -# Source module files. -source "${0:h}/external/z.sh" - -# Cleanup. -unset _Z_{CMD,NO_RESOLVE_SYMLINKS} - From 24bb99cecd7151190c64c3b143765442eae9c06e Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 30 Sep 2012 16:29:45 -0400 Subject: [PATCH 37/56] [Fix #129, Fix #211] Add fasd --- modules/fasd/README.md | 39 ++++++++++++++++++++++++++++++ modules/fasd/init.zsh | 54 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 modules/fasd/README.md create mode 100644 modules/fasd/init.zsh diff --git a/modules/fasd/README.md b/modules/fasd/README.md new file mode 100644 index 0000000000..5cfc2cc75d --- /dev/null +++ b/modules/fasd/README.md @@ -0,0 +1,39 @@ +Fasd +==== + +[Fasd][1] is a command-line productivity booster, inspired by tools like +[autojump][2], [z][3] and [v][4], it offers quick access to files and +directories by keeping track of files and directories that were previously +accessed. + +For completion to work, this module must be loaded **after** the *completion* +module. + +The Prezto Fasd configuration differs from the default. The default aliases have +been disabled. + +Aliases +------- + + - `j` changes the current working directory interactively. + +Completion +---------- + +Type `,`, `f,`, `d,` in front of a comma-separated query or type `,,`, `,,f`, +`,,d` at the end of a comma-separated query then hit tab. + +Authors +------- + +*The authors of this module should be contacted via the [issue tracker][5].* + + - [Wei Dai](https://github.com/clvv) + - [Sorin Ionescu](https://github.com/sorin-ionescu) + +[1]: https://github.com/clvv/fasd +[2]: https://github.com/joelthelion/autojump +[3]: https://github.com/rupa/z +[4]: https://github.com/rupa/v +[5]: https://github.com/sorin-ionescu/prezto/issues + diff --git a/modules/fasd/init.zsh b/modules/fasd/init.zsh new file mode 100644 index 0000000000..7088e9c681 --- /dev/null +++ b/modules/fasd/init.zsh @@ -0,0 +1,54 @@ +# +# Maintains a frequently used file and directory list for fast access. +# +# Authors: +# Wei Dai +# Sorin Ionescu +# + +# Load dependencies. +pmodload 'editor' + +# Return if requirements are not found. +if (( ! $+commands[fasd] )); then + return 1 +fi + +# +# Initialization +# + +cache_file="${0:h}/cache.zsh" +if [[ "${commands[fasd]}" -nt "$cache_file" || ! -s "$cache_file" ]]; then + # Set the base init arguments. + init_args=(zsh-hook) + + # Set fasd completion init arguments, if applicable. + if zstyle -t ':prezto:module:completion' loaded; then + init_args+=(zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install) + fi + + # Cache init code. + fasd --init "$init_args[@]" >! "$cache_file" 2> /dev/null +fi + +source "$cache_file" + +unset cache_file init_args + +function fasd_cd { + local fasd_ret="$(fasd -d "$@")" + if [[ -d "$fasd_ret" ]]; then + cd "$fasd_ret" + else + print "$fasd_ret" + fi +} + +# +# Aliases +# + +# Changes the current working directory interactively. +alias j='fasd_cd -i' + From cefac28c5899528d123b73e004ba5e3553d20188 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 30 Sep 2012 17:45:11 -0400 Subject: [PATCH 38/56] Update external completions --- modules/completion/external | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/completion/external b/modules/completion/external index 589938ffc9..9ef8d2f088 160000 --- a/modules/completion/external +++ b/modules/completion/external @@ -1 +1 @@ -Subproject commit 589938ffc9c241952743051d907f7cb451eb157f +Subproject commit 9ef8d2f088d302fdedfa89b9cfd88ef926166a7c From 6975e1df1c1aefceadfe20a89a93f67133480eff Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 30 Sep 2012 17:19:34 -0400 Subject: [PATCH 39/56] [Fix #300] Disable SSH-Agent protocol emulation by default --- modules/gpg-agent/README.md | 9 +++++++++ modules/gpg-agent/init.zsh | 10 +++++++++- runcoms/zpreztorc | 7 +++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/modules/gpg-agent/README.md b/modules/gpg-agent/README.md index e1fc158d44..1b222d46a8 100644 --- a/modules/gpg-agent/README.md +++ b/modules/gpg-agent/README.md @@ -3,6 +3,15 @@ GPG-Agent Provides for an easier use of [gpg-agent][1]. +Settings +-------- + +### SSH-Agent Protocol Emulation + +To enable SSH-Agent protocol emulation, add the following line to *zpreztorc*: + + zstyle ':prezto:module:gpg-agent' ssh-support 'yes' + Authors ------- diff --git a/modules/gpg-agent/init.zsh b/modules/gpg-agent/init.zsh index 902466da91..6d010d2813 100644 --- a/modules/gpg-agent/init.zsh +++ b/modules/gpg-agent/init.zsh @@ -14,7 +14,15 @@ fi _gpg_env="$HOME/.gnupg/gpg-agent.env" function _gpg-agent-start { - gpg-agent --daemon --enable-ssh-support --write-env-file "${_gpg_env}" > /dev/null + local ssh_support + + zstyle -b ':prezto:module:gpg-agent' ssh-support 'ssh_support' \ + || ssh_support='' + + gpg-agent \ + --daemon ${ssh_support:+'--enable-ssh-support'} + --write-env-file "${_gpg_env}" > /dev/null + chmod 600 "${_gpg_env}" source "${_gpg_env}" > /dev/null } diff --git a/runcoms/zpreztorc b/runcoms/zpreztorc index 66cddb52f0..fd17969e97 100644 --- a/runcoms/zpreztorc +++ b/runcoms/zpreztorc @@ -81,6 +81,13 @@ zstyle ':prezto:module:prompt' theme 'sorin' # Auto start a session when Zsh is launched. # zstyle ':prezto:module:screen' auto-start 'yes' +# +# GPG-Agent +# + +# Enable SSH-Agent protocol emulation. +# zstyle ':prezto:module:gpg-agent' ssh-support 'yes' + # # SSH-Agent # From f8da0452cec9de33f94a2c7c0c4a7949033625ae Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 30 Sep 2012 17:22:35 -0400 Subject: [PATCH 40/56] Fix SSH-Agent casing in README --- modules/ssh-agent/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ssh-agent/README.md b/modules/ssh-agent/README.md index 17c5b734cb..392a8666fb 100644 --- a/modules/ssh-agent/README.md +++ b/modules/ssh-agent/README.md @@ -8,7 +8,7 @@ Settings ### Agent Forwarding -To enable ssh-agent forwarding, add the following line to *zpreztorc*: +To enable SSH-Agent forwarding, add the following line to *zpreztorc*: zstyle ':prezto:module:ssh-agent' forwarding 'yes' From 770737bd83bd6b4ee72c7fb60ce6c53a24c421ed Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 30 Sep 2012 20:44:04 -0400 Subject: [PATCH 41/56] Remove the gig alias It escaped removal in 7b453c1. --- modules/git/alias.zsh | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/git/alias.zsh b/modules/git/alias.zsh index ad07862c9b..fbf4951886 100644 --- a/modules/git/alias.zsh +++ b/modules/git/alias.zsh @@ -67,7 +67,6 @@ alias gir='git reset' alias giR='git reset --keep' alias gix='git rm -r --cached' alias giX='git rm -rf --cached' -alias gig='git grep --cached' # Konflict (k) alias gkl='git status | sed -n "s/^.*both [a-z]*ed: *//p"' From 0899dd4d3825166105ce119cb34aa6140cb0b2a6 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 30 Sep 2012 20:45:23 -0400 Subject: [PATCH 42/56] Rename the alias gsc to gsX --- modules/git/alias.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/git/alias.zsh b/modules/git/alias.zsh index fbf4951886..4179cf14db 100644 --- a/modules/git/alias.zsh +++ b/modules/git/alias.zsh @@ -127,8 +127,8 @@ alias gRb='git-hub-browse' # Stash (s) alias gs='git stash' alias gsa='git stash apply' -alias gsc='git-stash-clear-interactive' alias gsx='git stash drop' +alias gsX='git-stash-clear-interactive' alias gsd='git-stash-dropped' alias gsl='git stash list' alias gsL='git stash show --patch --stat' From 768c9d6ad36bae369f1fca161d9399e03061eb61 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 30 Sep 2012 20:46:21 -0400 Subject: [PATCH 43/56] Rename aliases gSu to gSI and gSU to gSu --- modules/git/alias.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/git/alias.zsh b/modules/git/alias.zsh index 4179cf14db..7f6cf25037 100644 --- a/modules/git/alias.zsh +++ b/modules/git/alias.zsh @@ -143,11 +143,11 @@ alias gS='git submodule' alias gSa='git submodule add' alias gSf='git submodule foreach' alias gSi='git submodule init' +alias gSI='git submodule update --init --recursive' alias gSl='git submodule status' alias gSm='git-submodule-move' alias gSs='git submodule sync' -alias gSu='git submodule update --init --recursive' -alias gSU='git submodule foreach git pull origin master' +alias gSu='git submodule foreach git pull origin master' alias gSx='git-submodule-remove' # Working Copy (w) From bd9327ca3f0f622e9330cce7ef233554bbcc0577 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 1 Oct 2012 21:20:59 -0400 Subject: [PATCH 44/56] Rename the Git status ignore submodules zstyle pattern --- modules/git/alias.zsh | 17 +++++++++++++++-- modules/git/functions/git-info | 8 ++++---- runcoms/zpreztorc | 2 +- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/modules/git/alias.zsh b/modules/git/alias.zsh index 7f6cf25037..4e47ea9de3 100644 --- a/modules/git/alias.zsh +++ b/modules/git/alias.zsh @@ -5,6 +5,19 @@ # Sorin Ionescu # +# +# Settings +# +# + +# Status +zstyle -s ':prezto:module:git:status:ignore' submodules '_git_status_ignore_submodules' \ + || _git_status_ignore_submodules='none' + +# +# Aliases +# + # Git alias g='git' @@ -151,8 +164,8 @@ alias gSu='git submodule foreach git pull origin master' alias gSx='git-submodule-remove' # Working Copy (w) -alias gws='git status --short' -alias gwS='git status' +alias gws='git status --ignore-submodules=${_git_status_ignore_submodules} --short' +alias gwS='git status --ignore-submodules=${_git_status_ignore_submodules}' alias gwd='git diff --no-ext-diff' alias gwD='git diff --no-ext-diff --word-diff' alias gwr='git reset --soft' diff --git a/modules/git/functions/git-info b/modules/git/functions/git-info index 6c7a1f685c..5cf88d7292 100644 --- a/modules/git/functions/git-info +++ b/modules/git/functions/git-info @@ -192,7 +192,7 @@ function git-info { local dirty=0 local dirty_format local dirty_formatted - local ignore_submodule + local ignore_submodules local -A info_formats local info_format local line_number=0 @@ -258,9 +258,9 @@ function git-info { ahead_and_behind_cmd='git rev-list --count --left-right HEAD...@{upstream}' # Ignore submodule status. - zstyle -s ':prezto:module:git:ignore' submodule 'ignore_submodule' - if [[ -n "$ignore_submodule" ]]; then - status_cmd+=" --ignore-submodules=${ignore_submodule}" + zstyle -s ':prezto:module:git:status:ignore' submodules 'ignore_submodules' + if [[ -n "$ignore_submodules" ]]; then + status_cmd+=" --ignore-submodules=${ignore_submodules}" fi # Format commit. diff --git a/runcoms/zpreztorc b/runcoms/zpreztorc index fd17969e97..27aad49b49 100644 --- a/runcoms/zpreztorc +++ b/runcoms/zpreztorc @@ -49,7 +49,7 @@ zstyle ':prezto:module:editor' keymap 'emacs' # # Ignore submodules when they are 'dirty', 'untracked', 'all', or 'none'. -# zstyle ':prezto:module:git:ignore' submodule 'all' +# zstyle ':prezto:module:git:status:ignore' submodules 'all' # # GNU Utility From 141a1ba947af5582ce151be38f4746b30c646211 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 1 Oct 2012 21:50:30 -0400 Subject: [PATCH 45/56] Rename editor-info zstyle patterns --- modules/editor/init.zsh | 20 ++++++++++---------- modules/prompt/functions/prompt_sorin_setup | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/modules/editor/init.zsh b/modules/editor/init.zsh index 870448e92b..dc2cfa500d 100644 --- a/modules/editor/init.zsh +++ b/modules/editor/init.zsh @@ -18,27 +18,27 @@ # To indicate when the editor is in the primary keymap (emacs or viins), add # the following to your theme prompt setup function. # -# zstyle ':prezto:module:editor:keymap' primary '>>>' +# zstyle ':prezto:module:editor:info:keymap:primary' format '>>>' # # To indicate when the editor is in the primary keymap (emacs or viins) insert # mode, add the following to your theme prompt setup function. # -# zstyle ':prezto:module:editor:keymap:primary' insert 'I' +# zstyle ':prezto:module:editor:info:keymap:primary:insert' format 'I' # # To indicate when the editor is in the primary keymap (emacs or viins) # overwrite mode, add the following to your theme prompt setup function. # -# zstyle ':prezto:module:editor:keymap:primary' overwrite 'O' +# zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format 'O' # # To indicate when the editor is in the alternate keymap (vicmd), add the # following to your theme prompt setup function. # -# zstyle ':prezto:module:editor:keymap' alternate '<<<' +# zstyle ':prezto:module:editor:info:keymap:alternate' format '<<<' # # To indicate when the editor is completing, add the following to your theme # prompt setup function. # -# zstyle ':prezto:module:editor' completing '...' +# zstyle ':prezto:module:editor:info:completing' format '...' # # Return if requirements are not found. @@ -119,17 +119,17 @@ function editor-info { typeset -gA editor_info if [[ "$KEYMAP" == 'vicmd' ]]; then - zstyle -s ':prezto:module:editor:keymap' alternate 'REPLY' + zstyle -s ':prezto:module:editor:info:keymap:alternate' format 'REPLY' editor_info[keymap]="$REPLY" else - zstyle -s ':prezto:module:editor:keymap' primary 'REPLY' + zstyle -s ':prezto:module:editor:info:keymap:primary' format 'REPLY' editor_info[keymap]="$REPLY" if [[ "$ZLE_STATE" == *overwrite* ]]; then - zstyle -s ':prezto:module:editor:keymap:primary' overwrite 'REPLY' + zstyle -s ':prezto:module:editor:info:keymap:primary:overwrite' format 'REPLY' editor_info[overwrite]="$REPLY" else - zstyle -s ':prezto:module:editor:keymap:primary' insert 'REPLY' + zstyle -s ':prezto:module:editor:info:keymap:primary:insert' format 'REPLY' editor_info[overwrite]="$REPLY" fi fi @@ -191,7 +191,7 @@ zle -N expand-dot-to-parent-directory-path # Displays an indicator when completing. function expand-or-complete-with-indicator { local indicator - zstyle -s ':prezto:module:editor' completing 'indicator' + zstyle -s ':prezto:module:editor:info:completing' format 'indicator' print -Pn "$indicator" zle expand-or-complete zle redisplay diff --git a/modules/prompt/functions/prompt_sorin_setup b/modules/prompt/functions/prompt_sorin_setup index c4d856cdb1..cbb9440c26 100644 --- a/modules/prompt/functions/prompt_sorin_setup +++ b/modules/prompt/functions/prompt_sorin_setup @@ -46,10 +46,10 @@ function prompt_sorin_setup { # Add hook for calling git-info before each command. add-zsh-hook precmd prompt_sorin_precmd - zstyle ':prezto:module:editor' completing '%B%F{red}...%f%b' - zstyle ':prezto:module:editor:keymap:primary' overwrite ' %F{red}♺%f' - zstyle ':prezto:module:editor:keymap' primary ' %B%F{red}❯%F{yellow}❯%F{green}❯%f%b' - zstyle ':prezto:module:editor:keymap' alternate ' %B%F{green}❮%F{yellow}❮%F{red}❮%f%b' + zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b' + zstyle ':prezto:module:editor:info:keymap:primary' format ' %B%F{red}❯%F{yellow}❯%F{green}❯%f%b' + zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format ' %F{red}♺%f' + zstyle ':prezto:module:editor:info:keymap:alternate' format ' %B%F{green}❮%F{yellow}❮%F{red}❮%f%b' zstyle ':prezto:module:git' action ':%%B%F{yellow}%s%f%%b' zstyle ':prezto:module:git' added ' %%B%F{green}✚%f%%b' zstyle ':prezto:module:git' ahead ' %%B%F{yellow}⬆%f%%b' From 8ea0e42b7f99368ee88059f68cb27e2927ed435f Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 1 Oct 2012 22:00:12 -0400 Subject: [PATCH 46/56] Rename ruby-info zstyle patterns --- modules/prompt/functions/prompt_peepcode_setup | 2 +- modules/ruby/README.md | 2 +- modules/ruby/functions/ruby-info | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/prompt/functions/prompt_peepcode_setup b/modules/prompt/functions/prompt_peepcode_setup index bcedeec71b..58f4f8b4dc 100644 --- a/modules/prompt/functions/prompt_peepcode_setup +++ b/modules/prompt/functions/prompt_peepcode_setup @@ -48,7 +48,7 @@ function prompt_peepcode_setup { zstyle ':vcs_info:git*+set-message:*' hooks git-status # Set ruby-info parameters. - zstyle ':prezto:module:ruby' version ' %F{white}%v%f' + zstyle ':prezto:module:ruby:info:version' format ' %F{white}%v%f' # Define prompts. PROMPT=" diff --git a/modules/ruby/README.md b/modules/ruby/README.md index a95bc36659..4961f00d2c 100644 --- a/modules/ruby/README.md +++ b/modules/ruby/README.md @@ -69,7 +69,7 @@ To display the name of the current Ruby version in a prompt, define the following style in the `prompt_theme_setup` function. # %v - ruby version. - zstyle ':prezto:module:ruby' version 'version:%v' + zstyle ':prezto:module:ruby:info:version' format 'version:%v' Then add `$ruby_info[version]` to `$PROMPT` or `$RPROMPT` and call `ruby-info` in the `prompt_theme_preexec` hook function. diff --git a/modules/ruby/functions/ruby-info b/modules/ruby/functions/ruby-info index f2ce2ed61c..7bc8ead64c 100644 --- a/modules/ruby/functions/ruby-info +++ b/modules/ruby/functions/ruby-info @@ -22,7 +22,7 @@ fi # Format version. if [[ -n "$version" ]]; then - zstyle -s ':prezto:module:ruby' version 'version_format' + zstyle -s ':prezto:module:ruby:info:version' format 'version_format' zformat -f version_formatted "$version_format" "v:$version" ruby_info[version]="$version_formatted" fi From f12c24e76e708e03f7696cd9e692738c9b285eed Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 1 Oct 2012 22:02:47 -0400 Subject: [PATCH 47/56] Rename python-info zstyle patterns --- modules/prompt/functions/prompt_steeef_setup | 2 +- modules/python/README.md | 2 +- modules/python/functions/python-info | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/prompt/functions/prompt_steeef_setup b/modules/prompt/functions/prompt_steeef_setup index 9b07326495..f64f47d276 100644 --- a/modules/prompt/functions/prompt_steeef_setup +++ b/modules/prompt/functions/prompt_steeef_setup @@ -82,7 +82,7 @@ function prompt_steeef_setup { zstyle ':vcs_info:*:prompt:*' nvcsformats "" # Set python-info parameters. - zstyle ':prezto:module:python' virtualenv '(%v)' + zstyle ':prezto:module:python:info:virtualenv' format '(%v)' # Define prompts. PROMPT=" diff --git a/modules/python/README.md b/modules/python/README.md index dd6b19a049..b94fa3265f 100644 --- a/modules/python/README.md +++ b/modules/python/README.md @@ -89,7 +89,7 @@ To display the name of the current virtual enviroment in a prompt, define the following style in the `prompt_theme_setup` function. # %v - virtualenv name. - zstyle ':prezto:module:python' virtualenv 'virtualenv:%v' + zstyle ':prezto:module:python:info:virtualenv' format 'virtualenv:%v' Then add `$python_info[virtualenv]` to `$PROMPT` or `$RPROMPT` and call `python-info` in the `prompt_theme_preexec` hook function. diff --git a/modules/python/functions/python-info b/modules/python/functions/python-info index 40c5011a42..634d01d0e1 100644 --- a/modules/python/functions/python-info +++ b/modules/python/functions/python-info @@ -15,7 +15,7 @@ typeset -gA python_info # Format virtualenv. if [[ -n "$VIRTUAL_ENV" ]]; then - zstyle -s ':prezto:module:python' virtualenv 'virtualenv_format' + zstyle -s ':prezto:module:python:info:virtualenv' format 'virtualenv_format' zformat -f virtualenv_formatted "$virtualenv_format" "v:${VIRTUAL_ENV:t}" python_info[virtualenv]="$virtualenv_formatted" fi From 4c116cb4d2b07cc7fcd41d794e74dbd89897bfc2 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 1 Oct 2012 22:12:14 -0400 Subject: [PATCH 48/56] Rename git-info zstyle patterns --- modules/git/functions/git-info | 34 ++++++++++----------- modules/prompt/functions/prompt_sorin_setup | 28 ++++++++--------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/modules/git/functions/git-info b/modules/git/functions/git-info index 5cf88d7292..1f7063ed2c 100644 --- a/modules/git/functions/git-info +++ b/modules/git/functions/git-info @@ -266,21 +266,21 @@ function git-info { # Format commit. commit="$(git rev-parse HEAD 2> /dev/null)" if [[ -n "$commit" ]]; then - zstyle -s ':prezto:module:git' commit 'commit_format' + zstyle -s ':prezto:module:git:info:commit' format 'commit_format' zformat -f commit_formatted "$commit_format" "c:$commit" fi # Format stashed. if [[ -f "$(git-dir)/refs/stash" ]]; then stashed="$(git stash list 2> /dev/null | wc -l | awk '{print $1}')" - zstyle -s ':prezto:module:git' stashed 'stashed_format' + zstyle -s ':prezto:module:git:info:stashed' format 'stashed_format' zformat -f stashed_formatted "$stashed_format" "S:$stashed" fi # Format action. action="$(_git-action)" if [[ -n "$action" ]]; then - zstyle -s ':prezto:module:git' action 'action_format' + zstyle -s ':prezto:module:git:info:action' format 'action_format' zformat -f action_formatted "$action_format" "s:$action" fi @@ -301,13 +301,13 @@ function git-info { # Format branch. branch="${$(git symbolic-ref -q HEAD)##refs/heads/}" if [[ -n "$branch" ]]; then - zstyle -s ':prezto:module:git' branch 'branch_format' + zstyle -s ':prezto:module:git:info:branch' format 'branch_format' zformat -f branch_formatted "$branch_format" "b:$branch" # Format remote. remote="${$(${(z)remote_cmd} 2> /dev/null)##refs/remotes/}" if [[ -n "$remote" ]]; then - zstyle -s ':prezto:module:git' remote 'remote_format' + zstyle -s ':prezto:module:git:info:remote' format 'remote_format' zformat -f remote_formatted "$remote_format" "R:$remote" # Get ahead and behind counts. @@ -316,14 +316,14 @@ function git-info { # Format ahead. ahead="$ahead_and_behind[(w)1]" if (( $ahead > 0 )); then - zstyle -s ':prezto:module:git' ahead 'ahead_format' + zstyle -s ':prezto:module:git:info:ahead' format 'ahead_format' zformat -f ahead_formatted "$ahead_format" "A:$ahead" fi # Format behind. behind="$ahead_and_behind[(w)2]" if (( $behind > 0 )); then - zstyle -s ':prezto:module:git' behind 'behind_format' + zstyle -s ':prezto:module:git:info:behind' format 'behind_format' zformat -f behind_formatted "$behind_format" "B:$behind" fi fi @@ -331,57 +331,57 @@ function git-info { # Format position. position="$(git describe --contains --all HEAD 2> /dev/null)" if [[ -n "$position" ]]; then - zstyle -s ':prezto:module:git' position 'position_format' + zstyle -s ':prezto:module:git:info:position' format 'position_format' zformat -f position_formatted "$position_format" "p:$position" fi fi # Format added. if (( $added > 0 )); then - zstyle -s ':prezto:module:git' added 'added_format' + zstyle -s ':prezto:module:git:info:added' format 'added_format' zformat -f added_formatted "$added_format" "a:$added_format" fi # Format deleted. if (( $deleted > 0 )); then - zstyle -s ':prezto:module:git' deleted 'deleted_format' + zstyle -s ':prezto:module:git:info:deleted' format 'deleted_format' zformat -f deleted_formatted "$deleted_format" "d:$deleted_format" fi # Format modified. if (( $modified > 0 )); then - zstyle -s ':prezto:module:git' modified 'modified_format' + zstyle -s ':prezto:module:git:info:modified' format 'modified_format' zformat -f modified_formatted "$modified_format" "m:$modified" fi # Format renamed. if (( $renamed > 0 )); then - zstyle -s ':prezto:module:git' renamed 'renamed_format' + zstyle -s ':prezto:module:git:info:renamed' format 'renamed_format' zformat -f renamed_formatted "$renamed_format" "r:$renamed" fi # Format unmerged. if (( $unmerged > 0 )); then - zstyle -s ':prezto:module:git' unmerged 'unmerged_format' + zstyle -s ':prezto:module:git:info:unmerged' format 'unmerged_format' zformat -f unmerged_formatted "$unmerged_format" "U:$unmerged" fi # Format untracked. if (( $untracked > 0 )); then - zstyle -s ':prezto:module:git' untracked 'untracked_format' + zstyle -s ':prezto:module:git:info:untracked' format 'untracked_format' zformat -f untracked_formatted "$untracked_format" "u:$untracked" fi # Format dirty and clean. if (( $dirty > 0 )); then - zstyle -s ':prezto:module:git' dirty 'dirty_format' + zstyle -s ':prezto:module:git:info:dirty' format 'dirty_format' zformat -f dirty_formatted "$dirty_format" "D:$dirty" else - zstyle -s ':prezto:module:git' clean 'clean_formatted' + zstyle -s ':prezto:module:git:info:clean' format 'clean_formatted' fi # Format info. - zstyle -a ':prezto:module:git' info 'info_formats' + zstyle -a ':prezto:module:git:info:keys' format 'info_formats' for info_format in ${(k)info_formats}; do zformat -f REPLY "$info_formats[$info_format]" \ "A:$ahead_formatted" \ diff --git a/modules/prompt/functions/prompt_sorin_setup b/modules/prompt/functions/prompt_sorin_setup index cbb9440c26..3c2c55f5b3 100644 --- a/modules/prompt/functions/prompt_sorin_setup +++ b/modules/prompt/functions/prompt_sorin_setup @@ -50,20 +50,20 @@ function prompt_sorin_setup { zstyle ':prezto:module:editor:info:keymap:primary' format ' %B%F{red}❯%F{yellow}❯%F{green}❯%f%b' zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format ' %F{red}♺%f' zstyle ':prezto:module:editor:info:keymap:alternate' format ' %B%F{green}❮%F{yellow}❮%F{red}❮%f%b' - zstyle ':prezto:module:git' action ':%%B%F{yellow}%s%f%%b' - zstyle ':prezto:module:git' added ' %%B%F{green}✚%f%%b' - zstyle ':prezto:module:git' ahead ' %%B%F{yellow}⬆%f%%b' - zstyle ':prezto:module:git' behind ' %%B%F{yellow}⬇%f%%b' - zstyle ':prezto:module:git' branch ':%F{green}%b%f' - zstyle ':prezto:module:git' commit ':%F{green}%.7c%f' - zstyle ':prezto:module:git' deleted ' %%B%F{red}✖%f%%b' - zstyle ':prezto:module:git' modified ' %%B%F{blue}✱%f%%b' - zstyle ':prezto:module:git' position ':%F{green}%p%f' - zstyle ':prezto:module:git' renamed ' %%B%F{magenta}➜%f%%b' - zstyle ':prezto:module:git' stashed ' %%B%F{cyan}✭%f%%b' - zstyle ':prezto:module:git' unmerged ' %%B%F{yellow}═%f%%b' - zstyle ':prezto:module:git' untracked ' %%B%F{white}◼%f%%b' - zstyle ':prezto:module:git' info \ + zstyle ':prezto:module:git:info:action' format ':%%B%F{yellow}%s%f%%b' + zstyle ':prezto:module:git:info:added' format ' %%B%F{green}✚%f%%b' + zstyle ':prezto:module:git:info:ahead' format ' %%B%F{yellow}⬆%f%%b' + zstyle ':prezto:module:git:info:behind' format ' %%B%F{yellow}⬇%f%%b' + zstyle ':prezto:module:git:info:branch' format ':%F{green}%b%f' + zstyle ':prezto:module:git:info:commit' format ':%F{green}%.7c%f' + zstyle ':prezto:module:git:info:deleted' format ' %%B%F{red}✖%f%%b' + zstyle ':prezto:module:git:info:modified' format ' %%B%F{blue}✱%f%%b' + zstyle ':prezto:module:git:info:position' format ':%F{green}%p%f' + zstyle ':prezto:module:git:info:renamed' format ' %%B%F{magenta}➜%f%%b' + zstyle ':prezto:module:git:info:stashed' format ' %%B%F{cyan}✭%f%%b' + zstyle ':prezto:module:git:info:unmerged' format ' %%B%F{yellow}═%f%%b' + zstyle ':prezto:module:git:info:untracked' format ' %%B%F{white}◼%f%%b' + zstyle ':prezto:module:git:info:keys' format \ 'prompt' ' %F{blue}git%f$(coalesce "%b" "%p" "%c")%s' \ 'rprompt' '%A%B%S%a%d%m%r%U%u' From 5b2dcb884481f82dfdea6b2495b8525a17c23156 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 1 Oct 2012 22:14:33 -0400 Subject: [PATCH 49/56] Rename gk prefixed aliases to gC --- modules/git/alias.zsh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/git/alias.zsh b/modules/git/alias.zsh index 4e47ea9de3..f67dd69cea 100644 --- a/modules/git/alias.zsh +++ b/modules/git/alias.zsh @@ -81,14 +81,14 @@ alias giR='git reset --keep' alias gix='git rm -r --cached' alias giX='git rm -rf --cached' -# Konflict (k) -alias gkl='git status | sed -n "s/^.*both [a-z]*ed: *//p"' -alias gka='git add $(gkl)' -alias gke='git mergetool $(gkl)' -alias gko='git checkout --ours --' -alias gkO='gko $(gkl)' -alias gkt='git checkout --theirs --' -alias gkT='gkt $(gkl)' +# Conflict (C) +alias gCl='git status | sed -n "s/^.*both [a-z]*ed: *//p"' +alias gCa='git add $(gCl)' +alias gCe='git mergetool $(gCl)' +alias gCo='git checkout --ours --' +alias gCO='gCo $(gCl)' +alias gCt='git checkout --theirs --' +alias gCT='gCt $(gCl)' # Log (l) git_log_format_medium='--pretty=format:%C(bold)Commit:%C(reset) %C(green)%H%C(red)%d%n%C(bold)Author:%C(reset) %C(cyan)%an <%ae>%n%C(bold)Date:%C(reset) %C(blue)%ai (%ar)%C(reset)%n%+B' From 3f4d5fac0c10fafd1eb6581a73b78df23a88a186 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 1 Oct 2012 22:26:24 -0400 Subject: [PATCH 50/56] Add zstyles for git-log formats --- modules/git/alias.zsh | 24 ++++++++++++++---------- modules/git/functions/git-commit-lost | 2 +- modules/git/functions/git-stash-dropped | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/modules/git/alias.zsh b/modules/git/alias.zsh index f67dd69cea..8d84d92387 100644 --- a/modules/git/alias.zsh +++ b/modules/git/alias.zsh @@ -10,6 +10,14 @@ # # +# Log +zstyle -s ':prezto:module:git:log:medium' format '_git_log_medium_format' \ + || _git_log_medium_format='%C(bold)Commit:%C(reset) %C(green)%H%C(red)%d%n%C(bold)Author:%C(reset) %C(cyan)%an <%ae>%n%C(bold)Date:%C(reset) %C(blue)%ai (%ar)%C(reset)%n%+B' +zstyle -s ':prezto:module:git:log:oneline' format '_git_log_oneline_format' \ + || _git_log_oneline_format='%C(green)%h%C(reset) %s%C(red)%d%C(reset)%n' +zstyle -s ':prezto:module:git:log:brief' format '_git_log_brief_format' \ + || _git_log_brief_format='%C(green)%h%C(reset) %s%n%C(blue)(%ar by %an)%C(red)%d%C(reset)%n' + # Status zstyle -s ':prezto:module:git:status:ignore' submodules '_git_status_ignore_submodules' \ || _git_status_ignore_submodules='none' @@ -91,16 +99,12 @@ alias gCt='git checkout --theirs --' alias gCT='gCt $(gCl)' # Log (l) -git_log_format_medium='--pretty=format:%C(bold)Commit:%C(reset) %C(green)%H%C(red)%d%n%C(bold)Author:%C(reset) %C(cyan)%an <%ae>%n%C(bold)Date:%C(reset) %C(blue)%ai (%ar)%C(reset)%n%+B' -git_log_format_oneline='--pretty=format:%C(green)%h%C(reset) %s%C(red)%d%C(reset)%n' -git_log_format_brief='--pretty=format:%C(green)%h%C(reset) %s%n%C(blue)(%ar by %an)%C(red)%d%C(reset)%n' - -alias gl='git log --topo-order ${git_log_format_medium}' -alias gls='git log --topo-order --stat ${git_log_format_medium}' -alias gld='git log --topo-order --stat --patch --full-diff ${git_log_format_medium}' -alias glo='git log --topo-order ${git_log_format_oneline}' -alias glg='git log --topo-order --all --graph ${git_log_format_oneline}' -alias glb='git log --topo-order ${git_log_format_brief}' +alias gl='git log --topo-order --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 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 glb='git log --topo-order --pretty=format:${_git_log_brief_format}' alias glc='git shortlog --summary --numbered' # Merge (m) diff --git a/modules/git/functions/git-commit-lost b/modules/git/functions/git-commit-lost index 0984ab923c..e4075c9b75 100644 --- a/modules/git/functions/git-commit-lost +++ b/modules/git/functions/git-commit-lost @@ -17,5 +17,5 @@ git fsck 2> /dev/null \ --date-order \ --no-walk \ --stdin \ - ${git_log_format_oneline} + --pretty=format:${_git_log_oneline_format} diff --git a/modules/git/functions/git-stash-dropped b/modules/git/functions/git-stash-dropped index 9867ad04a9..26229263b4 100644 --- a/modules/git/functions/git-stash-dropped +++ b/modules/git/functions/git-stash-dropped @@ -14,7 +14,7 @@ git fsck --unreachable 2> /dev/null \ | grep 'commit' \ | awk '{print $3}' \ | git log \ - ${git_log_format_oneline} \ + --pretty=format:${_git_log_oneline_format} \ --extended-regexp \ --grep="${1:-(WIP )?[Oo]n [^:]+:}" \ --merges \ From be300dbd80529ffa8c845338148055d09c5e24c5 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 1 Oct 2012 22:48:13 -0400 Subject: [PATCH 51/56] [Fix #96] Add documentation for git --- modules/git/README.md | 298 +++++++++++++++++++++++++++++++++ modules/git/functions/git-dir | 2 +- modules/git/functions/git-info | 59 ------- modules/git/functions/git-root | 2 +- 4 files changed, 300 insertions(+), 61 deletions(-) create mode 100644 modules/git/README.md diff --git a/modules/git/README.md b/modules/git/README.md new file mode 100644 index 0000000000..869aeb9b65 --- /dev/null +++ b/modules/git/README.md @@ -0,0 +1,298 @@ +Git +=== + +Enhances the [Git][1] distributed version control system by providing aliases, functions and by exposing repository status information to prompts. + +Git **1.7.2** is the [minimum required version][7]. + +Settings +-------- + +### Log + +The format of the [git-log][8] output is configurable via the following styles, +which will be passed to the `--prety=format:` switch. + + zstyle ':prezto:module:git:log:brief' format '' + zstyle ':prezto:module:git:log:oneline' format '' + zstyle ':prezto:module:git:log:medium' format '' + +### Status + +Retrieving the status of a repository with submodules can take a long time. +Submodules may be ignored when they are *dirty*, *untracked*, *all*, or *none*. + + zstyle ':prezto:module:git:status:ignore' submodules 'all' + +This setting affects all aliases and functions that call `git-status`. + +Aliases +------- + +### Git + + - `g` is short for `git`. + +### Branch + + - `gb` lists, creates, renames, and deletes branches. + - `gbc` creates a new branch. + - `gbl` lists branches and their commits. + - `gbL` lists local and remote branches and their commits. + - `gbs` lists branches and their commits with ancestery graphs. + - `gbS` lists local and remote branches and their commits with ancestery + graphs. + - `gbx` deletes a branch. + - `gbX` deletes a branch irrespective of its merged status. + - `gbm` renames a branch. + - `gbM` renames a branch even if the new branch name already exists. + + +### Commit + + - `gc` records changes to the repository. + - `gca` stages all modified and deleted files. + - `gcm` records changes to the repository with the given message. + - `gco` checks out a branch or paths to work tree. + - `gcO` checks out paths to work tree using the *HEAD* commit. + - `gcf` amends the tip of the current branch using the same log message as + *HEAD*. + - `gcp` applies changes introduced by existing commits. + - `gcP` applies changes introduced by existing commits without committing. + - `gcr` reverts existing commits by reverting patches and recording new + commits. + - `gcR` removes the *HEAD* commit. + - `gcs` displays various types of objects. + - `gcl` displays lost commits. + +### Data + + - `gd` displays information about files in the index and the work tree. + - `gdc` lists cached files. + - `gdx` lists deleted files. + - `gdm` lists modified files. + - `gdu` lists untracked files. + - `gdk` lists killed files. + - `gdi` lists ignored files. + +### Fetch + + - `gf` downloads objects and references from another repository. + - `gfc` clones a repository into a new directory. + - `gfm` fetches from and merges with another repository or local branch. + - `gfr` fetches from and rebases on another repository or local branch. + +### Grep + + - `gg` displays lines matching a pattern. + - `ggi` displays lines matching a pattern ignoring case. + - `ggl` displays files matching a pattern. + - `ggL` displays files are not matching a pattern. + - `ggv` displays lines not matching a pattern. + - `ggw` displays lines matching a pattern at word boundary. + +### Index + + - `gia` adds file contents to the index. + - `giA` adds file contents to the index interactively. + - `giu` adds file contents to the index (updates only known files). + - `gid` displays changes between the index and a named commit (diff). + - `giD` displays changes between the index and a named commit (word diff). + - `gir` resets current HEAD to the specified state. + - `giR` resets current index to the specified state. + - `gix` removes files/directories from the index (recursively). + - `giX` removes files/directories from the index (recursively and forced). + +### Conflict + + - `gCl` lists unmerged files. + - `gCa` adds unmerged file contents to the index. + - `gCe` executes merge-tool on all unmerged file. + - `gCo` checks out our changes for unmerged paths. + - `gCO` checks out our changes for all unmerged paths. + - `gCt` checks out their changes for unmerged paths. + - `gCT` checks out their changes for all unmerged paths. + +### Log + + - `gl` displays the log. + - `gls` displays the stats log. + - `gld` displays the diff log. + - `glo` displays the one line log. + - `glg` displays the graph log. + - `glb` displays the brief commit log. + - `glc` displays the commit count for each contributor in descending order. + +### Merge + + - `gm` joins two or more development histories together. + - `gmC` joins two or more development histories together but does not commit. + - `gmF` joins two or more development histories together but does not commit + generating a merge commit even if the merge resolved as a fast-forward. + - `gma` aborts the conflict resolution, and reconstructs the pre-merge state. + - `gmt` runs the merge conflict resolution tools to resolve conflicts. + +### Push + + - `gp` updates remote refs along with associated objects. + - `gpf` forcefully updates remote refs along with associated objects. + - `gpa` updates remote branches along with associated objects. + - `gpA` updates remote branches and tags along with associated objects. + - `gpt` updates remote tags along with associated objects. + - `gpc` updates remote refs along with associated objects and adds *origin* + as an upstream reference for the current branch. + - `gpp` pulls and pushes from origin to origin. + +### Rebase + + - `gr` forward-ports local commits to the updated upstream head. + - `gra` aborts the rebase. + - `grc` continues the rebase after merge conflicts are resolved. + - `gri` makes a list of commits to be rebased and opens the editor. + - `grs` skips the current patch. + +### Remote + + - `gR` manages tracked repositories. + - `gRl` displays remote names and URLs. + - `gRa` adds a new remote. + - `gRx` removes a remote. + - `gRm` renames a remote. + - `gRu` fetches remotes updates. + - `gRc` deletes all stale remote tracking branches. + - `gRs` displays information about a given remote. + - `gRb` opens a remote on [GitHub][3] in the default browser. + +### Stash + + - `gs` stashes the changes of the dirty working directory. + - `gsa` applies the changes recorded in a stash to the working directory. + - `gsx` drops a stashed state. + - `gsX` drops all the stashed states. + - `gsd` lists dropped stashed states. + - `gsl` lists stashed states. + - `gsL` displays the changes recorded in the stash as a diff between the + stashed state and its original parent. + - `gsp` removes and applies a single stashed state from the stash list. + - `gsr` recovers a given stashed state. + - `gss` stashes the changes of the dirty working directory, including untracked. + - `gsS` stashes the changes of the dirty working directory interactively. + - `gsw` stashes the changes of the dirty working directory retaining the index. + +### Submodule + + - `gS` initializes, updates, or inspects submodules. + - `gSa` adds given a repository as a submodule. + - `gSf` evaluates a shell command in each of checked out submodules. + - `gSi` initializes submodules. + - `gSI` initializes and clones submodules recursively. + - `gSl` lists the commits of all submodules. + - `gSm` moves a submodule. + - `gSs` synchronizes submodules' remote URL to the value specified in + .gitmodules. + - `gSu` fetches and merges the latest changes for all submodule. + - `gSx` removes a submodule. + +### Working directory + + - `gws` displays working-tree status in the short format. + - `gwS` displays working-tree status. + - `gwd` displays changes between the working tree and the index (diff). + - `gwD` displays changes between the working tree and the index (word diff). + - `gwr` resets the current HEAD to the specified state, does not touch the + 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. + - `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. + +### Shadows + +The following aliases may shadow system commands: + + - `gpt` shadows the [GUID partition table maintenance utility][4]. + - `gs` shadows the [Ghostscript][5]. + +If you frequently use the above commands, you may wish to remove said aliases +from this module or to disable them at the bottom of the zshrc with `unalias`. + +You can temporarily bypass an alias by prefixing it with a backward slash: +`\gpt`. + +Functions +--------- + + - `git-branch-current` displays the current branch. + - `git-commit-lost` lists lost commits. + - `git-dir` displays the path to the Git directory. + - `git-hub-browse` opens the [GitHub][3] repository in the default browser. + - `git-hub-shorten-url` shortens GitHub URLs. + - `git-info` exposes repository information via the `$git_info` associative + array. + - `git-root` displays the path to the working tree root. + - `git-stash-clear-interactive` asks for confirmation before clearing the stash. + - `git-stash-dropped` lists dropped stashed states. + - `git-stash-recover` recovers given dropped stashed states. + - `git-submodule-move` moves a submodule. + - `git-submodule-remove` removes a submodule. + +Theming +------- + +To display information about the current repository in a prompt, define the +following styles in the `prompt_name_setup` function. + +| Name | Format Code | Content +| --------- | :---------: | --------------------------------------------------- +| action | %s | Special action name +| added | %a | Added files count +| ahead | %A | Commits ahead of remote count +| behind | %B | Commits behind of remote count +| branch | %b | Branch name +| commit | %c | Commit hash +| clean | %C | Clean state +| deleted | %d | Deleted files count +| dirty | %D | Dirty files count +| modified | %m | Modified files count +| position | %p | Commits from the nearest tag count +| remote | %R | Remote name +| renamed | %r | Renamed files count +| stashed | %S | Stashed states count +| unmerged | %U | Unmerged files count +| untracked | %u | Untracked files count + +First, format the repository state attributes. For example, to format the branch +and remote names, define the following styles. + + zstyle ':prezto:module:git:info:branch' format 'branch:%b' + zstyle ':prezto:module:git:info:remote' format 'remote:%R' + +Second, format how the above attributes are displayed in prompts. + + zstyle ':prezto:module:git:info:keys' format \ + 'prompt' ' git(%b)' \ + 'rprompt' '[%R]' + +Last, add `$git_info[prompt]` to `$PROMPT` and `$git_info[prompt]` to +`$RPROMPT` respectively and call `git-info` in the `prompt_name_preexec` hook +function. + +Authors +------- + +*The authors of this module should be contacted via the [issue tracker][6].* + + - [Sorin Ionescu](https://github.com/sorin-ionescu) + - [Colin Hebert](https://github.com/ColinHebert) + +[1]: http://www.git-scm.com +[2]: https://github.com/defunkt/hub +[3]: https://www.github.com +[4]: http://www.manpagez.com/man/8/gpt/ +[5]: http://linux.die.net/man/1/gs +[6]: https://github.com/sorin-ionescu/prezto/issues +[7]: https://github.com/sorin-ionescu/prezto/issues/219 +[8]: http://www.kernel.org/pub/software/scm/git/docs/git-log.html + diff --git a/modules/git/functions/git-dir b/modules/git/functions/git-dir index 79b36d7bf4..2e40e9eace 100644 --- a/modules/git/functions/git-dir +++ b/modules/git/functions/git-dir @@ -1,5 +1,5 @@ # -# Gets the path to the Git directory. +# Displays the path to the Git directory. # # Authors: # Sorin Ionescu diff --git a/modules/git/functions/git-info b/modules/git/functions/git-info index 1f7063ed2c..9c99ad47c5 100644 --- a/modules/git/functions/git-info +++ b/modules/git/functions/git-info @@ -4,65 +4,6 @@ # Authors: # Sorin Ionescu # -# Usage: -# Define the following styles in a prompt theme setup function. -# -# # %s - Special action name (am, merge, rebase). -# zstyle ':prezto:module:git' action 'action:%s' -# -# # %a - Indicator to notify of added files. -# zstyle ':prezto:module:git' added 'added:%a' -# -# # %A - Indicator to notify of ahead branch. -# zstyle ':prezto:module:git' ahead 'ahead:%A' -# -# # %B - Indicator to notify of behind branch. -# zstyle ':prezto:module:git' behind 'behind:%B' -# -# # %b - Branch name. -# zstyle ':prezto:module:git' branch 'branch:%b' -# -# # %C - Indicator to notify of a clean working directory. -# zstyle ':prezto:module:git' clean 'clean' -# -# # %c - SHA-1 hash. -# zstyle ':prezto:module:git' commit 'commit:%c' -# -# # %d - Indicator to notify of deleted files. -# zstyle ':prezto:module:git' deleted 'deleted:%d' -# -# # %D - Indicator to notify of dirty files. -# zstyle ':prezto:module:git' dirty 'dirty:%D' -# -# # %m - Indicator to notify of modified files. -# zstyle ':prezto:module:git' modified 'modified:%m' -# -# # %p - HEAD position in relation to the nearest branch, remote, tag. -# zstyle ':prezto:module:git' position 'position:%p' -# -# # %R - Remote name. -# zstyle ':prezto:moduleit' remote 'remote:%R' -# -# # %r - Indicator to notify of renamed files. -# zstyle ':prezto:module:git' renamed 'renamed:%r' -# -# # %S - Indicator to notify of stashed files. -# zstyle ':prezto:module:git' stashed 'stashed:%S' -# -# # %U - Indicator to notify of unmerged files. -# zstyle ':prezto:module:git' unmerged 'unmerged:%U' -# -# # %u - Indicator to notify of untracked files. -# zstyle ':prezto:module:git' untracked 'untracked:%u' -# -# # Ignore submodule when it is 'dirty', 'untracked', 'all', or 'none'. -# zstyle ':prezto:module:git:ignore' submodule '' -# -# # Prompts. -# zstyle ':prezto:module:git' info \ -# 'prompt' ' git:(%b%C%D)' \ -# 'rprompt' '' -# # Gets the Git special action (am, bisect, cherry, merge, rebase). # Borrowed from vcs_info and edited. diff --git a/modules/git/functions/git-root b/modules/git/functions/git-root index 6ba52ef418..82b74385e0 100644 --- a/modules/git/functions/git-root +++ b/modules/git/functions/git-root @@ -1,5 +1,5 @@ # -# Displays the Git repository root. +# Displays the path to the working tree root. # # Authors: # Sorin Ionescu From b36d98e43129dfaddb86c2ff29551c23162aae2c Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 2 Oct 2012 12:53:59 -0400 Subject: [PATCH 52/56] Fix the name of the theme setup function in READMEs --- modules/python/README.md | 4 ++-- modules/ruby/README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/python/README.md b/modules/python/README.md index b94fa3265f..c48f4ea3e6 100644 --- a/modules/python/README.md +++ b/modules/python/README.md @@ -86,13 +86,13 @@ Theming ------- To display the name of the current virtual enviroment in a prompt, define the -following style in the `prompt_theme_setup` function. +following style in the `prompt_name_setup` function. # %v - virtualenv name. zstyle ':prezto:module:python:info:virtualenv' format 'virtualenv:%v' Then add `$python_info[virtualenv]` to `$PROMPT` or `$RPROMPT` and call -`python-info` in the `prompt_theme_preexec` hook function. +`python-info` in the `prompt_name_preexec` hook function. Authors ------- diff --git a/modules/ruby/README.md b/modules/ruby/README.md index 4961f00d2c..42e63be6d1 100644 --- a/modules/ruby/README.md +++ b/modules/ruby/README.md @@ -66,13 +66,13 @@ Theming ------- To display the name of the current Ruby version in a prompt, define the -following style in the `prompt_theme_setup` function. +following style in the `prompt_name_setup` function. # %v - ruby version. zstyle ':prezto:module:ruby:info:version' format 'version:%v' Then add `$ruby_info[version]` to `$PROMPT` or `$RPROMPT` and call -`ruby-info` in the `prompt_theme_preexec` hook function. +`ruby-info` in the `prompt_name_preexec` hook function. Authors ------- From 4f607bb470ebe1c04a7eaeb489116d1750b4c3ad Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 2 Oct 2012 14:16:58 -0400 Subject: [PATCH 53/56] Simplify git-log zstyle documentation --- modules/git/README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/git/README.md b/modules/git/README.md index 869aeb9b65..262295ea24 100644 --- a/modules/git/README.md +++ b/modules/git/README.md @@ -10,12 +10,11 @@ Settings ### Log -The format of the [git-log][8] output is configurable via the following styles, -which will be passed to the `--prety=format:` switch. +The format of the [git-log][8] output is configurable via the following style, +where context is *brief*, *oneline*, and *medium*, which will be passed to the +`--prety=format:` switch. - zstyle ':prezto:module:git:log:brief' format '' - zstyle ':prezto:module:git:log:oneline' format '' - zstyle ':prezto:module:git:log:medium' format '' + zstyle ':prezto:module:git:log:context' format '' ### Status From cfc95cd5ee0f410437d0a6c0585b7c64a8eccc58 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 2 Oct 2012 14:18:44 -0400 Subject: [PATCH 54/56] [Fix #244] Add Git special action styles --- modules/git/README.md | 20 +++++++++++++++++-- modules/git/functions/git-info | 35 +++++++++++++++++++++++++--------- 2 files changed, 44 insertions(+), 11 deletions(-) diff --git a/modules/git/README.md b/modules/git/README.md index 262295ea24..d3ad87849a 100644 --- a/modules/git/README.md +++ b/modules/git/README.md @@ -241,9 +241,12 @@ Theming ------- To display information about the current repository in a prompt, define the -following styles in the `prompt_name_setup` function. +following styles in the `prompt_name_setup` function, where the syntax for +setting a style is as follows. -| Name | Format Code | Content + zstyle ':prezto:module:git:info:context:subcontext' format 'string' + +| Name | Format Code | Description | --------- | :---------: | --------------------------------------------------- | action | %s | Special action name | added | %a | Added files count @@ -261,6 +264,19 @@ following styles in the `prompt_name_setup` function. | stashed | %S | Stashed states count | unmerged | %U | Unmerged files count | untracked | %u | Untracked files count +[**Main Contexts**] + +| Name | Format | Description +| -------------------- | :---------: | ----------------------------------------- +| apply | value | Applying patches +| bisect | value | Binary searching for changes +| cherry-pick | value | Cherry picking +| cherry-pick-sequence | value | Cherry picking sequence +| merge | value | Merging +| rebase | value | Rebasing +| rebase-interactive | value | Rebasing interactively +| rebase-merge | value | Rebasing merge +[**Special Action Contexts**] First, format the repository state attributes. For example, to format the branch and remote names, define the following styles. diff --git a/modules/git/functions/git-info b/modules/git/functions/git-info index 9c99ad47c5..2e52eab393 100644 --- a/modules/git/functions/git-info +++ b/modules/git/functions/git-info @@ -10,6 +10,14 @@ function _git-action { local action_dir local git_dir="$(git-dir)" + local apply_formatted + local bisect_formatted + local cherry_pick_formatted + local cherry_pick_sequence_formatted + local merge_formatted + local rebase_formatted + local rebase_interactive_formatted + local rebase_merge_formatted for action_dir in \ "${git_dir}/rebase-apply" \ @@ -17,12 +25,15 @@ function _git-action { "${git_dir}/../.dotest" do if [[ -d "$action_dir" ]] ; then + zstyle -s ':prezto:module:git:info:action:apply' format 'apply_formatted' || apply_formatted='apply' + zstyle -s ':prezto:module:git:info:action:rebase' format 'rebase_formatted' || rebase_formatted='rebase' + if [[ -f "${action_dir}/rebasing" ]] ; then - print 'rebase' + print "$rebase_formatted" elif [[ -f "${action_dir}/applying" ]] ; then - print 'am' + print "$apply_formatted" else - print 'am/rebase' + print "${rebase_formatted}/${apply_formatted}" fi return 0 @@ -34,7 +45,8 @@ function _git-action { "${git_dir}/.dotest-merge/interactive" do if [[ -f "$action_dir" ]]; then - print 'rebase-i' + zstyle -s ':prezto:module:git:info:action:rebase-interactive' format 'rebase_interactive_formatted' || rebase_interactive_formatted='rebase-interactive' + print "$rebase_interactive_formatted" return 0 fi done @@ -44,28 +56,33 @@ function _git-action { "${git_dir}/.dotest-merge" do if [[ -d "$action_dir" ]]; then - print 'rebase-m' + zstyle -s ':prezto:module:git:info:action:rebase-merge' format 'rebase_merge_formatted' || rebase_merge_formatted='rebase-merge' + print "$rebase_merge_formatted" return 0 fi done if [[ -f "${git_dir}/MERGE_HEAD" ]]; then - print 'merge' + zstyle -s ':prezto:module:git:info:action:merge' format 'merge_formatted' || merge_formatted='merge' + print "$merge_formatted" return 0 fi if [[ -f "${git_dir}/CHERRY_PICK_HEAD" ]]; then if [[ -d "${git_dir}/sequencer" ]] ; then - print 'cherry-seq' + zstyle -s ':prezto:module:git:info:action:cherry-pick-sequence' format 'cherry_pick_sequence_formatted' || cherry_pick_sequence_formatted='cherry-pick-sequence' + print "$cherry_pick_sequence_formatted" else - print 'cherry' + zstyle -s ':prezto:module:git:info:action:cherry-pick' format 'cherry_pick_formatted' || cherry_pick_formatted='cherry-pick' + print "$cherry_pick_formatted" fi return 0 fi if [[ -f "${git_dir}/BISECT_LOG" ]]; then - print 'bisect' + zstyle -s ':prezto:module:git:info:action:bisect' format 'bisect_formatted' || bisect_formatted='bisect' + print "$bisect_formatted" return 0 fi From 1ed7fd360c73b402e41ad550133d283f54ad8200 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 3 Oct 2012 16:40:34 -0400 Subject: [PATCH 55/56] Replace z with fasd in modules README See b967c50 and 24bb99c for more information. --- modules/README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/README.md b/modules/README.md index 9e048d2ffa..79a472536b 100644 --- a/modules/README.md +++ b/modules/README.md @@ -36,6 +36,11 @@ Environment Sets general shell options and defines environment variables. +Fasd +---- + +Maintains a frequently used file and directory list for fast access. + GNU Utility ----------- @@ -162,9 +167,3 @@ Yum Defines yum aliases. -Z -- - -Integrates z into Prezto, which maintains a frequently used directory list for -fast directory changes. - From bb597ae22d69fc10fefdaebb31073a09c3e6830f Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 3 Oct 2012 20:09:48 -0400 Subject: [PATCH 56/56] Replace table captions with headings GitHub does not support Markdown table captions. --- modules/git/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/git/README.md b/modules/git/README.md index d3ad87849a..806bc9ca15 100644 --- a/modules/git/README.md +++ b/modules/git/README.md @@ -246,6 +246,8 @@ setting a style is as follows. zstyle ':prezto:module:git:info:context:subcontext' format 'string' +### Main Contexts + | Name | Format Code | Description | --------- | :---------: | --------------------------------------------------- | action | %s | Special action name @@ -264,7 +266,8 @@ setting a style is as follows. | stashed | %S | Stashed states count | unmerged | %U | Unmerged files count | untracked | %u | Untracked files count -[**Main Contexts**] + +### Special Action Contexts | Name | Format | Description | -------------------- | :---------: | ----------------------------------------- @@ -276,7 +279,6 @@ setting a style is as follows. | rebase | value | Rebasing | rebase-interactive | value | Rebasing interactively | rebase-merge | value | Rebasing merge -[**Special Action Contexts**] First, format the repository state attributes. For example, to format the branch and remote names, define the following styles.