mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-25 15:20:08 +00:00
Don't clobber chpwd
This commit is contained in:
parent
3d5b3430fd
commit
084792b829
2 changed files with 6 additions and 2 deletions
|
@ -49,7 +49,9 @@ function push_future() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Called by zsh when directory changes
|
# Called by zsh when directory changes
|
||||||
function chpwd() {
|
typeset -ga chpwd_functions
|
||||||
|
chpwd_functions+='chpwd_dirhistory'
|
||||||
|
function chpwd_dirhistory() {
|
||||||
push_past $PWD
|
push_past $PWD
|
||||||
# If DIRHISTORY_CD is not set...
|
# If DIRHISTORY_CD is not set...
|
||||||
if [[ -z "${DIRHISTORY_CD+x}" ]]; then
|
if [[ -z "${DIRHISTORY_CD+x}" ]]; then
|
||||||
|
|
|
@ -8,7 +8,9 @@ mkdir -p $ZSH_CACHE_DIR
|
||||||
cache_file="$ZSH_CACHE_DIR/last-working-dir"
|
cache_file="$ZSH_CACHE_DIR/last-working-dir"
|
||||||
|
|
||||||
# Updates the last directory once directory is changed.
|
# Updates the last directory once directory is changed.
|
||||||
function chpwd() {
|
typeset -ga chpwd_functions
|
||||||
|
chpwd_functions+='chpwd_last_working_dir'
|
||||||
|
function chpwd_last_working_dir() {
|
||||||
# Use >| in case noclobber is set to avoid "file exists" error
|
# Use >| in case noclobber is set to avoid "file exists" error
|
||||||
pwd >| "$cache_file"
|
pwd >| "$cache_file"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue