summaryrefslogtreecommitdiff
path: root/plugins/per-directory-history
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2023-12-09 13:20:13 -0800
committerTuowen Zhao <ztuowen@gmail.com>2023-12-09 13:20:13 -0800
commit7e951c254e779ff0620537cf43ca69dd878387b4 (patch)
treecb042e695bb3e11ed0483fad1af8a5b4f1bfc8d8 /plugins/per-directory-history
parent4d908094fdc2a0c0e9a0a072eba213fab7adef43 (diff)
parent48ccc7b36de8efb2bd7beb9bd6e0a6f6fe03b95d (diff)
downloadzsh-7e951c254e779ff0620537cf43ca69dd878387b4.tar.gz
zsh-7e951c254e779ff0620537cf43ca69dd878387b4.tar.bz2
zsh-7e951c254e779ff0620537cf43ca69dd878387b4.zip
Merge remote-tracking branch 'github/master'
Diffstat (limited to 'plugins/per-directory-history')
-rw-r--r--plugins/per-directory-history/README.md2
-rw-r--r--plugins/per-directory-history/per-directory-history.zsh11
2 files changed, 9 insertions, 4 deletions
diff --git a/plugins/per-directory-history/README.md b/plugins/per-directory-history/README.md
index 69854aa38..11150b059 100644
--- a/plugins/per-directory-history/README.md
+++ b/plugins/per-directory-history/README.md
@@ -34,6 +34,8 @@ toggle set the `PER_DIRECTORY_HISTORY_TOGGLE` environment variable.
and global histories.
* `PER_DIRECTORY_HISTORY_TOGGLE` is the key binding used to run the toggle-history
function above (default `^G`)
+* `PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE` is a variable which toggles whether
+ the current mode is printed to the screen following a mode change (default `true`)
## History
diff --git a/plugins/per-directory-history/per-directory-history.zsh b/plugins/per-directory-history/per-directory-history.zsh
index acbd64757..b33e0b5dd 100644
--- a/plugins/per-directory-history/per-directory-history.zsh
+++ b/plugins/per-directory-history/per-directory-history.zsh
@@ -59,6 +59,7 @@
[[ -z $HISTORY_BASE ]] && HISTORY_BASE="$HOME/.directory_history"
[[ -z $HISTORY_START_WITH_GLOBAL ]] && HISTORY_START_WITH_GLOBAL=false
[[ -z $PER_DIRECTORY_HISTORY_TOGGLE ]] && PER_DIRECTORY_HISTORY_TOGGLE='^G'
+[[ -z $PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE ]] && PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE=true
#-------------------------------------------------------------------------------
# toggle global/directory history used for searching - ctrl-G by default
@@ -68,14 +69,16 @@ function per-directory-history-toggle-history() {
if [[ $_per_directory_history_is_global == true ]]; then
_per-directory-history-set-directory-history
_per_directory_history_is_global=false
- print -n "\nusing local history"
+ if [[ $PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE == true ]]; then
+ zle -M "using local history"
+ fi
else
_per-directory-history-set-global-history
_per_directory_history_is_global=true
- print -n "\nusing global history"
+ if [[ $PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE == true ]]; then
+ zle -M "using global history"
+ fi
fi
- zle .push-line
- zle .accept-line
}
autoload per-directory-history-toggle-history