diff options
author | Pavol Juhas <pavol.juhas@gmail.com> | 2014-02-08 19:49:54 -0500 |
---|---|---|
committer | Pavol Juhas <pavol.juhas@gmail.com> | 2014-02-08 20:09:51 -0500 |
commit | ed19ffee5ecc0db6617c1ae753e515d60cb486c6 (patch) | |
tree | b320d535aa455d88b3909a70acdef6510c549966 /plugins/scd/scd.plugin.zsh | |
parent | ec37c05cb350149ec77209bc7901c6aaa73f5567 (diff) | |
download | zsh-ed19ffee5ecc0db6617c1ae753e515d60cb486c6.tar.gz zsh-ed19ffee5ecc0db6617c1ae753e515d60cb486c6.tar.bz2 zsh-ed19ffee5ecc0db6617c1ae753e515d60cb486c6.zip |
Add scd plugin for smart change of directory.
Synced with the scd-tracker branch pavoljuhas/oh-my-zsh@9d04d8ca78030d4c9af4bf0f58b49532a6ef1b35
Diffstat (limited to 'plugins/scd/scd.plugin.zsh')
-rw-r--r-- | plugins/scd/scd.plugin.zsh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/scd/scd.plugin.zsh b/plugins/scd/scd.plugin.zsh new file mode 100644 index 000000000..0197c53a1 --- /dev/null +++ b/plugins/scd/scd.plugin.zsh @@ -0,0 +1,19 @@ +## The scd script should autoload as a shell function. +autoload scd + + +## If the scd function exists, define a change-directory-hook function +## to record visited directories in the scd index. +if [[ ${+functions[scd]} == 1 ]]; then + scd_chpwd_hook() { scd --add $PWD } + autoload add-zsh-hook + add-zsh-hook chpwd scd_chpwd_hook +fi + + +## Allow scd usage with unquoted wildcard characters such as "*" or "?". +alias scd='noglob scd' + + +## Load the directory aliases created by scd if any. +if [[ -s ~/.scdalias.zsh ]]; then source ~/.scdalias.zsh; fi |