diff options
author | Robby Russell <robby@planetargon.com> | 2014-03-22 07:56:35 -0700 |
---|---|---|
committer | Robby Russell <robby@planetargon.com> | 2014-03-22 07:56:35 -0700 |
commit | e7420736db0e09fd6057ae9ecaea815966619a3d (patch) | |
tree | 059a7f4e60d2a1dbd2fe1e576cab6f4cc0da47c7 /plugins/scd/scd.plugin.zsh | |
parent | 2e06412ee070a102b81d80bd39e637d2f87bf1b2 (diff) | |
parent | c1c107cfb9669beeda258efed9a17cc4bddf7aa7 (diff) | |
download | zsh-e7420736db0e09fd6057ae9ecaea815966619a3d.tar.gz zsh-e7420736db0e09fd6057ae9ecaea815966619a3d.tar.bz2 zsh-e7420736db0e09fd6057ae9ecaea815966619a3d.zip |
Merge pull request #2510 from pavoljuhas/master
Add scd plugin for smart change of directory.
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 |