418046e9583f635b0303e4b8cf31c356b175cec3
- Author
- cohml <62400541+cohml@users.noreply.github.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
feat(per-directory-history): add option to reduce verbosity (#12069)
Co-authored-by: Chris Hamill <chamill@ets.org>
Diff
1diff --git a/plugins/per-directory-history/README.md b/plugins/per-directory-history/README.md
2index 69854aa3891083b0598b32c9a8a73942ca7b8c16..11150b05909f5d2a6a65221be10003c02d5d9b2d 100644
3--- a/plugins/per-directory-history/README.md
4+++ b/plugins/per-directory-history/README.md
5@@ -34,6 +34,8 @@ toggle set the `PER_DIRECTORY_HISTORY_TOGGLE` environment variable.
6 and global histories.
7 * `PER_DIRECTORY_HISTORY_TOGGLE` is the key binding used to run the toggle-history
8 function above (default `^G`)
9+* `PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE` is a variable which toggles whether
10+ the current mode is printed to the screen following a mode change (default `true`)
11
12 ## History
13
14diff --git a/plugins/per-directory-history/per-directory-history.zsh b/plugins/per-directory-history/per-directory-history.zsh
15index cfc4535d3c07d9b58d3df368dd78b6c2922bedb1..b33e0b5dd4e0ecf0a96a5211131946441b279158 100644
16--- a/plugins/per-directory-history/per-directory-history.zsh
17+++ b/plugins/per-directory-history/per-directory-history.zsh
18@@ -59,6 +59,7 @@
19 [[ -z $HISTORY_BASE ]] && HISTORY_BASE="$HOME/.directory_history"
20 [[ -z $HISTORY_START_WITH_GLOBAL ]] && HISTORY_START_WITH_GLOBAL=false
21 [[ -z $PER_DIRECTORY_HISTORY_TOGGLE ]] && PER_DIRECTORY_HISTORY_TOGGLE='^G'
22+[[ -z $PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE ]] && PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE=true
23
24 #-------------------------------------------------------------------------------
25 # toggle global/directory history used for searching - ctrl-G by default
26@@ -68,13 +69,15 @@ function per-directory-history-toggle-history() {
27 if [[ $_per_directory_history_is_global == true ]]; then
28 _per-directory-history-set-directory-history
29 _per_directory_history_is_global=false
30- zle -I
31- echo "using local history"
32+ if [[ $PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE == true ]]; then
33+ zle -M "using local history"
34+ fi
35 else
36 _per-directory-history-set-global-history
37 _per_directory_history_is_global=true
38- zle -I
39- echo "using global history"
40+ if [[ $PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE == true ]]; then
41+ zle -M "using global history"
42+ fi
43 fi
44 }
45