Skip to content

Commit 1863e7e

Browse files
committed
bash/init.sh - chezmoi fixes
- add chezmoi install path - apply logic on shell home dir pushd
1 parent 1d619b1 commit 1863e7e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

bash/init.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,17 @@ shopt -s histappend
5959
export EDITOR=vim
6060
export VISUAL=$EDITOR
6161

62-
# Change to custom shell directory on startup
63-
cd "$HOME/shell/bash" || exit
62+
# Change to custom shell directory on startup, except when shell did not start in $HOME
63+
# This lets tools like `chezmoi cd` keep their intended working directory.
64+
if [ "$PWD" = "$HOME" ]; then
65+
pushd "$HOME/shell/bash" || exit
66+
fi
6467

6568
# SDKMAN initialization (must remain at end of file)
6669
export SDKMAN_DIR="$HOME/.local/sdkman"
6770
[[ -s "$HOME/.local/sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.local/sdkman/bin/sdkman-init.sh"
71+
72+
# chezmoi
73+
if [ -d "$HOME/.local/bin" ] ; then
74+
export PATH="$PATH:$HOME/.local/bin"
75+
fi

0 commit comments

Comments
 (0)