diff --git a/plugins/c/_c b/plugins/c/_c new file mode 100644 index 000000000..a1e7cdb92 --- /dev/null +++ b/plugins/c/_c @@ -0,0 +1,6 @@ +#compdef c +if [[ "$CODE_HOME" == "" && -d "$HOME/code" ]] ; then + _files -W $HOME/code +elif [ -d "$CODE_HOME" ]; then + _files -W "$CODE_HOME" +fi diff --git a/plugins/c/c.plugin.zsh b/plugins/c/c.plugin.zsh new file mode 100644 index 000000000..4c610ad8a --- /dev/null +++ b/plugins/c/c.plugin.zsh @@ -0,0 +1,13 @@ +# Quickly access your ~/code directory +# Setting $CODE_HOME will use that instead of ~/code +function c(){ + local code_path=${CODE_HOME} + + if [[ "$code_path" == "" ]]; then + code_path="$HOME/code" + fi + + if [ -d "$code_path/$1" ]; then + cd "$code_path/$1" + fi +}