Compare View
-
686e460 Merge branch 'sachin21-a_happy_new_year'
03cc1f7 Cleanup LICENSE file and fix README link
fdde897 Update year to 2016
f558a46 Merge pull request #4709 from mcornella/fix-local-vars-in-git-prompt
0842384 Put `local var` declaration in its own line in lib/git.zsh
30ddf25 Merge pull request #4695 from mcornella/add-hub-completion
69c73a4 Merge pull request #4704 from paulcalabro/patch-1
247a582 Fixed a typo.
5adb06d Merge pull request #4702 from prikhi/master
3ebbb40 colored-man-pages: Use Portable `less` Path
6ad6d11 Merge pull request #4700 from giordanovi/master
015437c Update gulp.plugin.zsh
3162de5 Add hub's completion file
4b95c16 Merge branch 'fix-colored-man-pages-syntax'
5e310c5 Fix syntax error in colored-man-pages
fe9ff63 Merge pull request #4463 from giordanovi/master
4f314e2 Update gulp.plugin.zsh
8042394 Update gulp.plugin.zsh
cb11d13 Merge pull request #4697 from psprint/master
d30a501 znt: more optimizing workarounds for 5.0.6 < 5.2
5de1704 Merge branch 'cknoblauch-patch-1'
09d2a59 Fix style of colored-man-pages plugin
a815729 colored-man plugin: Quoted PATH variable
dd29954 Merge branch 'hallabro-consistent-wording-update'
18ca953 Use consistent wording when updating
ef31d06 Merge pull request #4139 from ultimatemonty/patch-1
8a3b78e Merge pull request #4536 from alexws54tk/patch-1
e344f4c Merge pull request #4420 from apjanke/git-move-current_branch-to-core
9f55213 Move current_branch() from git plugin to core lib/git.zsh
bfd2d8d Merge pull request #4498 from gfvcastro/alias-rake-stats
8d6fcce Merge pull request #4589 from apjanke/agnoster-powerline-char-stronger-warning
93c00cc Merge pull request #4451 from victor-torres/branch-plugin
d988ee0 Merge pull request #4568 from blueyed/archlinux-improve-commands-lookup
fe63ed0 Updating speed test info and using zsh command line.
cf5db83 Implementing mcornella's suggestions in pull request 4451.
531789e Merge pull request #4628 from moyamo/master
bd384a0 Merge pull request #4667 from dbohdan/patch-1
b15918d "fishy" theme: Fix "~" use in prompt
71deb74 Fix indentation
d779750 Default to using terminfo to set the terminal title
6a8692d Merge pull request #4676 from bamarni/composer-stderr
4108c48 Merge pull request #4690 from kaelig/patch-1
6190d3e Point to the GitHub repository
f564159 Merge branch 'GNUletik-master'
95aa9bd Better research history with arrow keys
273063a Merge pull request #4663 from psprint/master
d54d896 Merge pull request #3966 from apjanke/fix-spectrum-ls
4d154ab Merge branch 'apjanke-histsubstr-double-bind'
45822e8 history-substring-search: bind arrows in both emacs and viins modes
11de60f Merge pull request #3965 from apjanke/spectrum-hide-codes
4fbfb14 Add back the `-` alias to go to the previous directory
b6997f6 Update link to git completion
5e950d4 Merge pull request #4689 from apjanke/fix-non-numeric-versions
45e42ef Merge pull request #4657 from hghwng/master
07fcbbe Merge pull request #4641 from WeeBull/patch-1
c52f677 common-aliases: handle "dev" versions in version check
0cca3c0 Merge pull request #4687 from gmccue/web-search-ecosia
fb5effd Add Ecosia to web-search plugin.
357d57c znt: include some status information on top of the window
0d45e77 [Composer] redirect stderr to /dev/null for completion commands
c793bae znt: optimize heap usage for older Zsh's (e.g. 5.0.8)
2e3731c "fishy" theme: Shorten path .foo to .f, not .
89205f9 znt: faster startup of tools using colorifying (e.g. n-history)
a42a3ee Recognize Firefox addon and Android packages.
b57ddd6 Use actual `commit --amend` command for Mercurial
cc116f6 agnoster: stronger warning about changing SEGMENT_SEPARATOR character
9e4aba4 archlinux: use $+commands instead of 'command -v' in a subshell
67abf0f Update frontcube.zsh-theme
e5164d7 Add 'rake stats' alias.
ee8f377 Added support to subtask through gulp --tasks-simple command
d49cacf Add branch plugin
e6ccd37 Merge master (rebase being super annoying). Fix conflicts
30ef856 Fix maintainer line
3594e27 Nicer formatting
0bda651 Fix the spectrum_ls implementation in spectrum.zsh
8142261 Hide spectrum.zsh var values to avoid junky "set" output to terminalgit-subtree-dir: repos/robbyrussell/oh-my-zsh
git-subtree-split: 686e46025890cba38d2cb7ad7cc229bf6beeba57
Changes
Showing 39 changed files Side-by-side Diff
- repos/robbyrussell/oh-my-zsh/MIT-LICENSE.txt
- repos/robbyrussell/oh-my-zsh/README.markdown
- repos/robbyrussell/oh-my-zsh/lib/directories.zsh
- repos/robbyrussell/oh-my-zsh/lib/git.zsh
- repos/robbyrussell/oh-my-zsh/lib/key-bindings.zsh
- repos/robbyrussell/oh-my-zsh/lib/spectrum.zsh
- repos/robbyrussell/oh-my-zsh/lib/termsupport.zsh
- repos/robbyrussell/oh-my-zsh/plugins/archlinux/archlinux.plugin.zsh
- repos/robbyrussell/oh-my-zsh/plugins/branch/README.md
- repos/robbyrussell/oh-my-zsh/plugins/branch/branch.plugin.zsh
- repos/robbyrussell/oh-my-zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh
- repos/robbyrussell/oh-my-zsh/plugins/common-aliases/common-aliases.plugin.zsh
- repos/robbyrussell/oh-my-zsh/plugins/composer/composer.plugin.zsh
- repos/robbyrussell/oh-my-zsh/plugins/ember-cli/README.md
- repos/robbyrussell/oh-my-zsh/plugins/extract/extract.plugin.zsh
- repos/robbyrussell/oh-my-zsh/plugins/git-extras/git-extras.plugin.zsh
- repos/robbyrussell/oh-my-zsh/plugins/git-flow/git-flow.plugin.zsh
- repos/robbyrussell/oh-my-zsh/plugins/git/git.plugin.zsh
- repos/robbyrussell/oh-my-zsh/plugins/github/_hub
- repos/robbyrussell/oh-my-zsh/plugins/gulp/gulp.plugin.zsh
- repos/robbyrussell/oh-my-zsh/plugins/history-substring-search/history-substring-search.plugin.zsh
- repos/robbyrussell/oh-my-zsh/plugins/history-substring-search/update-from-upstream.zsh
- repos/robbyrussell/oh-my-zsh/plugins/mercurial/mercurial.plugin.zsh
- repos/robbyrussell/oh-my-zsh/plugins/rails/rails.plugin.zsh
- repos/robbyrussell/oh-my-zsh/plugins/web-search/web-search.plugin.zsh
- repos/robbyrussell/oh-my-zsh/plugins/zsh-navigation-tools/README.md
- repos/robbyrussell/oh-my-zsh/plugins/zsh-navigation-tools/n-list
- repos/robbyrussell/oh-my-zsh/plugins/zsh-navigation-tools/n-panelize
- repos/robbyrussell/oh-my-zsh/themes/agnoster.zsh-theme
- repos/robbyrussell/oh-my-zsh/themes/eastwood.zsh-theme
- repos/robbyrussell/oh-my-zsh/themes/fishy.zsh-theme
- repos/robbyrussell/oh-my-zsh/themes/frontcube.zsh-theme
- repos/robbyrussell/oh-my-zsh/themes/gallois.zsh-theme
- repos/robbyrussell/oh-my-zsh/themes/josh.zsh-theme
- repos/robbyrussell/oh-my-zsh/themes/juanghurtado.zsh-theme
- repos/robbyrussell/oh-my-zsh/themes/mortalscumbag.zsh-theme
- repos/robbyrussell/oh-my-zsh/themes/peepcode.zsh-theme
- repos/robbyrussell/oh-my-zsh/themes/sunrise.zsh-theme
- repos/robbyrussell/oh-my-zsh/tools/upgrade.sh
1 | -The MIT License | |
1 | +The MIT License (MIT) | |
2 | 2 | |
3 | -Copyright (c) 2009-2015 Robby Russell and contributors (see https://github.com/robbyrussell/oh-my-zsh/contributors) | |
3 | +Copyright (c) 2009-2016 Robby Russell and contributors | |
4 | +See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors | |
4 | 5 | |
5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
6 | 7 | of this software and associated documentation files (the "Software"), to deal |
... | ... | @@ -9,13 +10,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
9 | 10 | copies of the Software, and to permit persons to whom the Software is |
10 | 11 | furnished to do so, subject to the following conditions: |
11 | 12 | |
12 | -The above copyright notice and this permission notice shall be included in | |
13 | -all copies or substantial portions of the Software. | |
13 | +The above copyright notice and this permission notice shall be included in all | |
14 | +copies or substantial portions of the Software. | |
14 | 15 | |
15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
16 | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
17 | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
18 | 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
19 | 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
20 | -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
21 | -THE SOFTWARE. | |
21 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
22 | +SOFTWARE. |
... | ... | @@ -210,4 +210,4 @@ We have [stickers](http://shop.planetargon.com/products/ohmyzsh-stickers-set-of- |
210 | 210 | |
211 | 211 | ## License |
212 | 212 | |
213 | -Oh My Zsh is released under the [MIT license](https://github.com/robbyrussell/oh-my-zsh/blob/master/MIT-LICENSE.txt). | |
213 | +Oh My Zsh is released under the [MIT license](MIT-LICENSE.txt). |
1 | -# get the name of the branch we are on | |
1 | +# Outputs current branch info in prompt format | |
2 | 2 | function git_prompt_info() { |
3 | + local ref | |
3 | 4 | if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then |
4 | 5 | ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ |
5 | 6 | ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0 |
... | ... | @@ -7,9 +8,8 @@ function git_prompt_info() { |
7 | 8 | fi |
8 | 9 | } |
9 | 10 | |
10 | - | |
11 | 11 | # Checks if working tree is dirty |
12 | -parse_git_dirty() { | |
12 | +function parse_git_dirty() { | |
13 | 13 | local STATUS='' |
14 | 14 | local FLAGS |
15 | 15 | FLAGS=('--porcelain') |
... | ... | @@ -29,32 +29,26 @@ parse_git_dirty() { |
29 | 29 | fi |
30 | 30 | } |
31 | 31 | |
32 | -# get the difference between the local and remote branches | |
33 | -git_remote_status() { | |
32 | +# Gets the difference between the local and remote branches | |
33 | +function git_remote_status() { | |
34 | + local remote ahead behind git_remote_status git_remote_status_detailed | |
34 | 35 | remote=${$(command git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/} |
35 | - if [[ -n ${remote} ]] ; then | |
36 | + if [[ -n ${remote} ]]; then | |
36 | 37 | ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l) |
37 | 38 | behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l) |
38 | 39 | |
39 | - if [ $ahead -eq 0 ] && [ $behind -eq 0 ] | |
40 | - then | |
41 | - git_remote_status="$ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE" | |
42 | - elif [ $ahead -gt 0 ] && [ $behind -eq 0 ] | |
43 | - then | |
40 | + if [[ $ahead -gt 0 ]] && [[ $behind -eq 0 ]]; then | |
44 | 41 | git_remote_status="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE" |
45 | 42 | git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}" |
46 | - elif [ $behind -gt 0 ] && [ $ahead -eq 0 ] | |
47 | - then | |
43 | + elif [[ $behind -gt 0 ]] && [[ $ahead -eq 0 ]]; then | |
48 | 44 | git_remote_status="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE" |
49 | 45 | git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}" |
50 | - elif [ $ahead -gt 0 ] && [ $behind -gt 0 ] | |
51 | - then | |
46 | + elif [[ $ahead -gt 0 ]] && [[ $behind -gt 0 ]]; then | |
52 | 47 | git_remote_status="$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE" |
53 | 48 | git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}" |
54 | 49 | fi |
55 | 50 | |
56 | - if [ $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ] | |
57 | - then | |
51 | + if [[ -n $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]]; then | |
58 | 52 | git_remote_status="$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX" |
59 | 53 | fi |
60 | 54 | |
... | ... | @@ -62,9 +56,26 @@ git_remote_status() { |
62 | 56 | fi |
63 | 57 | } |
64 | 58 | |
59 | +# Outputs the name of the current branch | |
60 | +# Usage example: git pull origin $(git_current_branch) | |
61 | +# Using '--quiet' with 'symbolic-ref' will not cause a fatal error (128) if | |
62 | +# it's not a symbolic ref, but in a Git repo. | |
63 | +function git_current_branch() { | |
64 | + local ref | |
65 | + ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null) | |
66 | + local ret=$? | |
67 | + if [[ $ret != 0 ]]; then | |
68 | + [[ $ret == 128 ]] && return # no git repo. | |
69 | + ref=$(command git rev-parse --short HEAD 2> /dev/null) || return | |
70 | + fi | |
71 | + echo ${ref#refs/heads/} | |
72 | +} | |
73 | + | |
74 | + | |
65 | 75 | # Gets the number of commits ahead from remote |
66 | 76 | function git_commits_ahead() { |
67 | 77 | if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then |
78 | + local COMMITS | |
68 | 79 | COMMITS=$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ') |
69 | 80 | echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$COMMITS$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX" |
70 | 81 | fi |
... | ... | @@ -72,21 +83,21 @@ function git_commits_ahead() { |
72 | 83 | |
73 | 84 | # Outputs if current branch is ahead of remote |
74 | 85 | function git_prompt_ahead() { |
75 | - if [[ -n "$(command git rev-list origin/$(current_branch)..HEAD 2> /dev/null)" ]]; then | |
86 | + if [[ -n "$(command git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then | |
76 | 87 | echo "$ZSH_THEME_GIT_PROMPT_AHEAD" |
77 | 88 | fi |
78 | 89 | } |
79 | 90 | |
80 | 91 | # Outputs if current branch is behind remote |
81 | 92 | function git_prompt_behind() { |
82 | - if [[ -n "$(command git rev-list HEAD..origin/$(current_branch) 2> /dev/null)" ]]; then | |
93 | + if [[ -n "$(command git rev-list HEAD..origin/$(git_current_branch) 2> /dev/null)" ]]; then | |
83 | 94 | echo "$ZSH_THEME_GIT_PROMPT_BEHIND" |
84 | 95 | fi |
85 | 96 | } |
86 | 97 | |
87 | 98 | # Outputs if current branch exists on remote or not |
88 | 99 | function git_prompt_remote() { |
89 | - if [[ -n "$(command git show-ref origin/$(current_branch) 2> /dev/null)" ]]; then | |
100 | + if [[ -n "$(command git show-ref origin/$(git_current_branch) 2> /dev/null)" ]]; then | |
90 | 101 | echo "$ZSH_THEME_GIT_PROMPT_REMOTE_EXISTS" |
91 | 102 | else |
92 | 103 | echo "$ZSH_THEME_GIT_PROMPT_REMOTE_MISSING" |
... | ... | @@ -95,16 +106,19 @@ function git_prompt_remote() { |
95 | 106 | |
96 | 107 | # Formats prompt string for current git commit short SHA |
97 | 108 | function git_prompt_short_sha() { |
109 | + local SHA | |
98 | 110 | SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" |
99 | 111 | } |
100 | 112 | |
101 | 113 | # Formats prompt string for current git commit long SHA |
102 | 114 | function git_prompt_long_sha() { |
115 | + local SHA | |
103 | 116 | SHA=$(command git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" |
104 | 117 | } |
105 | 118 | |
106 | 119 | # Get the status of the working tree |
107 | -git_prompt_status() { | |
120 | +function git_prompt_status() { | |
121 | + local INDEX STATUS | |
108 | 122 | INDEX=$(command git status --porcelain -b 2> /dev/null) |
109 | 123 | STATUS="" |
110 | 124 | if $(echo "$INDEX" | command grep -E '^\?\? ' &> /dev/null); then |
... | ... | @@ -150,15 +164,14 @@ git_prompt_status() { |
150 | 164 | echo $STATUS |
151 | 165 | } |
152 | 166 | |
153 | -#compare the provided version of git to the version installed and on path | |
154 | -#prints 1 if input version <= installed version | |
155 | -#prints -1 otherwise | |
167 | +# Compares the provided version of git to the version installed and on path | |
168 | +# Outputs -1, 0, or 1 if the installed version is less than, equal to, or | |
169 | +# greater than the input version, respectively. | |
156 | 170 | function git_compare_version() { |
157 | - local INPUT_GIT_VERSION=$1; | |
158 | - local INSTALLED_GIT_VERSION | |
159 | - INPUT_GIT_VERSION=(${(s/./)INPUT_GIT_VERSION}); | |
160 | - INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null)); | |
161 | - INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]}); | |
171 | + local INPUT_GIT_VERSION INSTALLED_GIT_VERSION | |
172 | + INPUT_GIT_VERSION=(${(s/./)1}) | |
173 | + INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null)) | |
174 | + INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]}) | |
162 | 175 | |
163 | 176 | for i in {1..3}; do |
164 | 177 | if [[ $INSTALLED_GIT_VERSION[$i] -gt $INPUT_GIT_VERSION[$i] ]]; then |
... | ... | @@ -173,7 +186,7 @@ function git_compare_version() { |
173 | 186 | echo 0 |
174 | 187 | } |
175 | 188 | |
176 | -#this is unlikely to change so make it all statically assigned | |
189 | +# This is unlikely to change so make it all statically assigned | |
177 | 190 | POST_1_7_2_GIT=$(git_compare_version "1.7.2") |
178 | -#clean up the namespace slightly by removing the checker function | |
179 | -unset -f git_compare_version | |
191 | +# Clean up the namespace slightly by removing the checker function | |
192 | +unfunction git_compare_version |
... | ... | @@ -27,11 +27,17 @@ if [[ "${terminfo[knp]}" != "" ]]; then |
27 | 27 | bindkey "${terminfo[knp]}" down-line-or-history # [PageDown] - Down a line of history |
28 | 28 | fi |
29 | 29 | |
30 | +# start typing + [Up-Arrow] - fuzzy find history forward | |
30 | 31 | if [[ "${terminfo[kcuu1]}" != "" ]]; then |
31 | - bindkey "${terminfo[kcuu1]}" up-line-or-search # start typing + [Up-Arrow] - fuzzy find history forward | |
32 | + autoload -U up-line-or-beginning-search | |
33 | + zle -N up-line-or-beginning-search | |
34 | + bindkey "${terminfo[kcuu1]}" up-line-or-beginning-search | |
32 | 35 | fi |
36 | +# start typing + [Down-Arrow] - fuzzy find history backward | |
33 | 37 | if [[ "${terminfo[kcud1]}" != "" ]]; then |
34 | - bindkey "${terminfo[kcud1]}" down-line-or-search # start typing + [Down-Arrow] - fuzzy find history backward | |
38 | + autoload -U down-line-or-beginning-search | |
39 | + zle -N down-line-or-beginning-search | |
40 | + bindkey "${terminfo[kcud1]}" down-line-or-beginning-search | |
35 | 41 | fi |
36 | 42 | |
37 | 43 | if [[ "${terminfo[khome]}" != "" ]]; then |
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | # P.C. Shyamshankar <sykora@lucentbeing.com> |
4 | 4 | # Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/ |
5 | 5 | |
6 | -typeset -Ag FX FG BG | |
6 | +typeset -AHg FX FG BG | |
7 | 7 | |
8 | 8 | FX=( |
9 | 9 | reset "%{[00m%}" |
... | ... | @@ -25,7 +25,7 @@ ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab o |
25 | 25 | # Show all 256 colors with color number |
26 | 26 | function spectrum_ls() { |
27 | 27 | for code in {000..255}; do |
28 | - print -P -- "$code: %F{$code}$ZSH_SPECTRUM_TEXT%f" | |
28 | + print -P -- "$code: %{$FG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}" | |
29 | 29 | done |
30 | 30 | } |
31 | 31 | |
... | ... | @@ -40,6 +40,6 @@ function spectrum_fls() { |
40 | 40 | # Show all 256 colors where the background is set to specific color |
41 | 41 | function spectrum_bls() { |
42 | 42 | for code in {000..255}; do |
43 | - print -P -- "$BG[$code]$code: $ZSH_SPECTRUM_TEXT %{$reset_color%}" | |
43 | + print -P -- "$code: %{$BG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}" | |
44 | 44 | done |
45 | 45 | } |
... | ... | @@ -28,6 +28,14 @@ function title { |
28 | 28 | if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then |
29 | 29 | print -Pn "\e]2;$2:q\a" # set window name |
30 | 30 | print -Pn "\e]1;$1:q\a" # set tab name |
31 | + else | |
32 | + # Try to use terminfo to set the title | |
33 | + # If the feature is available set title | |
34 | + if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then | |
35 | + echoti tsl | |
36 | + print -Pn "$1" | |
37 | + echoti fsl | |
38 | + fi | |
31 | 39 | fi |
32 | 40 | ;; |
33 | 41 | esac |
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | # Usage is also described at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins |
3 | 3 | |
4 | 4 | # Look for yaourt, and add some useful functions if we have it. |
5 | -if [[ -x `command -v yaourt` ]]; then | |
5 | +if (( $+commands[yaourt] )); then | |
6 | 6 | upgrade () { |
7 | 7 | yaourt -Syu |
8 | 8 | } |
... | ... | @@ -21,11 +21,11 @@ if [[ -x `command -v yaourt` ]]; then |
21 | 21 | alias yalst='yaourt -Qe' # List installed packages, even those installed from AUR (they're tagged as "local") |
22 | 22 | alias yaorph='yaourt -Qtd' # Remove orphans using yaourt |
23 | 23 | # Additional yaourt alias examples |
24 | - if [[ -x `command -v abs` && -x `command -v aur` ]]; then | |
24 | + if (( $+commands[abs] && $+commands[aur] )); then | |
25 | 25 | alias yaupd='yaourt -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories |
26 | - elif [[ -x `command -v abs` ]]; then | |
26 | + elif (( $+commands[abs] )); then | |
27 | 27 | alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories |
28 | - elif [[ -x `command -v aur` ]]; then | |
28 | + elif (( $+commands[aur] )); then | |
29 | 29 | alias yaupd='yaourt -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories |
30 | 30 | else |
31 | 31 | alias yaupd='yaourt -Sy' # Update and refresh the local package database against repositories |
... | ... | @@ -49,11 +49,11 @@ alias pacreps='pacman -Ss' # Search for package(s) in the repositori |
49 | 49 | alias pacloc='pacman -Qi' # Display information about a given package in the local database |
50 | 50 | alias paclocs='pacman -Qs' # Search for package(s) in the local database |
51 | 51 | # Additional pacman alias examples |
52 | -if [[ -x `command -v abs` && -x `command -v aur` ]]; then | |
52 | +if (( $+commands[abs] && $+commands[aur] )); then | |
53 | 53 | alias pacupd='sudo pacman -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories |
54 | -elif [[ -x `command -v abs` ]]; then | |
54 | +elif (( $+commands[abs] )); then | |
55 | 55 | alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories |
56 | -elif [[ -x `command -v aur` ]]; then | |
56 | +elif (( $+commands[aur] )); then | |
57 | 57 | alias pacupd='sudo pacman -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories |
58 | 58 | else |
59 | 59 | alias pacupd='sudo pacman -Sy' # Update and refresh the local package database against repositories |
... | ... | @@ -0,0 +1,33 @@ |
1 | +# Branch | |
2 | + | |
3 | +Displays the current Git or Mercurial branch fast. | |
4 | + | |
5 | +## Speed test | |
6 | + | |
7 | +### Mercurial | |
8 | + | |
9 | +```shell | |
10 | +$ time hg branch | |
11 | +0.11s user 0.14s system 70% cpu 0.355 total | |
12 | +``` | |
13 | + | |
14 | +### Branch plugin | |
15 | + | |
16 | +```shell | |
17 | +$ time zsh /tmp/branch_prompt_info_test.zsh | |
18 | +0.00s user 0.01s system 78% cpu 0.014 total | |
19 | +``` | |
20 | + | |
21 | +## Usage | |
22 | + | |
23 | +Edit your theme file (eg.: `~/.oh-my-zsh/theme/robbyrussell.zsh-theme`) | |
24 | +adding `$(branch_prompt_info)` in your prompt like this: | |
25 | + | |
26 | +```diff | |
27 | +- PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' | |
28 | ++ PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(branch_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' | |
29 | +``` | |
30 | + | |
31 | +## Maintainer | |
32 | + | |
33 | +Victor Torres (<vpaivatorres@gmail.com>) |
... | ... | @@ -0,0 +1,26 @@ |
1 | +# Branch: displays the current Git or Mercurial branch fast. | |
2 | +# Victor Torres <vpaivatorres@gmail.com> | |
3 | +# Oct 2, 2015 | |
4 | + | |
5 | +function branch_prompt_info() { | |
6 | + # Defines path as current directory | |
7 | + local current_dir=$PWD | |
8 | + # While current path is not root path | |
9 | + while [[ $current_dir != '/' ]] | |
10 | + do | |
11 | + # Git repository | |
12 | + if [[ -d "${current_dir}/.git" ]] | |
13 | + then | |
14 | + echo '±' ${"$(<"$current_dir/.git/HEAD")"##*/} | |
15 | + return; | |
16 | + fi | |
17 | + # Mercurial repository | |
18 | + if [[ -d "${current_dir}/.hg" ]] | |
19 | + then | |
20 | + echo '☿' $(<"$current_dir/.hg/branch") | |
21 | + return; | |
22 | + fi | |
23 | + # Defines path as parent directory and keeps looking for :) | |
24 | + current_dir="${current_dir:h}" | |
25 | + done | |
26 | +} |
1 | -if [ "$OSTYPE[0,7]" = "solaris" ] | |
1 | +if [[ "$OSTYPE" = solaris* ]] | |
2 | 2 | then |
3 | - if [ ! -x ${HOME}/bin/nroff ] | |
3 | + if [[ ! -x "$HOME/bin/nroff" ]] | |
4 | 4 | then |
5 | - mkdir -p ${HOME}/bin | |
6 | - cat > ${HOME}/bin/nroff <<EOF | |
5 | + mkdir -p "$HOME/bin" | |
6 | + cat > "$HOME/bin/nroff" <<EOF | |
7 | 7 | #!/bin/sh |
8 | 8 | if [ -n "\$_NROFF_U" -a "\$1,\$2,\$3" = "-u0,-Tlp,-man" ]; then |
9 | 9 | shift |
10 | - exec /usr/bin/nroff -u\${_NROFF_U} "\$@" | |
10 | + exec /usr/bin/nroff -u\$_NROFF_U "\$@" | |
11 | 11 | fi |
12 | 12 | #-- Some other invocation of nroff |
13 | 13 | exec /usr/bin/nroff "\$@" |
14 | 14 | EOF |
15 | - chmod +x ${HOME}/bin/nroff | |
15 | + chmod +x "$HOME/bin/nroff" | |
16 | 16 | fi |
17 | 17 | fi |
18 | 18 | |
19 | 19 | man() { |
20 | - env \ | |
21 | - LESS_TERMCAP_mb=$(printf "\e[1;31m") \ | |
22 | - LESS_TERMCAP_md=$(printf "\e[1;31m") \ | |
23 | - LESS_TERMCAP_me=$(printf "\e[0m") \ | |
24 | - LESS_TERMCAP_se=$(printf "\e[0m") \ | |
25 | - LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ | |
26 | - LESS_TERMCAP_ue=$(printf "\e[0m") \ | |
27 | - LESS_TERMCAP_us=$(printf "\e[1;32m") \ | |
28 | - PAGER=/usr/bin/less \ | |
29 | - _NROFF_U=1 \ | |
30 | - PATH=${HOME}/bin:${PATH} \ | |
31 | - man "$@" | |
20 | + env \ | |
21 | + LESS_TERMCAP_mb=$(printf "\e[1;31m") \ | |
22 | + LESS_TERMCAP_md=$(printf "\e[1;31m") \ | |
23 | + LESS_TERMCAP_me=$(printf "\e[0m") \ | |
24 | + LESS_TERMCAP_se=$(printf "\e[0m") \ | |
25 | + LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ | |
26 | + LESS_TERMCAP_ue=$(printf "\e[0m") \ | |
27 | + LESS_TERMCAP_us=$(printf "\e[1;32m") \ | |
28 | + PAGER="${commands[less]:-$PAGER}" \ | |
29 | + _NROFF_U=1 \ | |
30 | + PATH="$HOME/bin:$PATH" \ | |
31 | + man "$@" | |
32 | 32 | } |
... | ... | @@ -52,7 +52,7 @@ alias mv='mv -i' |
52 | 52 | |
53 | 53 | # zsh is able to auto-do some kungfoo |
54 | 54 | # depends on the SUFFIX :) |
55 | -if [ ${ZSH_VERSION//\./} -ge 420 ]; then | |
55 | +if is-at-least 4.2.0; then | |
56 | 56 | # open browser on urls |
57 | 57 | _browser_fts=(htm html de org net com at cx nl se dk dk php) |
58 | 58 | for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done |
... | ... | @@ -7,11 +7,11 @@ |
7 | 7 | |
8 | 8 | # Composer basic command completion |
9 | 9 | _composer_get_command_list () { |
10 | - $_comp_command1 --no-ansi | sed "1,/Available commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }' | |
10 | + $_comp_command1 --no-ansi 2>/dev/null | sed "1,/Available commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }' | |
11 | 11 | } |
12 | 12 | |
13 | 13 | _composer_get_required_list () { |
14 | - $_comp_command1 show -s --no-ansi | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }' | |
14 | + $_comp_command1 show -s --no-ansi 2>/dev/null | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }' | |
15 | 15 | } |
16 | 16 | |
17 | 17 | _composer () { |
... | ... | @@ -6,14 +6,16 @@ Ember CLI (http://www.ember-cli.com/) |
6 | 6 | |
7 | 7 | ### List of Aliases |
8 | 8 | |
9 | - alias es='ember serve' | |
10 | - alias ea='ember addon' | |
11 | - alias eb='ember build' | |
12 | - alias ed='ember destroy' | |
13 | - alias eg='ember generate' | |
14 | - alias eh='ember help' | |
15 | - alias ein='ember init' | |
16 | - alias ei='ember install' | |
17 | - alias et='ember test' | |
18 | - alias eu='ember update' | |
19 | - alias ev='ember version' | |
9 | +Alias | Ember-CLI command | |
10 | +----- | ----------------- | |
11 | +**es** | *ember serve* | |
12 | +**ea** | *ember addon* | |
13 | +**eb** | *ember build* | |
14 | +**ed** | *ember destroy* | |
15 | +**eg** | *ember generate* | |
16 | +**eh** | *ember help* | |
17 | +**ein** | *ember init* | |
18 | +**ei** | *ember install* | |
19 | +**et** | *ember test* | |
20 | +**eu** | *ember update* | |
21 | +**ev** | *ember version* |
... | ... | @@ -52,7 +52,7 @@ function extract() { |
52 | 52 | (*.xz) unxz "$1" ;; |
53 | 53 | (*.lzma) unlzma "$1" ;; |
54 | 54 | (*.Z) uncompress "$1" ;; |
55 | - (*.zip|*.war|*.jar|*.sublime-package|*.ipsw) unzip "$1" -d $extract_dir ;; | |
55 | + (*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk) unzip "$1" -d $extract_dir ;; | |
56 | 56 | (*.rar) unrar x -ad "$1" ;; |
57 | 57 | (*.7z) 7za x "$1" ;; |
58 | 58 | (*.deb) |
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | # |
5 | 5 | # Completion script for git-extras (http://github.com/tj/git-extras). |
6 | 6 | # |
7 | -# This depends on and reueses some of the internals of the _git completion | |
7 | +# This depends on and reuses some of the internals of the _git completion | |
8 | 8 | # function that ships with zsh itself. It will not work with the _git that ships |
9 | 9 | # with git. |
10 | 10 | # |
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 | # To achieve git-flow completion nirvana: |
7 | 7 | # |
8 | 8 | # 0. Update your zsh's git-completion module to the newest version. |
9 | -# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD | |
9 | +# From here. https://raw.githubusercontent.com/zsh-users/zsh/master/Completion/Unix/Command/_git | |
10 | 10 | # |
11 | 11 | # 1. Install this file. Either: |
12 | 12 | # |
... | ... | @@ -6,19 +6,12 @@ zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd |
6 | 6 | # Functions |
7 | 7 | # |
8 | 8 | |
9 | -# The current branch name | |
10 | -# Usage example: git pull origin $(current_branch) | |
11 | -# Using '--quiet' with 'symbolic-ref' will not cause a fatal error (128) if | |
12 | -# it's not a symbolic ref, but in a Git repo. | |
9 | +# The name of the current branch | |
10 | +# Back-compatibility wrapper for when this function was defined here in | |
11 | +# the plugin, before being pulled in to core lib/git.zsh as git_current_branch() | |
12 | +# to fix the core -> git plugin dependency. | |
13 | 13 | function current_branch() { |
14 | - local ref | |
15 | - ref=$($_omz_git_git_cmd symbolic-ref --quiet HEAD 2> /dev/null) | |
16 | - local ret=$? | |
17 | - if [[ $ret != 0 ]]; then | |
18 | - [[ $ret == 128 ]] && return # no git repo. | |
19 | - ref=$($_omz_git_git_cmd rev-parse --short HEAD 2> /dev/null) || return | |
20 | - fi | |
21 | - echo ${ref#refs/heads/} | |
14 | + git_current_branch | |
22 | 15 | } |
23 | 16 | # The list of remotes |
24 | 17 | function current_repository() { |
... | ... | @@ -99,7 +92,7 @@ alias gfo='git fetch origin' |
99 | 92 | alias gg='git gui citool' |
100 | 93 | alias gga='git gui citool --amend' |
101 | 94 | ggf() { |
102 | -[[ "$#" != 1 ]] && local b="$(current_branch)" | |
95 | +[[ "$#" != 1 ]] && local b="$(git_current_branch)" | |
103 | 96 | git push --force origin "${b:=$1}" |
104 | 97 | } |
105 | 98 | compdef _git ggf=git-checkout |
... | ... | @@ -107,23 +100,23 @@ ggl() { |
107 | 100 | if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then |
108 | 101 | git pull origin "${*}" |
109 | 102 | else |
110 | -[[ "$#" == 0 ]] && local b="$(current_branch)" | |
103 | +[[ "$#" == 0 ]] && local b="$(git_current_branch)" | |
111 | 104 | git pull origin "${b:=$1}" |
112 | 105 | fi |
113 | 106 | } |
114 | 107 | compdef _git ggl=git-checkout |
115 | -alias ggpull='git pull origin $(current_branch)' | |
108 | +alias ggpull='git pull origin $(git_current_branch)' | |
116 | 109 | compdef _git ggpull=git-checkout |
117 | 110 | ggp() { |
118 | 111 | if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then |
119 | 112 | git push origin "${*}" |
120 | 113 | else |
121 | -[[ "$#" == 0 ]] && local b="$(current_branch)" | |
114 | +[[ "$#" == 0 ]] && local b="$(git_current_branch)" | |
122 | 115 | git push origin "${b:=$1}" |
123 | 116 | fi |
124 | 117 | } |
125 | 118 | compdef _git ggp=git-checkout |
126 | -alias ggpush='git push origin $(current_branch)' | |
119 | +alias ggpush='git push origin $(git_current_branch)' | |
127 | 120 | compdef _git ggpush=git-checkout |
128 | 121 | ggpnp() { |
129 | 122 | if [[ "$#" == 0 ]]; then |
... | ... | @@ -133,9 +126,9 @@ ggl "${*}" && ggp "${*}" |
133 | 126 | fi |
134 | 127 | } |
135 | 128 | compdef _git ggpnp=git-checkout |
136 | -alias ggsup='git branch --set-upstream-to=origin/$(current_branch)' | |
129 | +alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)' | |
137 | 130 | ggu() { |
138 | -[[ "$#" != 1 ]] && local b="$(current_branch)" | |
131 | +[[ "$#" != 1 ]] && local b="$(git_current_branch)" | |
139 | 132 | git pull --rebase origin "${b:=$1}" |
140 | 133 | } |
141 | 134 | compdef _git ggu=git-checkout |
... | ... | @@ -0,0 +1,163 @@ |
1 | +#compdef hub | |
2 | + | |
3 | +# Zsh will source this file when attempting to autoload the "_hub" function, | |
4 | +# typically on the first attempt to complete the hub command. We define two new | |
5 | +# setup helper routines (one for the zsh-distributed version, one for the | |
6 | +# git-distributed, bash-based version). Then we redefine the "_hub" function to | |
7 | +# call "_git" after some other interception. | |
8 | +# | |
9 | +# This is pretty fragile, if you think about it. Any number of implementation | |
10 | +# changes in the "_git" scripts could cause problems down the road. It would be | |
11 | +# better if the stock git completions were just a bit more permissive about how | |
12 | +# it allowed third-party commands to be added. | |
13 | + | |
14 | +(( $+functions[__hub_setup_zsh_fns] )) || | |
15 | +__hub_setup_zsh_fns () { | |
16 | + (( $+functions[_git-alias] )) || | |
17 | + _git-alias () { | |
18 | + _arguments \ | |
19 | + '-s[output shell script suitable for eval]' \ | |
20 | + '1::shell:(zsh bash csh)' | |
21 | + } | |
22 | + | |
23 | + (( $+functions[_git-browse] )) || | |
24 | + _git-browse () { | |
25 | + _arguments \ | |
26 | + '-u[output the URL]' \ | |
27 | + '2::subpage:(wiki commits issues)' | |
28 | + } | |
29 | + | |
30 | + (( $+functions[_git-compare] )) || | |
31 | + _git-compare () { | |
32 | + _arguments \ | |
33 | + '-u[output the URL]' \ | |
34 | + ':[start...]end range:' | |
35 | + } | |
36 | + | |
37 | + (( $+functions[_git-create] )) || | |
38 | + _git-create () { | |
39 | + _arguments \ | |
40 | + '::name (REPOSITORY or ORGANIZATION/REPOSITORY):' \ | |
41 | + '-p[make repository private]' \ | |
42 | + '-d[description]:description' \ | |
43 | + '-h[home page]:repository home page URL:_urls' | |
44 | + } | |
45 | + | |
46 | + (( $+functions[_git-fork] )) || | |
47 | + _git-fork () { | |
48 | + _arguments \ | |
49 | + '--no-remote[do not add a remote for the new fork]' | |
50 | + } | |
51 | + | |
52 | + (( $+functions[_git-pull-request] )) || | |
53 | + _git-pull-request () { | |
54 | + _arguments \ | |
55 | + '-f[force (skip check for local commits)]' \ | |
56 | + '-b[base]:base ("branch", "owner\:branch", "owner/repo\:branch"):' \ | |
57 | + '-h[head]:head ("branch", "owner\:branch", "owner/repo\:branch"):' \ | |
58 | + - set1 \ | |
59 | + '-m[message]' \ | |
60 | + '-F[file]' \ | |
61 | + '-a[user]' \ | |
62 | + '-M[milestone]' \ | |
63 | + '-l[labels]' \ | |
64 | + - set2 \ | |
65 | + '-i[issue]:issue number:' \ | |
66 | + - set3 \ | |
67 | + '::issue-url:_urls' | |
68 | + } | |
69 | + | |
70 | + # stash the "real" command for later | |
71 | + functions[_hub_orig_git_commands]=$functions[_git_commands] | |
72 | + | |
73 | + # Replace it with our own wrapper. | |
74 | + declare -f _git_commands >& /dev/null && unfunction _git_commands | |
75 | + _git_commands () { | |
76 | + local ret=1 | |
77 | + # call the original routine | |
78 | + _call_function ret _hub_orig_git_commands | |
79 | + | |
80 | + # Effectively "append" our hub commands to the behavior of the original | |
81 | + # _git_commands function. Using this wrapper function approach ensures | |
82 | + # that we only offer the user the hub subcommands when the user is | |
83 | + # actually trying to complete subcommands. | |
84 | + hub_commands=( | |
85 | + alias:'show shell instructions for wrapping git' | |
86 | + pull-request:'open a pull request on GitHub' | |
87 | + fork:'fork origin repo on GitHub' | |
88 | + create:'create new repo on GitHub for the current project' | |
89 | + browse:'browse the project on GitHub' | |
90 | + compare:'open GitHub compare view' | |
91 | + ci-status:'lookup commit in GitHub Status API' | |
92 | + ) | |
93 | + _describe -t hub-commands 'hub command' hub_commands && ret=0 | |
94 | + | |
95 | + return ret | |
96 | + } | |
97 | +} | |
98 | + | |
99 | +(( $+functions[__hub_setup_bash_fns] )) || | |
100 | +__hub_setup_bash_fns () { | |
101 | + # TODO more bash-style fns needed here to complete subcommand args. They take | |
102 | + # the form "_git_CMD" where "CMD" is something like "pull-request". | |
103 | + | |
104 | + # Duplicate and rename the 'list_all_commands' function | |
105 | + eval "$(declare -f __git_list_all_commands | \ | |
106 | + sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')" | |
107 | + | |
108 | + # Wrap the 'list_all_commands' function with extra hub commands | |
109 | + __git_list_all_commands() { | |
110 | + cat <<-EOF | |
111 | +alias | |
112 | +pull-request | |
113 | +fork | |
114 | +create | |
115 | +browse | |
116 | +compare | |
117 | +ci-status | |
118 | +EOF | |
119 | + __git_list_all_commands_without_hub | |
120 | + } | |
121 | + | |
122 | + # Ensure cached commands are cleared | |
123 | + __git_all_commands="" | |
124 | +} | |
125 | + | |
126 | +# redefine _hub to a much smaller function in the steady state | |
127 | +_hub () { | |
128 | + # only attempt to intercept the normal "_git" helper functions once | |
129 | + (( $+__hub_func_replacement_done )) || | |
130 | + () { | |
131 | + # At this stage in the shell's execution the "_git" function has not yet | |
132 | + # been autoloaded, so the "_git_commands" or "__git_list_all_commands" | |
133 | + # functions will not be defined. Call it now (with a bogus no-op service | |
134 | + # to prevent premature completion) so that we can wrap them. | |
135 | + if declare -f _git >& /dev/null ; then | |
136 | + _hub_noop () { __hub_zsh_provided=1 } # zsh-provided will call this one | |
137 | + __hub_noop_main () { __hub_git_provided=1 } # git-provided will call this one | |
138 | + local service=hub_noop | |
139 | + _git | |
140 | + unfunction _hub_noop | |
141 | + unfunction __hub_noop_main | |
142 | + service=git | |
143 | + fi | |
144 | + | |
145 | + if (( $__hub_zsh_provided )) ; then | |
146 | + __hub_setup_zsh_fns | |
147 | + elif (( $__hub_git_provided )) ; then | |
148 | + __hub_setup_bash_fns | |
149 | + fi | |
150 | + | |
151 | + __hub_func_replacement_done=1 | |
152 | + } | |
153 | + | |
154 | + # Now perform the actual completion, allowing the "_git" function to call our | |
155 | + # replacement "_git_commands" function as needed. Both versions expect | |
156 | + # service=git or they will call nonexistent routines or end up in an infinite | |
157 | + # loop. | |
158 | + service=git | |
159 | + declare -f _git >& /dev/null && _git | |
160 | +} | |
161 | + | |
162 | +# make sure we actually attempt to complete on the first "tab" from the user | |
163 | +_hub |
... | ... | @@ -2,12 +2,12 @@ |
2 | 2 | |
3 | 3 | # |
4 | 4 | # gulp-autocompletion-zsh |
5 | -# | |
5 | +# | |
6 | 6 | # Autocompletion for your gulp.js tasks |
7 | 7 | # |
8 | 8 | # Copyright(c) 2014 André König <andre.koenig@posteo.de> |
9 | 9 | # MIT Licensed |
10 | -# | |
10 | +# | |
11 | 11 | |
12 | 12 | # |
13 | 13 | # André König |
... | ... | @@ -20,7 +20,7 @@ |
20 | 20 | # in the current directory. |
21 | 21 | # |
22 | 22 | function $$gulp_completion { |
23 | - compls="$(grep -Eo "gulp.task\((['\"](([a-zA-Z0-9]|-)*)['\"],)" gulpfile.js 2>/dev/null | grep -Eo "['\"](([a-zA-Z0-9]|-)*)['\"]" | sed s/"['\"]"//g | sort)" | |
23 | + compls=$(gulp --tasks-simple 2>/dev/null) | |
24 | 24 | |
25 | 25 | completions=(${=compls}) |
26 | 26 | compadd -- $completions |
... | ... | @@ -13,11 +13,14 @@ fi |
13 | 13 | |
14 | 14 | |
15 | 15 | # Bind terminal-specific up and down keys |
16 | - | |
16 | +# Bind in both emacs and vi modes so it works in both, and is not | |
17 | +# sensitive to whether this is loaded before or after the vi-mode plugin | |
17 | 18 | if [[ -n "$terminfo[kcuu1]" ]]; then |
18 | - bindkey "$terminfo[kcuu1]" history-substring-search-up | |
19 | + bindkey -M emacs "$terminfo[kcuu1]" history-substring-search-up | |
20 | + bindkey -M viins "$terminfo[kcuu1]" history-substring-search-up | |
19 | 21 | fi |
20 | 22 | if [[ -n "$terminfo[kcud1]" ]]; then |
21 | - bindkey "$terminfo[kcud1]" history-substring-search-down | |
23 | + bindkey -M emacs "$terminfo[kcud1]" history-substring-search-down | |
24 | + bindkey -M viins "$terminfo[kcud1]" history-substring-search-down | |
22 | 25 | fi |
23 | 26 |
... | ... | @@ -76,10 +76,12 @@ cat >> $plugin_basename.plugin.zsh <<EOF |
76 | 76 | # Bind terminal-specific up and down keys |
77 | 77 | |
78 | 78 | if [[ -n "\$terminfo[kcuu1]" ]]; then |
79 | - bindkey "\$terminfo[kcuu1]" history-substring-search-up | |
79 | + bindkey -M emacs "\$terminfo[kcuu1]" history-substring-search-up | |
80 | + bindkey -M viins "\$terminfo[kcuu1]" history-substring-search-up | |
80 | 81 | fi |
81 | 82 | if [[ -n "\$terminfo[kcud1]" ]]; then |
82 | - bindkey "\$terminfo[kcud1]" history-substring-search-down | |
83 | + bindkey -M emacs "\$terminfo[kcud1]" history-substring-search-down | |
84 | + bindkey -M viins "\$terminfo[kcud1]" history-substring-search-down | |
83 | 85 | fi |
84 | 86 | |
85 | 87 | EOF |
... | ... | @@ -14,8 +14,7 @@ alias hgo='hg outgoing' |
14 | 14 | alias hgp='hg push' |
15 | 15 | alias hgs='hg status' |
16 | 16 | alias hgsl='hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n" ' |
17 | -# this is the 'git commit --amend' equivalent | |
18 | -alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip' | |
17 | +alias hgca='hg commit --amend' | |
19 | 18 | # list unresolved files (since hg does not list unmerged files in the status command) |
20 | 19 | alias hgun='hg resolve --list' |
21 | 20 |
... | ... | @@ -13,6 +13,7 @@ function web_search() { |
13 | 13 | yandex "https://yandex.ru/yandsearch?text=" |
14 | 14 | github "https://github.com/search?q=" |
15 | 15 | baidu "https://www.baidu.com/s?wd=" |
16 | + ecosia "https://www.ecosia.org/search?q=" | |
16 | 17 | ) |
17 | 18 | |
18 | 19 | # check whether the search engine is supported |
... | ... | @@ -43,6 +44,7 @@ alias ddg='web_search duckduckgo' |
43 | 44 | alias yandex='web_search yandex' |
44 | 45 | alias github='web_search github' |
45 | 46 | alias baidu='web_search baidu' |
47 | +alias ecosia='web_search ecosia' | |
46 | 48 | |
47 | 49 | #add your own !bang searches here |
48 | 50 | alias wiki='web_search duckduckgo \!w' |
... | ... | @@ -105,8 +105,7 @@ colorize output of the tools, via their config files (check out e.g. n-cd.conf, |
105 | 105 | it uses this). |
106 | 106 | |
107 | 107 | ## Performance |
108 | -ZNT are fastest with Zsh before 5.0.8 and starting from 5.2 (the version yet to | |
109 | -be released). | |
108 | +ZNT are fastest with Zsh before 5.0.6 and starting from 5.2 | |
110 | 109 | |
111 | 110 | |
112 | 111 | vim:filetype=conf |
... | ... | @@ -116,15 +116,15 @@ _nlist_setup_user_vars() { |
116 | 116 | fi |
117 | 117 | } |
118 | 118 | |
119 | -_nlist_coloring_list_into_col_list() { | |
119 | +_nlist_colorify_disp_list() { | |
120 | 120 | local col=$'\x1b[00;34m' reset=$'\x1b[0m' |
121 | 121 | [ -n "$NLIST_COLORING_COLOR" ] && col="$NLIST_COLORING_COLOR" |
122 | 122 | [ -n "$NLIST_COLORING_END_COLOR" ] && reset="$NLIST_COLORING_END_COLOR" |
123 | 123 | |
124 | 124 | if [ "$NLIST_COLORING_MATCH_MULTIPLE" -eq 1 ]; then |
125 | - col_list=( "${(@)list//(#mi)$~NLIST_COLORING_PATTERN/$col${MATCH}$reset}" ) | |
125 | + disp_list=( "${(@)disp_list//(#mi)$~NLIST_COLORING_PATTERN/$col${MATCH}$reset}" ) | |
126 | 126 | else |
127 | - col_list=( "${(@)list/(#mi)$~NLIST_COLORING_PATTERN/$col${MATCH}$reset}" ) | |
127 | + disp_list=( "${(@)disp_list/(#mi)$~NLIST_COLORING_PATTERN/$col${MATCH}$reset}" ) | |
128 | 128 | fi |
129 | 129 | } |
130 | 130 | |
... | ... | @@ -154,7 +154,7 @@ integer inner_width=term_width-3 |
154 | 154 | integer page_height=inner_height |
155 | 155 | integer page_width=inner_width |
156 | 156 | |
157 | -typeset -a list col_list disp_list | |
157 | +typeset -a list disp_list | |
158 | 158 | integer last_element=$# |
159 | 159 | local action |
160 | 160 | local final_key |
... | ... | @@ -224,19 +224,17 @@ zcurses timeout main -1 |
224 | 224 | key="" |
225 | 225 | keypad="" |
226 | 226 | |
227 | -list=( "$@" ) | |
228 | -last_element="$#list" | |
227 | +# This loop makes script faster on some Zsh's (e.g. 5.0.8) | |
228 | +repeat 1; do | |
229 | + list=( "$@" ) | |
230 | +done | |
229 | 231 | |
230 | -integer is_colored=0 | |
231 | -if [[ -z "$NLIST_SEARCH_BUFFER" && -n "$NLIST_COLORING_PATTERN" ]]; then | |
232 | - is_colored=1 | |
233 | - _nlist_coloring_list_into_col_list | |
234 | -fi | |
232 | +last_element="$#list" | |
235 | 233 | |
236 | 234 | while (( 1 )); do |
237 | 235 | # Do searching (filtering with string) |
238 | 236 | if [ -n "$NLIST_SEARCH_BUFFER" ]; then |
239 | - # Compute new list, col_list ? | |
237 | + # Compute new list? | |
240 | 238 | if [[ "$NLIST_SEARCH_BUFFER" != "$prev_search_buffer" || "$NLIST_IS_UNIQ_MODE" -ne "$prev_uniq_mode" ]]; then |
241 | 239 | prev_search_buffer="$NLIST_SEARCH_BUFFER" |
242 | 240 | prev_uniq_mode="$NLIST_IS_UNIQ_MODE" |
... | ... | @@ -245,7 +243,9 @@ while (( 1 )); do |
245 | 243 | |
246 | 244 | # Take all elements, including duplicates and non-selectables |
247 | 245 | typeset +U list |
248 | - list=( "$@" ) | |
246 | + repeat 1; do | |
247 | + list=( "$@" ) | |
248 | + done | |
249 | 249 | |
250 | 250 | # Remove non-selectable elements |
251 | 251 | [ "$#NLIST_NONSELECTABLE_ELEMENTS" -gt 0 ] && for i in "${(nO)NLIST_NONSELECTABLE_ELEMENTS[@]}"; do |
... | ... | @@ -290,7 +290,7 @@ while (( 1 )); do |
290 | 290 | disp_list=( "${(@)disp_list//(#mi)($~colsearch_pattern)/$red${MATCH}$reset}" ) |
291 | 291 | fi |
292 | 292 | |
293 | - # We have display list, lets replace newlines with "\n" when needed (1/3) | |
293 | + # We have display list, lets replace newlines with "\n" when needed (1/2) | |
294 | 294 | [ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" ) |
295 | 295 | fi |
296 | 296 | |
... | ... | @@ -302,7 +302,7 @@ while (( 1 )); do |
302 | 302 | # There is no search, but there was in previous loop |
303 | 303 | # OR |
304 | 304 | # Uniq mode was entered or left out |
305 | - # -> compute new list (maybe also col_list) | |
305 | + # -> compute new list | |
306 | 306 | if [[ -n "$prev_search_buffer" || "$NLIST_IS_UNIQ_MODE" -ne "$prev_uniq_mode" ]]; then |
307 | 307 | prev_search_buffer="" |
308 | 308 | prev_uniq_mode="$NLIST_IS_UNIQ_MODE" |
... | ... | @@ -311,7 +311,9 @@ while (( 1 )); do |
311 | 311 | |
312 | 312 | # Take all elements, including duplicates and non-selectables |
313 | 313 | typeset +U list |
314 | - list=( "$@" ) | |
314 | + repeat 1; do | |
315 | + list=( "$@" ) | |
316 | + done | |
315 | 317 | |
316 | 318 | # Remove non-selectable elements only when in uniq mode |
317 | 319 | [ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && [ "$#NLIST_NONSELECTABLE_ELEMENTS" -gt 0 ] && |
... | ... | @@ -322,13 +324,6 @@ while (( 1 )); do |
322 | 324 | # Remove duplicates when in uniq mode |
323 | 325 | [ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && typeset -U list |
324 | 326 | |
325 | - # Apply coloring pattern (when not with search query) | |
326 | - is_colored=0 | |
327 | - if [ -n "$NLIST_COLORING_PATTERN" ]; then | |
328 | - is_colored=1 | |
329 | - _nlist_coloring_list_into_col_list | |
330 | - fi | |
331 | - | |
332 | 327 | last_element="$#list" |
333 | 328 | # Called after processing list |
334 | 329 | _nlist_verify_vars |
... | ... | @@ -340,22 +335,14 @@ while (( 1 )); do |
340 | 335 | integer end_idx=$(( NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN + page_height - 1 )) |
341 | 336 | [ "$end_idx" -gt "$last_element" ] && end_idx=last_element |
342 | 337 | |
343 | - if [ "$is_colored" -eq 0 ]; then | |
344 | - if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then | |
345 | - prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" | |
346 | - disp_list=( "${(@)list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" ) | |
338 | + if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then | |
339 | + prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" | |
340 | + disp_list=( "${(@)list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" ) | |
347 | 341 | |
348 | - # We have display list, lets replace newlines with "\n" when needed (2/3) | |
349 | - [ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" ) | |
350 | - fi | |
351 | - else | |
352 | - if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then | |
353 | - prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" | |
354 | - disp_list=( "${(@)col_list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" ) | |
342 | + [ -n "$NLIST_COLORING_PATTERN" ] && _nlist_colorify_disp_list | |
355 | 343 | |
356 | - # We have display list, lets replace newlines with "\n" when needed (3/3) | |
357 | - [ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" ) | |
358 | - fi | |
344 | + # We have display list, lets replace newlines with "\n" when needed (2/2) | |
345 | + [ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" ) | |
359 | 346 | fi |
360 | 347 | |
361 | 348 | # Output the list |
... | ... | @@ -380,6 +367,11 @@ while (( 1 )); do |
380 | 367 | fi |
381 | 368 | |
382 | 369 | zcurses border main |
370 | + | |
371 | + local top_msg="${(C)ZSH_NAME} $ZSH_VERSION, shell level $SHLVL, $USER" | |
372 | + zcurses move main 0 $(( term_width / 2 - $#top_msg / 2 )) | |
373 | + zcurses string main $top_msg | |
374 | + | |
383 | 375 | zcurses refresh main inner |
384 | 376 | zcurses move main $(( term_height - 1 - 1 )) $(( status_msg_strlen + 2 )) |
385 | 377 |
... | ... | @@ -32,7 +32,11 @@ if [ -t 0 ]; then |
32 | 32 | return 1 |
33 | 33 | fi |
34 | 34 | |
35 | - list=( `"$@"` ) | |
35 | + # This loop makes script faster on some Zsh's (e.g. 5.0.8) | |
36 | + repeat 1; do | |
37 | + list=( `"$@"` ) | |
38 | + done | |
39 | + | |
36 | 40 | # TODO: $? doesn't reach user |
37 | 41 | [ "$?" -eq 127 ] && return $? |
38 | 42 | else |
... | ... | @@ -42,7 +46,10 @@ else |
42 | 46 | return 1 |
43 | 47 | fi |
44 | 48 | |
45 | - list=( "${(@f)"$(<&0)"}" ) | |
49 | + # This loop makes script faster on some Zsh's (e.g. 5.0.8) | |
50 | + repeat 1; do | |
51 | + list=( "${(@f)"$(<&0)"}" ) | |
52 | + done | |
46 | 53 | |
47 | 54 | if [[ ! -c /dev/tty ]]; then |
48 | 55 | exec <&2 |
... | ... | @@ -43,7 +43,8 @@ CURRENT_BG='NONE' |
43 | 43 | # This is defined using a Unicode escape sequence so it is unambiguously readable, regardless of |
44 | 44 | # what font the user is viewing this source code in. Do not replace the |
45 | 45 | # escape sequence with a single literal character. |
46 | - SEGMENT_SEPARATOR=$'\ue0b0' # | |
46 | + # Do not change this! Do not make it '\u2b80'; that is the old, wrong code point. | |
47 | + SEGMENT_SEPARATOR=$'\ue0b0' | |
47 | 48 | } |
48 | 49 | |
49 | 50 | # Begin a segment |
... | ... | @@ -14,9 +14,9 @@ ZSH_THEME_GIT_PROMPT_CLEAN="" |
14 | 14 | |
15 | 15 | # Customized git status, oh-my-zsh currently does not allow render dirty status before branch |
16 | 16 | git_custom_status() { |
17 | - local cb=$(current_branch) | |
17 | + local cb=$(git_current_branch) | |
18 | 18 | if [ -n "$cb" ]; then |
19 | - echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" | |
19 | + echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(git_current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" | |
20 | 20 | fi |
21 | 21 | } |
22 | 22 |
1 | 1 | # ZSH Theme emulating the Fish shell's default prompt. |
2 | 2 | |
3 | 3 | _fishy_collapsed_wd() { |
4 | - echo $(pwd | perl -pe " | |
4 | + echo $(pwd | perl -pe ' | |
5 | 5 | BEGIN { |
6 | - binmode STDIN, ':encoding(UTF-8)'; | |
7 | - binmode STDOUT, ':encoding(UTF-8)'; | |
8 | - }; s|^$HOME|~|g; s|/([^/])[^/]*(?=/)|/\$1|g | |
9 | -") | |
10 | -} | |
6 | + binmode STDIN, ":encoding(UTF-8)"; | |
7 | + binmode STDOUT, ":encoding(UTF-8)"; | |
8 | + }; s|^$ENV{HOME}|~|g; s|/([^/.])[^/]*(?=/)|/$1|g; s|/\.([^/])[^/]*(?=/)|/.$1|g | |
9 | +') | |
10 | +} | |
11 | 11 | |
12 | 12 | local user_color='green'; [ $UID -eq 0 ] && user_color='red' |
13 | 13 | PROMPT='%n@%m %{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$reset_color%}%(!.#.>) ' |
... | ... | @@ -4,7 +4,7 @@ PROMPT=' |
4 | 4 | %{$fg_bold[gray]%}%~%{$fg_bold[blue]%}%{$fg_bold[blue]%} % %{$reset_color%} |
5 | 5 | %{$fg[green]%}➞ %{$reset_color%' |
6 | 6 | |
7 | -RPROMPT='$(git_prompt_info) $(rvm)' | |
7 | +RPROMPT='$(git_prompt_info) ${rvm}' | |
8 | 8 | |
9 | 9 | ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}[git:" |
10 | 10 | ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" |
1 | +# Depends on the git plugin for work_in_progress() | |
2 | + | |
1 | 3 | ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}[" |
2 | 4 | ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" |
3 | 5 | ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" |
... | ... | @@ -5,9 +7,9 @@ ZSH_THEME_GIT_PROMPT_CLEAN="" |
5 | 7 | |
6 | 8 | #Customized git status, oh-my-zsh currently does not allow render dirty status before branch |
7 | 9 | git_custom_status() { |
8 | - local cb=$(current_branch) | |
10 | + local cb=$(git_current_branch) | |
9 | 11 | if [ -n "$cb" ]; then |
10 | - echo "$(parse_git_dirty)%{$fg_bold[yellow]%}$(work_in_progress)%{$reset_color%}$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" | |
12 | + echo "$(parse_git_dirty)%{$fg_bold[yellow]%}$(work_in_progress)%{$reset_color%}$ZSH_THEME_GIT_PROMPT_PREFIX$(git_current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" | |
11 | 13 | fi |
12 | 14 | } |
13 | 15 |
... | ... | @@ -9,7 +9,7 @@ function josh_prompt { |
9 | 9 | (( spare_width = ${COLUMNS} )) |
10 | 10 | prompt=" " |
11 | 11 | |
12 | - branch=$(current_branch) | |
12 | + branch=$(git_current_branch) | |
13 | 13 | ruby_version=$(rvm_prompt_info || rbenv_prompt_info) |
14 | 14 | path_size=${#PWD} |
15 | 15 | branch_size=${#branch} |
... | ... | @@ -31,7 +31,7 @@ function josh_prompt { |
31 | 31 | prompt=" $prompt" |
32 | 32 | done |
33 | 33 | |
34 | - prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(current_branch)" | |
34 | + prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(git_current_branch)" | |
35 | 35 | |
36 | 36 | echo $prompt |
37 | 37 | } |
1 | -# Needs Git plugin for current_branch method | |
2 | - | |
3 | 1 | # Color shortcuts |
4 | 2 | RED=$fg[red] |
5 | 3 | YELLOW=$fg[yellow] |
... | ... | @@ -40,4 +38,4 @@ ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$WHITE%}]" |
40 | 38 | PROMPT=' |
41 | 39 | %{$GREEN_BOLD%}%n@%m%{$WHITE%}:%{$YELLOW%}%~%u$(parse_git_dirty)$(git_prompt_ahead)%{$RESET_COLOR%} |
42 | 40 | %{$BLUE%}>%{$RESET_COLOR%} ' |
43 | -RPROMPT='%{$GREEN_BOLD%}$(current_branch)$(git_prompt_short_sha)$(git_prompt_status)%{$RESET_COLOR%}' | |
41 | +RPROMPT='%{$GREEN_BOLD%}$(git_current_branch)$(git_prompt_short_sha)$(git_prompt_status)%{$RESET_COLOR%}' |
... | ... | @@ -5,7 +5,7 @@ function my_git_prompt() { |
5 | 5 | STATUS="" |
6 | 6 | |
7 | 7 | # is branch ahead? |
8 | - if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then | |
8 | + if $(echo "$(git log origin/$(git_current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then | |
9 | 9 | STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" |
10 | 10 | fi |
11 | 11 | |
... | ... | @@ -37,7 +37,7 @@ function my_git_prompt() { |
37 | 37 | } |
38 | 38 | |
39 | 39 | function my_current_branch() { |
40 | - echo $(current_branch || echo "(no branch)") | |
40 | + echo $(git_current_branch || echo "(no branch)") | |
41 | 41 | } |
42 | 42 | |
43 | 43 | function ssh_connection() { |
... | ... | @@ -28,7 +28,7 @@ git_dirty() { |
28 | 28 | } |
29 | 29 | |
30 | 30 | git_prompt() { |
31 | - local cb=$(current_branch) | |
31 | + local cb=$(git_current_branch) | |
32 | 32 | if [ -n "$cb" ]; then |
33 | 33 | local repo_path=$(git_repo_path) |
34 | 34 | echo " %{$fg_bold[grey]%}$cb %{$fg[white]%}$(git_commit_id)%{$reset_color%}$(git_mode)$(git_dirty)" |