mirror of
https://github.com/dcarrillo/prezto.git
synced 2025-07-01 09:19:25 +00:00
Compare commits
27 Commits
pull/556-p
...
module/git
Author | SHA1 | Date | |
---|---|---|---|
729fd07ab0 | |||
9d97ee57a3 | |||
8de68a9bda | |||
8f711d64b5 | |||
c4b50ec1a0 | |||
62198b0326 | |||
b4884d4d45 | |||
abfc4ab6e5 | |||
657e8a16f4 | |||
ea25ccf62c | |||
3e88b8bcdc | |||
e892d7f3c7 | |||
4e4a6fcc63 | |||
3e8349ddde | |||
fdb406f917 | |||
493bf302f6 | |||
a217af99f3 | |||
06cc5088aa | |||
5088ca4839 | |||
0f696fc206 | |||
96bcf813b7 | |||
fe8f9a9b5b | |||
bf9dbfd5b9 | |||
ff0dfa424d | |||
fedad8e9cf | |||
478653fab2 | |||
10cf701864 |
@ -8,8 +8,8 @@ and prompt themes.
|
||||
Installation
|
||||
------------
|
||||
|
||||
Prezto will work with any recent release of Zsh, but the minimum recommended
|
||||
version is 4.3.11.
|
||||
Prezto will work with any recent release of Zsh, but the minimum required
|
||||
version is 4.3.17.
|
||||
|
||||
1. Launch Zsh:
|
||||
|
||||
|
2
init.zsh
2
init.zsh
@ -10,7 +10,7 @@
|
||||
#
|
||||
|
||||
# Check for the minimum supported version.
|
||||
min_zsh_version='4.3.11'
|
||||
min_zsh_version='4.3.17'
|
||||
if ! autoload -Uz is-at-least || ! is-at-least "$min_zsh_version"; then
|
||||
print "prezto: old shell detected, minimum required: $min_zsh_version" >&2
|
||||
return 1
|
||||
|
@ -102,10 +102,10 @@ Node.js
|
||||
|
||||
Provides utility functions for Node.js and loads npm completion.
|
||||
|
||||
Ocaml
|
||||
OCaml
|
||||
-----
|
||||
|
||||
Initializes Ocaml package management.
|
||||
Initializes OCaml package management.
|
||||
|
||||
OSX
|
||||
---
|
||||
|
@ -54,8 +54,8 @@ while (( $# > 0 )); do
|
||||
(*.Z) uncompress "$1" ;;
|
||||
(*.zip) unzip "$1" -d $extract_dir ;;
|
||||
(*.rar) unrar &> /dev/null \
|
||||
&& unrar e -ad "$1" \
|
||||
|| rar e -ad "$1" ;;
|
||||
&& unrar x -ad "$1" \
|
||||
|| rar x -ad "$1" ;;
|
||||
(*.7z) 7za x "$1" ;;
|
||||
(*.deb)
|
||||
mkdir -p "$extract_dir/control"
|
||||
|
Submodule modules/completion/external updated: 1d6a2aa024...08afea0e23
@ -116,7 +116,7 @@ zstyle ':completion:*:(rm|kill|diff):*' ignore-line other
|
||||
zstyle ':completion:*:rm:*' file-patterns '*:all-files'
|
||||
|
||||
# Kill
|
||||
zstyle ':completion:*:*:*:*:processes' command 'ps -u $USER -o pid,user,comm -w'
|
||||
zstyle ':completion:*:*:*:*:processes' command 'ps -u $USER -o pid,user,command -w'
|
||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;36=0=01'
|
||||
zstyle ':completion:*:*:kill:*' menu yes select
|
||||
zstyle ':completion:*:*:kill:*' force-list always
|
||||
|
@ -49,8 +49,7 @@ To indicate when the editor is completing, add the following to your
|
||||
zstyle ':prezto:module:editor:info:completing' format '...'
|
||||
|
||||
Then add `$editor_info[context]`, where context is *keymap*, *insert*, or
|
||||
*overwrite*, to `$PROMPT` or `$RPROMPT` and call `editor-info` in the
|
||||
`prompt_name_preexec` hook function.
|
||||
*overwrite*, to `$PROMPT` or `$RPROMPT`.
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
@ -61,7 +61,7 @@ key_info=(
|
||||
# bindkey failure.
|
||||
for key in "${(k)key_info[@]}"; do
|
||||
if [[ -z "$key_info[$key]" ]]; then
|
||||
key_info["$key"]='<27>'
|
||||
key_info[$key]='<27>'
|
||||
fi
|
||||
done
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
@ -21,7 +21,7 @@ _arguments -C -s -S \
|
||||
|
||||
case "$state" in
|
||||
(remote)
|
||||
remotes=($(git config --get-regexp 'remote.*.url' | cut -d. -f2))
|
||||
remotes=($(command git config --get-regexp 'remote.*.url' | cut -d. -f2))
|
||||
|
||||
_describe -t branch 'remotes' remotes && ret=0
|
||||
;;
|
||||
@ -29,7 +29,7 @@ case "$state" in
|
||||
remote="$words[(($CURRENT - 1))]"
|
||||
|
||||
branches_or_tags=($(
|
||||
git ls-remote --heads --tags "$remote" 2>/dev/null | cut -f2
|
||||
command git ls-remote --heads --tags "$remote" 2>/dev/null | cut -f2
|
||||
))
|
||||
|
||||
branches=(HEAD ${${(M)branches_or_tags[@]##refs/heads/?##}##refs/heads/})
|
||||
@ -39,7 +39,7 @@ case "$state" in
|
||||
_describe -t tag 'tags' tags && ret=0
|
||||
;;
|
||||
(file)
|
||||
files=(${(0)"$(_call_program files git ls-files -z --exclude-standard 2>/dev/null)"})
|
||||
files=(${(0)"$(_call_program files command git ls-files -z --exclude-standard 2>/dev/null)"})
|
||||
_wanted file expl 'file' _multi_parts - / files && ret=0
|
||||
;;
|
||||
esac
|
||||
|
@ -8,7 +8,7 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
@ -25,7 +25,7 @@ case "$state" in
|
||||
while IFS=$'\n' read submodule; do
|
||||
submodules+=("$submodule")
|
||||
done < <(
|
||||
git config --file "$(git-root)/.gitmodules" --list \
|
||||
command git config --file "$(git-root)/.gitmodules" --list \
|
||||
| grep '.path=' \
|
||||
| cut -d= -f2-
|
||||
)
|
||||
|
@ -8,7 +8,7 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
@ -18,7 +18,7 @@ local submodule
|
||||
while IFS=$'\n' read submodule; do
|
||||
submodules+=("$submodule")
|
||||
done < <(
|
||||
git config --file "$(git-root)/.gitmodules" --list \
|
||||
command git config --file "$(git-root)/.gitmodules" --list \
|
||||
| grep '.path=' \
|
||||
| cut -d= -f2-
|
||||
)
|
||||
|
@ -5,12 +5,12 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
if ! git rev-parse 2> /dev/null; then
|
||||
if ! command git rev-parse 2> /dev/null; then
|
||||
print "$0: not a repository: $PWD" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local ref="$(git symbolic-ref HEAD 2> /dev/null)"
|
||||
local ref="$(command git symbolic-ref HEAD 2> /dev/null)"
|
||||
|
||||
if [[ -n "$ref" ]]; then
|
||||
print "${ref#refs/heads/}"
|
||||
|
@ -5,15 +5,15 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
print "$0: not a repository work tree: $PWD" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
git fsck 2> /dev/null \
|
||||
command git fsck 2> /dev/null \
|
||||
| grep "^dangling commit" \
|
||||
| awk '{print $3}' \
|
||||
| git log \
|
||||
| command git log \
|
||||
--date-order \
|
||||
--no-walk \
|
||||
--stdin \
|
||||
|
@ -5,7 +5,7 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
local git_dir="${$(git rev-parse --git-dir):A}"
|
||||
local git_dir="${$(command git rev-parse --git-dir):A}"
|
||||
|
||||
if [[ -n "$git_dir" ]]; then
|
||||
print "$git_dir"
|
||||
|
@ -5,7 +5,7 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
print "$0: not a repository work tree: $PWD" >&2
|
||||
return 1
|
||||
fi
|
||||
@ -13,7 +13,7 @@ fi
|
||||
local remotes remote references reference file url
|
||||
|
||||
remote="${1:-origin}"
|
||||
remotes=($(git config --get-regexp 'remote.*.url' | cut -d. -f2))
|
||||
remotes=($(command git config --get-regexp 'remote.*.url' | cut -d. -f2))
|
||||
|
||||
if (( $remotes[(i)$remote] == $#remotes + 1 )); then
|
||||
print "$0: remote not found: $remote" >&2
|
||||
@ -21,14 +21,14 @@ if (( $remotes[(i)$remote] == $#remotes + 1 )); then
|
||||
fi
|
||||
|
||||
url=$(
|
||||
git config --get "remote.${remote}.url" \
|
||||
command git config --get "remote.${remote}.url" \
|
||||
| sed -En "s/(git|https?)(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\4\/\5/p"
|
||||
)
|
||||
|
||||
reference="${${2:-$(git-branch-current)}:-HEAD}"
|
||||
references=(
|
||||
HEAD
|
||||
${$(git ls-remote --heads --tags "$remote" | awk '{print $2}')##refs/(heads|tags)/}
|
||||
${$(command git ls-remote --heads --tags "$remote" | awk '{print $2}')##refs/(heads|tags)/}
|
||||
)
|
||||
|
||||
if (( $references[(i)$reference] == $#references + 1 )); then
|
||||
@ -37,7 +37,7 @@ if (( $references[(i)$reference] == $#references + 1 )); then
|
||||
fi
|
||||
|
||||
if [[ "$reference" == 'HEAD' ]]; then
|
||||
reference="$(git rev-parse HEAD 2>/dev/null)"
|
||||
reference="$(command git rev-parse HEAD 2>/dev/null)"
|
||||
fi
|
||||
|
||||
file="$3"
|
||||
|
@ -164,15 +164,15 @@ function git-info {
|
||||
typeset -gA git_info
|
||||
|
||||
# Return if not inside a Git repository work tree.
|
||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if (( $# > 0 )); then
|
||||
if [[ "$1" == [Oo][Nn] ]]; then
|
||||
git config --bool prompt.showinfo true
|
||||
command git config --bool prompt.showinfo true
|
||||
elif [[ "$1" == [Oo][Ff][Ff] ]]; then
|
||||
git config --bool prompt.showinfo false
|
||||
command git config --bool prompt.showinfo false
|
||||
else
|
||||
print "usage: $0 [ on | off ]" >&2
|
||||
fi
|
||||
@ -180,7 +180,7 @@ function git-info {
|
||||
fi
|
||||
|
||||
# Return if git-info is disabled.
|
||||
if ! is-true "${$(git config --bool prompt.showinfo):-true}"; then
|
||||
if ! is-true "${$(command git config --bool prompt.showinfo):-true}"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
@ -190,7 +190,7 @@ function git-info {
|
||||
# Format commit.
|
||||
zstyle -s ':prezto:module:git:info:commit' format 'commit_format'
|
||||
if [[ -n "$commit_format" ]]; then
|
||||
commit="$(git rev-parse HEAD 2> /dev/null)"
|
||||
commit="$(command git rev-parse HEAD 2> /dev/null)"
|
||||
if [[ -n "$commit" ]]; then
|
||||
zformat -f commit_formatted "$commit_format" "c:$commit"
|
||||
fi
|
||||
@ -199,7 +199,7 @@ function git-info {
|
||||
# Format stashed.
|
||||
zstyle -s ':prezto:module:git:info:stashed' format 'stashed_format'
|
||||
if [[ -n "$stashed_format" && -f "$(git-dir)/refs/stash" ]]; then
|
||||
stashed="$(git stash list 2> /dev/null | wc -l | awk '{print $1}')"
|
||||
stashed="$(command git stash list 2> /dev/null | wc -l | awk '{print $1}')"
|
||||
if [[ -n "$stashed" ]]; then
|
||||
zformat -f stashed_formatted "$stashed_format" "S:$stashed"
|
||||
fi
|
||||
@ -215,7 +215,7 @@ function git-info {
|
||||
fi
|
||||
|
||||
# Get the branch.
|
||||
branch="${$(git symbolic-ref HEAD 2> /dev/null)#refs/heads/}"
|
||||
branch="${$(command git symbolic-ref HEAD 2> /dev/null)#refs/heads/}"
|
||||
|
||||
# Format branch.
|
||||
zstyle -s ':prezto:module:git:info:branch' format 'branch_format'
|
||||
@ -226,7 +226,7 @@ function git-info {
|
||||
# Format position.
|
||||
zstyle -s ':prezto:module:git:info:position' format 'position_format'
|
||||
if [[ -z "$branch" && -n "$position_format" ]]; then
|
||||
position="$(git describe --contains --all HEAD 2> /dev/null)"
|
||||
position="$(command git describe --contains --all HEAD 2> /dev/null)"
|
||||
if [[ -n "$position" ]]; then
|
||||
zformat -f position_formatted "$position_format" "p:$position"
|
||||
fi
|
||||
@ -236,7 +236,7 @@ function git-info {
|
||||
zstyle -s ':prezto:module:git:info:remote' format 'remote_format'
|
||||
if [[ -n "$branch" && -n "$remote_format" ]]; then
|
||||
# Gets the remote name.
|
||||
remote_cmd='git rev-parse --symbolic-full-name --verify HEAD@{upstream}'
|
||||
remote_cmd='command git rev-parse --symbolic-full-name --verify HEAD@{upstream}'
|
||||
remote="${$(${(z)remote_cmd} 2> /dev/null)##refs/remotes/}"
|
||||
if [[ -n "$remote" ]]; then
|
||||
zformat -f remote_formatted "$remote_format" "R:$remote"
|
||||
@ -247,7 +247,7 @@ function git-info {
|
||||
zstyle -s ':prezto:module:git:info:behind' format 'behind_format'
|
||||
if [[ -n "$branch" && ( -n "$ahead_format" || -n "$behind_format" ) ]]; then
|
||||
# Gets the commit difference counts between local and remote.
|
||||
ahead_and_behind_cmd='git rev-list --count --left-right HEAD...@{upstream}'
|
||||
ahead_and_behind_cmd='command git rev-list --count --left-right HEAD...@{upstream}'
|
||||
|
||||
# Get ahead and behind counts.
|
||||
ahead_and_behind="$(${(z)ahead_and_behind_cmd} 2> /dev/null)"
|
||||
@ -276,7 +276,7 @@ function git-info {
|
||||
if [[ -n "$indexed_format" ]]; then
|
||||
((
|
||||
indexed+=$(
|
||||
git diff-index \
|
||||
command git diff-index \
|
||||
--no-ext-diff \
|
||||
--name-only \
|
||||
--cached \
|
||||
@ -296,7 +296,7 @@ function git-info {
|
||||
if [[ -n "$unindexed_format" ]]; then
|
||||
((
|
||||
unindexed+=$(
|
||||
git diff-files \
|
||||
command git diff-files \
|
||||
--no-ext-diff \
|
||||
--name-only \
|
||||
--ignore-submodules=${ignore_submodules:-none} \
|
||||
@ -314,7 +314,7 @@ function git-info {
|
||||
if [[ -n "$untracked_format" ]]; then
|
||||
((
|
||||
untracked+=$(
|
||||
git ls-files \
|
||||
command git ls-files \
|
||||
--other \
|
||||
--exclude-standard \
|
||||
2> /dev/null \
|
||||
@ -329,7 +329,7 @@ function git-info {
|
||||
(( dirty = indexed + unindexed + untracked ))
|
||||
else
|
||||
# Use porcelain status for easy parsing.
|
||||
status_cmd="git status --porcelain --ignore-submodules=${ignore_submodules:-none}"
|
||||
status_cmd="command git status --porcelain --ignore-submodules=${ignore_submodules:-none}"
|
||||
|
||||
# Get current status.
|
||||
while IFS=$'\n' read line; do
|
||||
@ -348,13 +348,13 @@ function git-info {
|
||||
# Format added.
|
||||
if (( added > 0 )); then
|
||||
zstyle -s ':prezto:module:git:info:added' format 'added_format'
|
||||
zformat -f added_formatted "$added_format" "a:$added_format"
|
||||
zformat -f added_formatted "$added_format" "a:$added"
|
||||
fi
|
||||
|
||||
# Format deleted.
|
||||
if (( deleted > 0 )); then
|
||||
zstyle -s ':prezto:module:git:info:deleted' format 'deleted_format'
|
||||
zformat -f deleted_formatted "$deleted_format" "d:$deleted_format"
|
||||
zformat -f deleted_formatted "$deleted_format" "d:$deleted"
|
||||
fi
|
||||
|
||||
# Format modified.
|
||||
|
@ -5,7 +5,7 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
local root="$(git rev-parse --show-toplevel 2> /dev/null)"
|
||||
local root="$(command git rev-parse --show-toplevel 2> /dev/null)"
|
||||
|
||||
if [[ -n "$root" ]]; then
|
||||
print "$root"
|
||||
|
@ -5,7 +5,7 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
print "$0: not a repository work tree: $PWD" >&2
|
||||
return 1
|
||||
fi
|
||||
@ -13,10 +13,10 @@ fi
|
||||
local stashed
|
||||
|
||||
if [[ -f "$(git-dir)/refs/stash" ]]; then
|
||||
stashed="$(git stash list 2> /dev/null | wc -l | awk '{print $1}')"
|
||||
stashed="$(command git stash list 2> /dev/null | wc -l | awk '{print $1}')"
|
||||
if (( $stashed > 0 )); then
|
||||
if read -q "?Clear $stashed stashed state(s) [y/N]? "; then
|
||||
git stash clear
|
||||
command git stash clear
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -5,15 +5,15 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
print "$0: not a repository work tree: $PWD" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
git fsck --unreachable 2> /dev/null \
|
||||
command git fsck --unreachable 2> /dev/null \
|
||||
| grep 'commit' \
|
||||
| awk '{print $3}' \
|
||||
| git log \
|
||||
| command git log \
|
||||
--pretty=format:${_git_log_oneline_format} \
|
||||
--extended-regexp \
|
||||
--grep="${1:-(WIP )?[Oo]n [^:]+:}" \
|
||||
|
@ -5,7 +5,7 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
print "$0: not a repository work tree: $PWD" >&2
|
||||
return 1
|
||||
fi
|
||||
@ -13,7 +13,7 @@ fi
|
||||
local commit
|
||||
|
||||
for commit in "$@"; do
|
||||
git update-ref \
|
||||
-m "$(git log -1 --pretty="format:%s" "$commit")" refs/stash "$commit"
|
||||
command git update-ref \
|
||||
-m "$(command git log -1 --pretty="format:%s" "$commit")" refs/stash "$commit"
|
||||
done
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
print "$0: not a repository work tree: $PWD" >&2
|
||||
return 1
|
||||
elif [[ "$PWD" != "$(git-root)" ]]; then
|
||||
@ -17,7 +17,7 @@ local src="$1"
|
||||
local dst="$2"
|
||||
local url
|
||||
|
||||
url="$(git config --file "$(git-root)/.gitmodules" --get "submodule.${src}.url")"
|
||||
url="$(command git config --file "$(git-root)/.gitmodules" --get "submodule.${src}.url")"
|
||||
|
||||
if [[ -z "$url" ]]; then
|
||||
print "$0: submodule not found: $src" >&2
|
||||
@ -27,7 +27,7 @@ fi
|
||||
mkdir -p "${dst:h}"
|
||||
|
||||
git-submodule-remove "$src"
|
||||
git submodule add "$url" "$dst"
|
||||
command git submodule add "$url" "$dst"
|
||||
|
||||
return 0
|
||||
|
||||
|
@ -5,22 +5,22 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
print "$0: not a repository work tree: $PWD" >&2
|
||||
return 1
|
||||
elif [[ "$PWD" != "$(git-root)" ]]; then
|
||||
print "$0: must be run from the root of the work tree" >&2
|
||||
return 1
|
||||
elif ! git config --file .gitmodules --get "submodule.${1}.path" &>/dev/null; then
|
||||
elif ! command git config --file .gitmodules --get "submodule.${1}.path" &>/dev/null; then
|
||||
print "$0: submodule not found: $1" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
git config --file "$(git-dir)/config" --remove-section "submodule.${1}" &>/dev/null
|
||||
git config --file "$(git-root)/.gitmodules" --remove-section "submodule.${1}" &>/dev/null
|
||||
git add .gitmodules
|
||||
command git config --file "$(git-dir)/config" --remove-section "submodule.${1}" &>/dev/null
|
||||
command git config --file "$(git-root)/.gitmodules" --remove-section "submodule.${1}" &>/dev/null
|
||||
command git add .gitmodules
|
||||
|
||||
git rm --cached -rf "${1}"
|
||||
command git rm --cached -rf "${1}"
|
||||
rm -rf "${1}"
|
||||
rm -rf "$(git-dir)/modules/${1}"
|
||||
|
||||
|
15
modules/git/hub.zsh
Normal file
15
modules/git/hub.zsh
Normal file
@ -0,0 +1,15 @@
|
||||
#
|
||||
# Adds GitHub knowledge to the Git command.
|
||||
# https://hub.github.com
|
||||
#
|
||||
# Authors:
|
||||
# Chris Wanstrath <chris@wanstrath.com>
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
if (( $+commands[hub] )); then
|
||||
function git {
|
||||
hub "$@"
|
||||
}
|
||||
fi
|
||||
|
@ -15,4 +15,5 @@ pmodload 'helper'
|
||||
|
||||
# Source module files.
|
||||
source "${0:h}/alias.zsh"
|
||||
source "${0:h}/hub.zsh"
|
||||
|
||||
|
@ -15,11 +15,14 @@ _gpg_agent_conf="$HOME/.gnupg/gpg-agent.conf"
|
||||
_gpg_agent_env="${TMPDIR:-/tmp}/gpg-agent.env"
|
||||
|
||||
# Start gpg-agent if not started.
|
||||
if ! ps -U "$USER" -o ucomm | grep -q gpg-agent; then
|
||||
eval "$(gpg-agent --daemon | tee "$_gpg_agent_env")"
|
||||
else
|
||||
if [[ -z "$GPG_AGENT_INFO" ]]; then
|
||||
# Export environment variables.
|
||||
source "$_gpg_agent_env" 2> /dev/null
|
||||
|
||||
# Start gpg-agent if not started.
|
||||
if ! ps -U "$USER" -o pid,ucomm | grep -q -- "${${${(s.:.)GPG_AGENT_INFO}[2]}:--1} gpg-agent"; then
|
||||
eval "$(gpg-agent --daemon | tee "$_gpg_agent_env")"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Inform gpg-agent of the current TTY for user prompts.
|
||||
|
Submodule modules/history-substring-search/external updated: 1e76804052...9f9fc7d550
@ -5,6 +5,11 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
# TODO: Make the sections easier to use.
|
||||
open "http://nodejs.org/docs/$(node --version | sed 's/-.*//')/api/all.html#${1}"
|
||||
if [[ -z "$BROWSER" ]]; then
|
||||
print "$0: no web browser defined" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# TODO: Make the sections easier to use.
|
||||
"$BROWSER" "http://nodejs.org/docs/$(node --version | sed 's/-.*//')/api/all.html#${1}"
|
||||
|
||||
|
@ -17,7 +17,7 @@ if (( $+functions[nvm_version] )); then
|
||||
version="${$(nvm_version)#v}"
|
||||
fi
|
||||
|
||||
if [[ -n "$version" ]]; then
|
||||
if [[ "$version" == (none|) ]]; then
|
||||
zstyle -s ':prezto:module:node:info:version' format 'version_format'
|
||||
zformat -f version_formatted "$version_format" "v:$version"
|
||||
node_info[version]="$version_formatted"
|
||||
|
@ -1,15 +1,15 @@
|
||||
Ocaml
|
||||
OCaml
|
||||
=====
|
||||
|
||||
Initializes [Ocaml][1] package management.
|
||||
Initializes [OCaml][1] package management.
|
||||
|
||||
OPAM
|
||||
----
|
||||
|
||||
[OPAM][2] is a package manager for Ocaml.
|
||||
[OPAM][2] is a package manager for OCaml.
|
||||
|
||||
This module enables local package installation with OPAM by extending the
|
||||
relevant path and Ocaml variables.
|
||||
relevant path and OCaml variables.
|
||||
|
||||
### Usage
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Initializes Ocaml package management.
|
||||
# Initializes OCaml package management.
|
||||
#
|
||||
# Authors:
|
||||
# Sebastian Wiesner <lunaryorn@gmail.com>
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -16,9 +16,12 @@ elif (( $+commands[pyenv] )); then
|
||||
eval "$(pyenv init -)"
|
||||
|
||||
# Prepend PEP 370 per user site packages directory, which defaults to
|
||||
# ~/Library/Python on Mac OS X and ~/.local elsewhere, to PATH.
|
||||
# ~/Library/Python on Mac OS X and ~/.local elsewhere, to PATH. The
|
||||
# path can be overridden using PYTHONUSERBASE.
|
||||
else
|
||||
if [[ "$OSTYPE" == darwin* ]]; then
|
||||
if [[ -n "$PYTHONUSERBASE" ]]; then
|
||||
path=($PYTHONUSERBASE/bin $path)
|
||||
elif [[ "$OSTYPE" == darwin* ]]; then
|
||||
path=($HOME/Library/Python/*/bin(N) $path)
|
||||
else
|
||||
# This is subject to change.
|
||||
|
@ -15,7 +15,7 @@ fi
|
||||
# Auto Start
|
||||
#
|
||||
|
||||
if [[ -z "$STY" && ( -z "$INSIDE_EMACS" || -z "$EMACS" || -z "$VIM" ) ]] && ( \
|
||||
if [[ -z "$STY" && -z "$EMACS" && -z "$VIM" ]] && ( \
|
||||
( [[ -n "$SSH_TTY" ]] && zstyle -t ':prezto:module:screen:auto-start' remote ) ||
|
||||
( [[ -z "$SSH_TTY" ]] && zstyle -t ':prezto:module:screen:auto-start' local ) \
|
||||
); then
|
||||
|
@ -3,7 +3,7 @@ Spectrum
|
||||
|
||||
Provides for easier use of 256 colors and effects.
|
||||
|
||||
To learn more about text formatting, read [That 256 Color Thing][1].
|
||||
To learn more about text formatting, read [A Guide to 256 Color Codes][1].
|
||||
|
||||
Variables
|
||||
---------
|
||||
@ -87,6 +87,6 @@ Authors
|
||||
- [P.C. Shyamshankar](https://github.com/sykora)
|
||||
- [Sorin Ionescu](https://github.com/sorin-ionescu)
|
||||
|
||||
[1]: http://lucentbeing.com/blog/that-256-color-thing/
|
||||
[1]: http://lucentbeing.com/writing/archives/a-guide-to-256-color-codes/
|
||||
[2]: https://github.com/sorin-ionescu/prezto/issues
|
||||
|
||||
|
@ -25,7 +25,7 @@ if [[ ! -S "$SSH_AUTH_SOCK" ]]; then
|
||||
source "$_ssh_agent_env" 2> /dev/null
|
||||
|
||||
# Start ssh-agent if not started.
|
||||
if ! ps -U "$USER" -o pid,ucomm | grep -q "${SSH_AGENT_PID} ssh-agent"; then
|
||||
if ! ps -U "$USER" -o pid,ucomm | grep -q -- "${SSH_AGENT_PID:--1} ssh-agent"; then
|
||||
eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")"
|
||||
fi
|
||||
fi
|
||||
|
@ -27,7 +27,7 @@ To enable highlighting for this module only, add the following line to
|
||||
### Highlighters
|
||||
|
||||
Syntax highlighting is accomplished by pluggable [highlighters][2]. This module
|
||||
enables the *main*, *brackets*, and *cursor* highlighters by default.
|
||||
only enables the *main* highlighter by default.
|
||||
|
||||
To enable all highlighters, add the following to *zpreztorc*:
|
||||
|
||||
|
Submodule modules/syntax-highlighting/external updated: f289a9f8e7...3dc5741900
@ -20,12 +20,15 @@ following line to *zpreztorc*:
|
||||
|
||||
zstyle ':prezto:module:tmux:auto-start' remote 'yes'
|
||||
|
||||
In both cases, it will create a background session named _#Prezto_ and attach
|
||||
every new shell to it.
|
||||
In both cases, it will create a background session named _prezto_ if the tmux
|
||||
server is not started.
|
||||
|
||||
To avoid keeping open sessions, this module sets `destroy-unattached off` on
|
||||
the background session and `destroy-unattached on` on every other session
|
||||
(global setting).
|
||||
With `auto-start` enabled, you may want to control how multiple sessions are
|
||||
managed. The `destroy-unattached` option of tmux controls if the unattached
|
||||
sessions must be kept alive, making sessions available for later use, configured
|
||||
in *tmux.conf*:
|
||||
|
||||
set-option -g destroy-unattached [on | off]
|
||||
|
||||
Aliases
|
||||
-------
|
||||
@ -41,7 +44,7 @@ connected** to be displayed, which can be fixed by installing
|
||||
[reattach-to-user-namespace][3], available in [Homebrew][4], and adding the
|
||||
following to *tmux.conf*:
|
||||
|
||||
set-option -g default-command "reattach-to-user-namespace -l $SHELL -l"
|
||||
set-option -g default-command "reattach-to-user-namespace -l $SHELL -l"
|
||||
|
||||
Furthermore, tmux is known to cause **kernel panics** on Mac OS X. A discussion
|
||||
about this and Prezto has already been [opened][2].
|
||||
@ -54,6 +57,7 @@ Authors
|
||||
- [Sorin Ionescu](https://github.com/sorin-ionescu)
|
||||
- [Colin Hebert](https://github.com/ColinHebert)
|
||||
- [Georges Discry](https://github.com/gdiscry)
|
||||
- [Xavier Cambar](https://github.com/xcambar)
|
||||
|
||||
[1]: http://tmux.sourceforge.net
|
||||
[2]: https://github.com/sorin-ionescu/prezto/issues/62
|
||||
|
@ -5,6 +5,7 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
# Colin Hebert <hebert.colin@gmail.com>
|
||||
# Georges Discry <georges@discry.be>
|
||||
# Xavier Cambar <xcambar@gmail.com>
|
||||
#
|
||||
|
||||
# Return if requirements are not found.
|
||||
@ -16,31 +17,22 @@ fi
|
||||
# Auto Start
|
||||
#
|
||||
|
||||
if [[ -z "$TMUX" && ( -z "$INSIDE_EMACS" || -z "$EMACS" || -z "$VIM" ) ]] && ( \
|
||||
if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" ]] && ( \
|
||||
( [[ -n "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' remote ) ||
|
||||
( [[ -z "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' local ) \
|
||||
); then
|
||||
tmux_session='prezto'
|
||||
tmux start-server
|
||||
|
||||
if ! tmux has-session -t "$tmux_session" 2> /dev/null; then
|
||||
# Ensure that tmux server is started.
|
||||
tmux start-server
|
||||
|
||||
# Disable the destruction of unattached sessions globally.
|
||||
tmux set-option -g destroy-unattached off &> /dev/null
|
||||
|
||||
# Create a new session.
|
||||
tmux new-session -d -s "$tmux_session"
|
||||
|
||||
# Disable the destruction of the new, unattached session.
|
||||
tmux set-option -t "$tmux_session" destroy-unattached off &> /dev/null
|
||||
|
||||
# Enable the destruction of unattached sessions globally to prevent
|
||||
# an abundance of open, detached sessions.
|
||||
tmux set-option -g destroy-unattached on &> /dev/null
|
||||
# Create a 'prezto' session if no session has been defined in tmux.conf.
|
||||
if ! tmux has-session 2> /dev/null; then
|
||||
tmux_session='prezto'
|
||||
tmux \
|
||||
new-session -d -s "$tmux_session" \; \
|
||||
set-option -t "$tmux_session" destroy-unattached off &> /dev/null
|
||||
fi
|
||||
|
||||
exec tmux new-session -t "$tmux_session"
|
||||
# Attach to the 'prezto' session or to the last session used.
|
||||
exec tmux attach-session
|
||||
fi
|
||||
|
||||
#
|
||||
|
@ -10,7 +10,7 @@ function diff {
|
||||
if (( $+commands[colordiff] )); then
|
||||
command diff --unified "$@" | colordiff --difftype diffu
|
||||
elif (( $+commands[git] )); then
|
||||
git --no-pager diff --color=auto --no-ext-diff --no-index "$@"
|
||||
command git --no-pager diff --color=auto --no-ext-diff --no-index "$@"
|
||||
else
|
||||
command diff --unified "$@"
|
||||
fi
|
||||
|
@ -17,7 +17,7 @@ function wdiff {
|
||||
"$@" \
|
||||
| sed 's/^\(@@\( [+-][[:digit:]]*,[[:digit:]]*\)\{2\} @@\)$/;5;6m\10m/g'
|
||||
elif (( $+commands[git] )); then
|
||||
git --no-pager diff --color=auto --no-ext-diff --no-index --color-words "$@"
|
||||
command git --no-pager diff --color=auto --no-ext-diff --no-index --color-words "$@"
|
||||
else
|
||||
command wdiff "$@"
|
||||
fi
|
||||
|
@ -66,9 +66,9 @@ if is-callable 'dircolors'; then
|
||||
|
||||
if zstyle -t ':prezto:module:utility:ls' color; then
|
||||
if [[ -s "$HOME/.dir_colors" ]]; then
|
||||
eval "$(dircolors "$HOME/.dir_colors")"
|
||||
eval "$(dircolors --sh "$HOME/.dir_colors")"
|
||||
else
|
||||
eval "$(dircolors)"
|
||||
eval "$(dircolors --sh)"
|
||||
fi
|
||||
|
||||
alias ls="$aliases[ls] --color=auto"
|
||||
|
@ -152,4 +152,3 @@ zstyle ':prezto:module:prompt' theme 'sorin'
|
||||
|
||||
# Auto start a session when Zsh is launched in a SSH connection.
|
||||
# zstyle ':prezto:module:tmux:auto-start' remote 'yes'
|
||||
|
||||
|
Reference in New Issue
Block a user