Skip to content

Commit 5182c61

Browse files
reload maintains current directory
1 parent f0f992c commit 5182c61

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.curr

.zshrc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ echo
2626

2727
# codespaces automatically takes you into that repo.
2828
# else, lets start in the root of our workspaces directory (the w alias)
29-
if [ -z "${CODESPACES}" ]; then
29+
# on reload keep same dir (it writes a .curr file)
30+
if [ -f "${DOT_FILES_PATH}/.curr" ]; then
31+
curr_dir=$(cat "${DOT_FILES_PATH}/.curr")
32+
cd "${curr_dir}"
33+
rm .curr
34+
elif [ -z "${CODESPACES}" ]; then
3035
w
3136
fi

rc/alias.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ alias all="echo;alias;echo"
44
alias c="tput reset"
55

66
# Reload the shell (i.e. invoke as a login shell)
7-
alias reload="exec ${SHELL} -l"
7+
alias reload="dot_reload"
88
alias tools="dot_tool_versions"
99
alias me="dot_tool_whoami"
1010
alias setsec="dot_set_secret"

rc/functions.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,9 @@ function dot_list_secrets() {
6161
file=${entry##*/}
6262
echo ${file%.*}
6363
done
64+
}
65+
66+
function dot_reload() {
67+
echo "$(pwd)">"${DOT_FILES_PATH}/.curr"
68+
exec ${SHELL} -l
6469
}

0 commit comments

Comments
 (0)