浏览代码

Don't clobber chpwd

xiao 9 年之前
父节点
当前提交
084792b829
共有 2 个文件被更改,包括 6 次插入2 次删除
  1. 3 1
      plugins/dirhistory/dirhistory.plugin.zsh
  2. 3 1
      plugins/last-working-dir/last-working-dir.plugin.zsh

+ 3 - 1
plugins/dirhistory/dirhistory.plugin.zsh

@@ -49,7 +49,9 @@ function push_future() {
 }
 
 # Called by zsh when directory changes
-function chpwd() {
+typeset -ga chpwd_functions
+chpwd_functions+='chpwd_dirhistory'
+function chpwd_dirhistory() {
   push_past $PWD
   # If DIRHISTORY_CD is not set...
   if [[ -z "${DIRHISTORY_CD+x}" ]]; then

+ 3 - 1
plugins/last-working-dir/last-working-dir.plugin.zsh

@@ -8,7 +8,9 @@ mkdir -p $ZSH_CACHE_DIR
 cache_file="$ZSH_CACHE_DIR/last-working-dir"
 
 # 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
 	pwd >| "$cache_file"
 }