From 43a5671f5d7a02d76f6ef938c2a7ed6f2910b74d Mon Sep 17 00:00:00 2001 From: Pratik Tripathy Date: Thu, 24 Jul 2025 16:48:31 +0530 Subject: [PATCH] fix(bash/zsh): Non-interactive login shell wasn't picking `~/.profile` --- common/.bashrc | 5 +++-- common/.zshrc | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/.bashrc b/common/.bashrc index 9a6946b..8fdbd95 100644 --- a/common/.bashrc +++ b/common/.bashrc @@ -1,7 +1,8 @@ # ~/.bashrc: executed by bash(1) for non-login shells. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # for examples -[ ! -f "$HOME/.profile" ] || source "$HOME/.profile" +# Sets environment variables for login non-interactive shells (VS Code & Zed) +[ -z "$XDG_CONFIG_HOME" ] && source "$HOME"/profile # If not running interactively, don't do anything case $- in @@ -186,6 +187,6 @@ command -v zoxide >/dev/null && eval "$(zoxide init --cmd cd bash)" # Source aliases and shell functions for alias_file in "$XDG_CONFIG_HOME"/shell/*.sh; do source "$alias_file"; done -# TIP: Following should be executed AFTER the aliases are sourced +# TIP: Should be executed AFTER aliases are sourced command -v op >/dev/null && bind '"^O":"op\n"' # Fuzzyfind projects and open in nvim command -v pnew >/dev/null && bind '"^[o":"pnew\n"' # Create a new project quickly diff --git a/common/.zshrc b/common/.zshrc index b8ca5c1..b4a440e 100644 --- a/common/.zshrc +++ b/common/.zshrc @@ -11,6 +11,9 @@ # exec 3>&2 2>$logfile # setopt XTRACE +# Sets environment variables for login non-interactive shells (VS Code & Zed) +[ -z "$XDG_CONFIG_HOME" ] && source "$HOME"/.profile + # ZSH Options # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # bindkey -v # enable vi-mode setopt +o nomatch # Unmatched glob patterns like bash