Permalink
Browse files

convert zgit lib to zsh-style autoloads

  • Loading branch information...
rsanders committed Feb 13, 2012
1 parent 13a1078 commit 82b3653866499b948894d7aaa869c566998fb69f
@@ -1,6 +1,5 @@
#!/bin/zsh
-function zgit_branch() {
emulate -L zsh
local branch git_dir
REPLY=""
@@ -15,4 +14,3 @@ function zgit_branch() {
fi
return 1
-}
@@ -44,3 +44,4 @@ function zgit_dir() {
[[ -n $REPLY ]]
}
+zgit_dir $*
@@ -1,6 +1,5 @@
#!/bin/zsh
-function zgit_dirty () {
emulate -L zsh
local gitstatus
@@ -9,4 +8,3 @@ function zgit_dirty () {
[[ -n ${gitstatus:#*nothing to commit*} ]] && return 0
fi
return 1
-}
@@ -1,7 +1,6 @@
#!/bin/zsh
-function zgit_in_p() {
zgit_dir > /dev/null
[[ -n $REPLY ]]
-}
+
@@ -1,6 +1,5 @@
#!/bin/zsh
-function zgit_op () {
emulate -L zsh
local op="" git_dir="" branch=""
@@ -65,4 +64,3 @@ function zgit_op () {
REPLY=$op
[[ -z "$op" ]] && return 1
echo $op
-}
@@ -1,6 +1,5 @@
#!/bin/zsh
-function zgit_revision() {
emulate -L zsh
setopt typeset_silent
local branch git_dir rev
@@ -16,4 +15,3 @@ function zgit_revision() {
REPLY=""
return 1
-}
@@ -14,7 +14,6 @@
# Returns 0 for clean, 1 for dirty
#
-function zgit_status {
emulate -L zsh
local gitstatus statstring res=0
local git_dir
@@ -63,4 +62,3 @@ function zgit_status {
REPLY=$statstring
echo -n -E $statstring
return $res
-}
View
@@ -9,6 +9,8 @@
#
#
+echo "RUNNING ZGIT INIT.ZSH"
+
local libdir=${0:h}
typeset -g -A -H zgit_vars
@@ -26,7 +28,7 @@ function zgit_setup() {
local _zfile
for _zfile in $libdir/functions/*; do
- autoload -Uk ${_zfile:t}
+ autoload -U ${_zfile:t}
done
# setup in current dir
View
@@ -1,33 +0,0 @@
-#!/bin/zsh
-#
-# References / Inspirations
-#
-# zsh bundled vcs_info
-# original box prompt source from which the rsbox theme was hacked up
-# http://github.com/sudish/dotfiles/blob/master/.zshinit/S90_git_status
-# http://volnitsky.com/project/git-prompt/git-prompt.sh
-#
-#
-
-local libdir=${0:h}
-
-typeset -g -A -H zgit_vars
-typeset -g -A -H zgit_dirs
-
-function zgit_reset() {
- # nothing
-}
-
-function zgit_setup() {
- local dir="${1:h}"
- zgit_reset
-}
-
-local _zfile
-
-for _zfile in $libdir/functions/*; do
- autoload -Uk ${_zfile:t}
-done
-
-# setup in current dir
-zgit_setup ${0:h}

0 comments on commit 82b3653

Please sign in to comment.