Skip to content
Browse files

Make z compatible with zsh.

  • Loading branch information...
1 parent 5a5f453 commit 052a6cbbcd83c1968a11c26d75950bf455b816fb Steve Losh committed Feb 10, 2010
Showing with 7 additions and 7 deletions.
  1. +5 −2 README
  2. +2 −5 z.sh
View
7 README
@@ -16,8 +16,11 @@ The -r switch preserves the old behavior.
# maintains a jump-list of the directories you actually use
#
# INSTALL:
-# * put something like this in your .bashrc:
-# . /path/to/z.sh
+# * put something like this in your .zshrc:
+# . /path/to/z.sh
+# function precmd () {
+# z --add "$(pwd -P)"
+# }
# * cd around for a while to build up the db
# * PROFIT!!
#
View
7 z.sh
@@ -64,7 +64,7 @@ z() {
# if we hit enter on a completion just go there
[ -d "$last" ] && cd "$last" && return
[ -f "$datafile" ] || return
- cd="$(awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -v tmpfl="$datafile.tmp" -F"|" '
+ local cd="$(awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -v tmpfl="$datafile.tmp" -F"|" '
function frecent(rank, time) {
dx = t-time
if( dx < 3600 ) return rank*4
@@ -133,7 +133,4 @@ z() {
fi
}
# tab completion
-complete -C 'z --complete "$COMP_LINE"' z
-# populate directory list. avoid clobbering other PROMPT_COMMANDs.
-echo $PROMPT_COMMAND | grep -q "z"
-[ $? -gt 0 ] && PROMPT_COMMAND='z --add "$(pwd -P)";'"$PROMPT_COMMAND"
+# complete -C 'z --complete "$COMP_LINE"' z

6 comments on commit 052a6cb

@rupa
rupa commented on 052a6cb Feb 10, 2010

nice - good call on the 'local'

@matthewmccullough

Have you considered putting this into Robby Russell's Oh-My-Zsh as a plugin? Man, the uptake would be blisteringly fast because of how easy (just turn on a plugin) it is to use it there. I'd be happy to port it over, but I didn't want to seem like I was forking it -- just making it easier to get started with.

@rupa
rupa commented on 052a6cb Dec 30, 2011

I don't use Oh-My-Zsh (or zsh), so if I did this, I'd be worried about it 'going stale'.

I think a fork would be appropriate - or possibly a script that grabs/updates from my version - whatever works best for that framework :)

@rupa
rupa commented on 052a6cb Dec 30, 2011

haha - just noticed this is sjl's branch - maybe he'll be into it

@sjl
Owner
sjl commented on 052a6cb Dec 31, 2011

As far as I can tell the official repo is compatible with Zsh now, so maybe you could use git's submodules to include it in oh-my-zsh? I'm not sure what the usual method for adding stuff like this into oh-my-zsh is.

@matthewmccullough

@sjl @rupa -- The update function of Oh-My-Zsh wants to keep it to just one repo that they call out to, otherwise, the updates (if there were many submodules) could become a monster in terms of time taken due to round trips. So, though the idea is AWESOME, I'm going to propose just pulling in a copy of this with the attribution such that folks realize the source of the code and that I'm just making it more accessible. Let me know if this is cool by you. I just want this to get MORE exposure to folks who love Oh-My-Zsh.

Please sign in to comment.
Something went wrong with that request. Please try again.