diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2016-10-09 11:18:56 -0600 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2016-10-09 11:18:56 -0600 |
commit | a2baf45bce6bb8b501512233441af8f65f90a775 (patch) | |
tree | 3c0b773ed3b77c37ee1d609277a0e8f44d8899f9 /plugins/per-directory-history/per-directory-history.zsh | |
parent | 4af1cb74ad3c3275d3352febf9e14e19f368d65a (diff) | |
parent | cd37d19ddaf9cc5acbf443f93f88ca355f74090d (diff) | |
download | zsh-a2baf45bce6bb8b501512233441af8f65f90a775.tar.gz zsh-a2baf45bce6bb8b501512233441af8f65f90a775.tar.bz2 zsh-a2baf45bce6bb8b501512233441af8f65f90a775.zip |
Merge branch 'master' of https://github.com/robbyrussell/oh-my-zsh
Diffstat (limited to 'plugins/per-directory-history/per-directory-history.zsh')
-rw-r--r-- | plugins/per-directory-history/per-directory-history.zsh | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/per-directory-history/per-directory-history.zsh b/plugins/per-directory-history/per-directory-history.zsh index bdee341bd..1242dc420 100644 --- a/plugins/per-directory-history/per-directory-history.zsh +++ b/plugins/per-directory-history/per-directory-history.zsh @@ -30,7 +30,7 @@ # ################################################################################ # -# Copyright (c) 2012 Jim Hester +# Copyright (c) 2014 Jim Hester # # This software is provided 'as-is', without any express or implied warranty. # In no event will the authors be held liable for any damages arising from the @@ -57,6 +57,7 @@ #------------------------------------------------------------------------------- [[ -z $HISTORY_BASE ]] && HISTORY_BASE="$HOME/.directory_history" +[[ -z $PER_DIRECTORY_HISTORY_TOGGLE ]] && PER_DIRECTORY_HISTORY_TOGGLE='^G' #------------------------------------------------------------------------------- # toggle global/directory history used for searching - ctrl-G by default @@ -76,7 +77,7 @@ function per-directory-history-toggle-history() { autoload per-directory-history-toggle-history zle -N per-directory-history-toggle-history -bindkey '^G' per-directory-history-toggle-history +bindkey $PER_DIRECTORY_HISTORY_TOGGLE per-directory-history-toggle-history #------------------------------------------------------------------------------- # implementation details @@ -108,7 +109,7 @@ function _per-directory-history-change-directory() { } function _per-directory-history-addhistory() { - print -Sr -- ${1%%$'\n'} + print -Sr -- "${1%%$'\n'}" fc -p $_per_directory_history_directory } @@ -140,8 +141,9 @@ function _per-directory-history-set-global-history() { #add functions to the exec list for chpwd and zshaddhistory -chpwd_functions=(${chpwd_functions[@]} "_per-directory-history-change-directory") -zshaddhistory_functions=(${zshaddhistory_functions[@]} "_per-directory-history-addhistory") +autoload -U add-zsh-hook +add-zsh-hook chpwd _per-directory-history-change-directory +add-zsh-hook zshaddhistory _per-directory-history-addhistory #start in directory mode mkdir -p ${_per_directory_history_directory:h} |