diff --git a/zsh/zshrc b/zsh/zshrc index e8bf236..30832e9 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -65,6 +65,20 @@ if [[ -z "$DOTFILES_DISABLE_WELCOME" ]]; then welcome fi -if [[ -z "$DOTFILES_SYNC_LAST_WORKING_DIR" ]]; then +should_really_sync=0 +if [[ -v DOTFILES_SYNC_LAST_WORKING_DIR ]]; then + # Variable is defined + if [[ -n "$DOTFILES_SYNC_LAST_WORKING_DIR" ]]; then + # Variable is non-empty + should_really_sync=1 + fi +else + # Variable is undefined + if [[ "$TERM_PROGRAM" != "vscode" ]]; then + should_really_sync=1 + fi +fi +if (( should_really_sync )); then sync_working_dir_load fi +unset should_really_sync