12f416b125501e9faaae061bc55b833158348156
- Author
- Hauke Stange <hauke@jimdo.com>
- Committer
- Hauke Stange <hauke@jimdo.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/lib/functions.zsh b/lib/functions.zsh
2index d2dcadd0cb4d7235c8876556eb863140c315df12..63ab755cf72b1094975ef017cd71727c756e1943 100644
3--- a/lib/functions.zsh
4+++ b/lib/functions.zsh
5@@ -1,5 +1,5 @@
6 function zsh_stats() {
7- history | awk '{print $2}' | sort | uniq -c | sort -rn | head
8+ history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n20
9 }
10
11 function uninstall_oh_my_zsh() {
12diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh
13index 39d3ef36a05280e9e285412afecba861278bd73c..71f22f7bdd65a3801b5ba1175148b9ff63630081 100644
14--- a/plugins/debian/debian.plugin.zsh
15+++ b/plugins/debian/debian.plugin.zsh
16@@ -61,7 +61,8 @@ if [[ $use_sudo -eq 1 ]]; then
17 # Install all .deb files in the current directory.
18 # Warning: you will need to put the glob in single quotes if you use:
19 # glob_subst
20- alias di='sudo dpkg -i ./*.deb'
21+ alias dia='sudo dpkg -i ./*.deb'
22+ alias di='sudo dpkg -i'
23
24 # Remove ALL kernel images and headers EXCEPT the one in use
25 alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \
26@@ -100,7 +101,8 @@ else
27
28 # Install all .deb files in the current directory
29 # Assumes glob_subst is off
30- alias di='su -lc "dpkg -i ./*.deb" root'
31+ alias dia='su -lc "dpkg -i ./*.deb" root'
32+ alias di='su -lc "dpkg -i" root'
33
34 # Remove ALL kernel images and headers EXCEPT the one in use
35 alias kclean='su -lc '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) \
36diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
37index d3d3f702a362c6ebe24109369da2e6d1a8652464..71388c53a160de66d5237e146c6f77ffe75507f9 100644
38--- a/plugins/git/git.plugin.zsh
39+++ b/plugins/git/git.plugin.zsh
40@@ -39,6 +39,10 @@ compdef _git gm=git-merge
41 alias grh='git reset HEAD'
42 alias grhh='git reset HEAD --hard'
43
44+# Will cd into the top of the current repository
45+# or submodule.
46+alias grt='cd $(git rev-parse --show-toplevel || echo ".")'
47+
48 # Git and svn mix
49 alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
50 compdef git-svn-dcommit-push=git
51diff --git a/plugins/gitfast/_git b/plugins/gitfast/_git
52new file mode 100644
53index 0000000000000000000000000000000000000000..45775021fff11011a98b90a6b8ebaa72d3d0cd9f
54--- /dev/null
55+++ b/plugins/gitfast/_git
56@@ -0,0 +1,78 @@
57+#compdef git gitk
58+
59+# zsh completion wrapper for git
60+#
61+# You need git's bash completion script installed somewhere, by default on the
62+# same directory as this script.
63+#
64+# If your script is on ~/.git-completion.sh instead, you can configure it on
65+# your ~/.zshrc:
66+#
67+# zstyle ':completion:*:*:git:*' script ~/.git-completion.sh
68+#
69+# The recommended way to install this script is to copy to
70+# '~/.zsh/completion/_git', and then add the following to your ~/.zshrc file:
71+#
72+# fpath=(~/.zsh/completion $fpath)
73+
74+complete ()
75+{
76+ # do nothing
77+ return 0
78+}
79+
80+zstyle -s ":completion:*:*:git:*" script script
81+test -z "$script" && script="$(dirname ${funcsourcetrace[1]%:*})"/git-completion.bash
82+ZSH_VERSION='' . "$script"
83+
84+__gitcomp ()
85+{
86+ emulate -L zsh
87+
88+ local cur_="${3-$cur}"
89+
90+ case "$cur_" in
91+ --*=)
92+ ;;
93+ *)
94+ local c IFS=$' \t\n'
95+ local -a array
96+ for c in ${=1}; do
97+ c="$c${4-}"
98+ case $c in
99+ --*=*|*.) ;;
100+ *) c="$c " ;;
101+ esac
102+ array+=("$c")
103+ done
104+ compset -P '*[=:]'
105+ compadd -Q -S '' -p "${2-}" -a -- array && _ret=0
106+ ;;
107+ esac
108+}
109+
110+__gitcomp_nl ()
111+{
112+ emulate -L zsh
113+
114+ local IFS=$'\n'
115+ compset -P '*[=:]'
116+ compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
117+}
118+
119+_git ()
120+{
121+ local _ret=1
122+ () {
123+ emulate -L ksh
124+ local cur cword prev
125+ cur=${words[CURRENT-1]}
126+ prev=${words[CURRENT-2]}
127+ let cword=CURRENT-1
128+ __${service}_main
129+ }
130+ let _ret && _default -S '' && _ret=0
131+ return _ret
132+}
133+
134+_git
135diff --git a/plugins/gitfast/git-completion.bash b/plugins/gitfast/git-completion.bash
136new file mode 100644
137index 0000000000000000000000000000000000000000..be800e09bdf0656951c415105e0d32ce0b0edf9e
138--- /dev/null
139+++ b/plugins/gitfast/git-completion.bash
140@@ -0,0 +1,2483 @@
141+#!bash
142+#
143+# bash/zsh completion support for core Git.
144+#
145+# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
146+# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
147+# Distributed under the GNU General Public License, version 2.0.
148+#
149+# The contained completion routines provide support for completing:
150+#
151+# *) local and remote branch names
152+# *) local and remote tag names
153+# *) .git/remotes file names
154+# *) git 'subcommands'
155+# *) tree paths within 'ref:path/to/file' expressions
156+# *) common --long-options
157+#
158+# To use these routines:
159+#
160+# 1) Copy this file to somewhere (e.g. ~/.git-completion.sh).
161+# 2) Add the following line to your .bashrc/.zshrc:
162+# source ~/.git-completion.sh
163+# 3) Consider changing your PS1 to also show the current branch,
164+# see git-prompt.sh for details.
165+
166+if [[ -n ${ZSH_VERSION-} ]]; then
167+ autoload -U +X bashcompinit && bashcompinit
168+fi
169+
170+case "$COMP_WORDBREAKS" in
171+*:*) : great ;;
172+*) COMP_WORDBREAKS="$COMP_WORDBREAKS:"
173+esac
174+
175+# __gitdir accepts 0 or 1 arguments (i.e., location)
176+# returns location of .git repo
177+__gitdir ()
178+{
179+ # Note: this function is duplicated in git-prompt.sh
180+ # When updating it, make sure you update the other one to match.
181+ if [ -z "${1-}" ]; then
182+ if [ -n "${__git_dir-}" ]; then
183+ echo "$__git_dir"
184+ elif [ -n "${GIT_DIR-}" ]; then
185+ test -d "${GIT_DIR-}" || return 1
186+ echo "$GIT_DIR"
187+ elif [ -d .git ]; then
188+ echo .git
189+ else
190+ git rev-parse --git-dir 2>/dev/null
191+ fi
192+ elif [ -d "$1/.git" ]; then
193+ echo "$1/.git"
194+ else
195+ echo "$1"
196+ fi
197+}
198+
199+__gitcomp_1 ()
200+{
201+ local c IFS=$' \t\n'
202+ for c in $1; do
203+ c="$c$2"
204+ case $c in
205+ --*=*|*.) ;;
206+ *) c="$c " ;;
207+ esac
208+ printf '%s\n' "$c"
209+ done
210+}
211+
212+# The following function is based on code from:
213+#
214+# bash_completion - programmable completion functions for bash 3.2+
215+#
216+# Copyright © 2006-2008, Ian Macdonald <ian@caliban.org>
217+# © 2009-2010, Bash Completion Maintainers
218+# <bash-completion-devel@lists.alioth.debian.org>
219+#
220+# This program is free software; you can redistribute it and/or modify
221+# it under the terms of the GNU General Public License as published by
222+# the Free Software Foundation; either version 2, or (at your option)
223+# any later version.
224+#
225+# This program is distributed in the hope that it will be useful,
226+# but WITHOUT ANY WARRANTY; without even the implied warranty of
227+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
228+# GNU General Public License for more details.
229+#
230+# You should have received a copy of the GNU General Public License
231+# along with this program; if not, write to the Free Software Foundation,
232+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
233+#
234+# The latest version of this software can be obtained here:
235+#
236+# http://bash-completion.alioth.debian.org/
237+#
238+# RELEASE: 2.x
239+
240diff --git a/plugins/gitfast/git-prompt.sh b/plugins/gitfast/git-prompt.sh
241new file mode 100644
242index 0000000000000000000000000000000000000000..bf20491ec33e467f6b9591d94a2e27bc9e3d93e9
243--- /dev/null
244+++ b/plugins/gitfast/git-prompt.sh
245@@ -0,0 +1,290 @@
246+# bash/zsh git prompt support
247+#
248+# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
249+# Distributed under the GNU General Public License, version 2.0.
250+#
251+# This script allows you to see the current branch in your prompt.
252+#
253+# To enable:
254+#
255+# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
256+# 2) Add the following line to your .bashrc/.zshrc:
257+# source ~/.git-prompt.sh
258+# 3) Change your PS1 to also show the current branch:
259+# Bash: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
260+# ZSH: PS1='[%n@%m %c$(__git_ps1 " (%s)")]\$ '
261+#
262+# The argument to __git_ps1 will be displayed only if you are currently
263+# in a git repository. The %s token will be the name of the current
264+# branch.
265+#
266+# In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty value,
267+# unstaged (*) and staged (+) changes will be shown next to the branch
268+# name. You can configure this per-repository with the
269+# bash.showDirtyState variable, which defaults to true once
270+# GIT_PS1_SHOWDIRTYSTATE is enabled.
271+#
272+# You can also see if currently something is stashed, by setting
273+# GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed,
274+# then a '$' will be shown next to the branch name.
275+#
276+# If you would like to see if there're untracked files, then you can set
277+# GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're untracked
278+# files, then a '%' will be shown next to the branch name.
279+#
280+# If you would like to see the difference between HEAD and its upstream,
281+# set GIT_PS1_SHOWUPSTREAM="auto". A "<" indicates you are behind, ">"
282+# indicates you are ahead, "<>" indicates you have diverged and "="
283+# indicates that there is no difference. You can further control
284+# behaviour by setting GIT_PS1_SHOWUPSTREAM to a space-separated list
285+# of values:
286+#
287+# verbose show number of commits ahead/behind (+/-) upstream
288+# legacy don't use the '--count' option available in recent
289+# versions of git-rev-list
290+# git always compare HEAD to @{upstream}
291+# svn always compare HEAD to your SVN upstream
292+#
293+# By default, __git_ps1 will compare HEAD to your SVN upstream if it can
294+# find one, or @{upstream} otherwise. Once you have set
295+# GIT_PS1_SHOWUPSTREAM, you can override it on a per-repository basis by
296+# setting the bash.showUpstream config variable.
297+
298+# __gitdir accepts 0 or 1 arguments (i.e., location)
299+# returns location of .git repo
300+__gitdir ()
301+{
302+ # Note: this function is duplicated in git-completion.bash
303+ # When updating it, make sure you update the other one to match.
304+ if [ -z "${1-}" ]; then
305+ if [ -n "${__git_dir-}" ]; then
306+ echo "$__git_dir"
307+ elif [ -n "${GIT_DIR-}" ]; then
308+ test -d "${GIT_DIR-}" || return 1
309+ echo "$GIT_DIR"
310+ elif [ -d .git ]; then
311+ echo .git
312+ else
313+ git rev-parse --git-dir 2>/dev/null
314+ fi
315+ elif [ -d "$1/.git" ]; then
316+ echo "$1/.git"
317+ else
318+ echo "$1"
319+ fi
320+}
321+
322+# stores the divergence from upstream in $p
323+# used by GIT_PS1_SHOWUPSTREAM
324+__git_ps1_show_upstream ()
325+{
326+ local key value
327+ local svn_remote svn_url_pattern count n
328+ local upstream=git legacy="" verbose=""
329+
330+ svn_remote=()
331+ # get some config options from git-config
332+ local output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"
333+ while read -r key value; do
334+ case "$key" in
335+ bash.showupstream)
336+ GIT_PS1_SHOWUPSTREAM="$value"
337+ if [[ -z "${GIT_PS1_SHOWUPSTREAM}" ]]; then
338+ p=""
339+ return
340+ fi
341+ ;;
342+ svn-remote.*.url)
343+ svn_remote[ $((${#svn_remote[@]} + 1)) ]="$value"
344+ svn_url_pattern+="\\|$value"
345diff --git a/plugins/gitfast/gitfast.plugin.zsh b/plugins/gitfast/gitfast.plugin.zsh
346new file mode 100644
347index 0000000000000000000000000000000000000000..7e50cf721cb33e5f090379cb43b2c53950a17902
348--- /dev/null
349+++ b/plugins/gitfast/gitfast.plugin.zsh
350@@ -0,0 +1,7 @@
351+dir=$(dirname $0)
352+source $dir/../git/git.plugin.zsh
353+source $dir/git-prompt.sh
354+
355+function git_prompt_info() {
356+ __git_ps1 "${ZSH_THEME_GIT_PROMPT_PREFIX//\%/%%}%s${ZSH_THEME_GIT_PROMPT_SUFFIX//\%/%%}"
357+}
358diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh
359index e8af2f49d5d2f87daeae99b23d59fecdc7b44d26..f250c2a27c183af730dcad34993bc15016aaec02 100644
360--- a/plugins/mvn/mvn.plugin.zsh
361+++ b/plugins/mvn/mvn.plugin.zsh
362@@ -1,6 +1,59 @@
363+# mvn-color based on https://gist.github.com/1027800
364+export BOLD=`tput bold`
365+export UNDERLINE_ON=`tput smul`
366+export UNDERLINE_OFF=`tput rmul`
367+export TEXT_BLACK=`tput setaf 0`
368+export TEXT_RED=`tput setaf 1`
369+export TEXT_GREEN=`tput setaf 2`
370+export TEXT_YELLOW=`tput setaf 3`
371+export TEXT_BLUE=`tput setaf 4`
372+export TEXT_MAGENTA=`tput setaf 5`
373+export TEXT_CYAN=`tput setaf 6`
374+export TEXT_WHITE=`tput setaf 7`
375+export BACKGROUND_BLACK=`tput setab 0`
376+export BACKGROUND_RED=`tput setab 1`
377+export BACKGROUND_GREEN=`tput setab 2`
378+export BACKGROUND_YELLOW=`tput setab 3`
379+export BACKGROUND_BLUE=`tput setab 4`
380+export BACKGROUND_MAGENTA=`tput setab 5`
381+export BACKGROUND_CYAN=`tput setab 6`
382+export BACKGROUND_WHITE=`tput setab 7`
383+export RESET_FORMATTING=`tput sgr0`
384+
385+
386+# Wrapper function for Maven's mvn command.
387+mvn-color()
388+{
389+ # Filter mvn output using sed
390+ mvn $@ | sed -e "s/\(\[INFO\]\ \-.*\)/${TEXT_BLUE}${BOLD}\1/g" \
391+ -e "s/\(\[INFO\]\ \[.*\)/${RESET_FORMATTING}${BOLD}\1${RESET_FORMATTING}/g" \
392+ -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \
393+ -e "s/\(\[WARNING\].*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}/g" \
394+ -e "s/\(\[ERROR\].*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}/g" \
395diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh
396index 91b0279c565cf503ce159fa9e55c0353df37f63e..171f00ef54cfe0a518a6fec18bbd9a8498a456f1 100755
397--- a/plugins/sublime/sublime.plugin.zsh
398+++ b/plugins/sublime/sublime.plugin.zsh
399@@ -2,7 +2,11 @@
400 #unamestr = 'uname'
401
402 if [[ $('uname') == 'Linux' ]]; then
403- alias st='/usr/bin/sublime_text&'
404+ if [ -f '/usr/bin/sublime_text' ]; then
405+ alias st='/usr/bin/sublime_text&'
406+ else
407+ alias st='/usr/bin/sublime-text&'
408+ fi
409 elif [[ $('uname') == 'Darwin' ]]; then
410 alias st='/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl'
411 fi
412diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh
413index 4d5bfb8dd73193c3da8e70ae5cb1119312c4533a..bd2767e3ee6b465c587c4a71777620f25183795d 100644
414--- a/plugins/svn/svn.plugin.zsh
415+++ b/plugins/svn/svn.plugin.zsh
416@@ -28,8 +28,8 @@ function svn_get_rev_nr {
417
418 function svn_dirty_choose {
419 if [ $(in_svn) ]; then
420- s=$(svn status|grep -E '^\s*[ACDIM!?L]' 2>/dev/null)
421- if [ $s ]; then
422+ svn status 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'
423+ if [ $pipestatus[-1] -ne 0 ]; then
424 echo $1
425 else
426 echo $2
427diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
428index c3107c06c04fb42b0ca27b0a81b15854819969c6..bd6f1a6a21ccea183b84aaf6c845aef1527945b9 100644
429--- a/themes/agnoster.zsh-theme
430+++ b/themes/agnoster.zsh-theme
431@@ -95,7 +95,7 @@ prompt_dir() {
432 prompt_status() {
433 local symbols
434 symbols=()
435- [[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘"
436+ [[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}$RETVAL"
437 [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
438 [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
439