From 1fcea0307658953b9b9a0f2cdb054b700bf08688 Mon Sep 17 00:00:00 2001 From: "warren.veerasingam@gmail.com" Date: Sun, 7 Apr 2019 20:19:43 -0500 Subject: [PATCH] Edit instructions to auto switch via zsh --- README.md | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 5f33970a..8278bf71 100644 --- a/README.md +++ b/README.md @@ -82,29 +82,27 @@ alias cd='cdtfswitch' Add the following to the end of your `~/.zshrc` file: -*With add-zsh-hook enabled* ``` -load-tfswitch() { - local tfswitchrc_path=".tfswitchrc" - - if [ -f "$tfswitchrc_path" ]; then +cd(){ + builtin cd "$@"; + cdir=$PWD; + if [ -f "$cdir/.tfswitchrc" ]; then tfswitch fi } -add-zsh-hook chpwd load-tfswitch -load-tfswitch ``` -*Without add-zsh-hook enabled (similiar to bashrc setup)* +*Without add-zsh-hook enabled (newer version)* ``` -cdtfswitch(){ - builtin cd "$@"; - cdir=$PWD; - if [ -f "$cdir/.tfswitchrc" ]; then +load-tfswitch() { + local tfswitchrc_path=".tfswitchrc" + + if [ -f "$tfswitchrc_path" ]; then tfswitch fi } -alias cd='cdtfswitch' +add-zsh-hook chpwd load-tfswitch +load-tfswitch ``` ## Additional Info