From 75bca681c1f3562f49277391e4287e50c5b1a9b8 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 31 Aug 2012 16:30:14 -0400 Subject: [PATCH] Integrate z The z alias has been replaced with j. --- .gitmodules | 3 +++ modules/z/README.md | 12 +++++------- modules/z/external | 1 + modules/z/init.zsh | 37 ++++++++----------------------------- 4 files changed, 17 insertions(+), 36 deletions(-) create mode 160000 modules/z/external diff --git a/.gitmodules b/.gitmodules index 7a7a7b5..a898a30 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "modules/completion/external"] path = modules/completion/external url = https://github.com/zsh-users/zsh-completions.git +[submodule "modules/z/external"] + path = modules/z/external + url = https://github.com/rupa/z.git diff --git a/modules/z/README.md b/modules/z/README.md index 8559005..8b8fc0b 100644 --- a/modules/z/README.md +++ b/modules/z/README.md @@ -1,23 +1,21 @@ Z = -Maintains a frequently used directory list for fast directory changes. For more -information see [z][1]. +Integrates [z][1] into Oh My Zsh, which maintains a frequently used directory +list for fast directory changes. Aliases ------- - - `z` changes the directory to most *frecent* match. - - `j` is the same as `z` for [autojump][2] converts. + - `j` changes the current working directory to the most *frecent* match. Authors ------- -*The authors of this module should be contacted via the [issue tracker][3].* +*The authors of this module should be contacted via the [issue tracker][2].* - [Sorin Ionescu](https://github.com/sorin-ionescu) [1]: https://github.com/rupa/z -[2]: https://github.com/joelthelion/autojump -[3]: https://github.com/sorin-ionescu/oh-my-zsh/issues +[2]: https://github.com/sorin-ionescu/oh-my-zsh/issues diff --git a/modules/z/external b/modules/z/external new file mode 160000 index 0000000..9bf5feb --- /dev/null +++ b/modules/z/external @@ -0,0 +1 @@ +Subproject commit 9bf5feb86ac05ad32cd8fbf46d459eb415eed749 diff --git a/modules/z/init.zsh b/modules/z/init.zsh index c873408..df1e570 100644 --- a/modules/z/init.zsh +++ b/modules/z/init.zsh @@ -5,36 +5,15 @@ # Sorin Ionescu # -_z_prefixes=( - '' - '/usr/local' - '/opt/local' - "$(brew --prefix 2> /dev/null)" -) +# Set the directory changing command. +_Z_CMD='j' -for _z_prefix in "$_z_prefixes[@]"; do - _z_sh="${_z_prefix}/etc/profile.d/z.sh" +# Prevent symbolic link resolution. +_Z_NO_RESOLVE_SYMLINKS=1 - if [[ -s "$_z_sh" ]]; then - source "$_z_sh" - break - fi -done +# Source module files. +source "${0:h}/external/z.sh" -unset _z_prefix{es,} _z_sh - -# Return if requirements are not found. -if (( ! $+functions[_z] )); then - return 1 -fi - -function _z-precmd { - _z --add "${PWD:A}" -} - -autoload -Uz add-zsh-hook -add-zsh-hook precmd _z-precmd - -alias z='nocorrect _z' -alias j='nocorrect _z' +# Cleanup. +unset _Z_{CMD,NO_RESOLVE_SYMLINKS}