From ed19ffee5ecc0db6617c1ae753e515d60cb486c6 Mon Sep 17 00:00:00 2001 From: Pavol Juhas Date: Sat, 8 Feb 2014 19:49:54 -0500 Subject: Add scd plugin for smart change of directory. Synced with the scd-tracker branch pavoljuhas/oh-my-zsh@9d04d8ca78030d4c9af4bf0f58b49532a6ef1b35 --- plugins/scd/scd.plugin.zsh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 plugins/scd/scd.plugin.zsh (limited to 'plugins/scd/scd.plugin.zsh') 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 -- cgit v1.2.3-70-g09d2