1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-11 00:10:08 +00:00

feat(per-directory-history): add option to reduce verbosity (#12069)

Co-authored-by: Chris Hamill <chamill@ets.org>
This commit is contained in:
cohml 2023-11-29 04:15:32 -05:00 committed by GitHub
parent 7e3fdf33ec
commit 418046e958
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View file

@ -34,6 +34,8 @@ toggle set the `PER_DIRECTORY_HISTORY_TOGGLE` environment variable.
and global histories. and global histories.
* `PER_DIRECTORY_HISTORY_TOGGLE` is the key binding used to run the toggle-history * `PER_DIRECTORY_HISTORY_TOGGLE` is the key binding used to run the toggle-history
function above (default `^G`) 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 ## History

View file

@ -59,6 +59,7 @@
[[ -z $HISTORY_BASE ]] && HISTORY_BASE="$HOME/.directory_history" [[ -z $HISTORY_BASE ]] && HISTORY_BASE="$HOME/.directory_history"
[[ -z $HISTORY_START_WITH_GLOBAL ]] && HISTORY_START_WITH_GLOBAL=false [[ -z $HISTORY_START_WITH_GLOBAL ]] && HISTORY_START_WITH_GLOBAL=false
[[ -z $PER_DIRECTORY_HISTORY_TOGGLE ]] && PER_DIRECTORY_HISTORY_TOGGLE='^G' [[ -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 # toggle global/directory history used for searching - ctrl-G by default
@ -68,13 +69,15 @@ function per-directory-history-toggle-history() {
if [[ $_per_directory_history_is_global == true ]]; then if [[ $_per_directory_history_is_global == true ]]; then
_per-directory-history-set-directory-history _per-directory-history-set-directory-history
_per_directory_history_is_global=false _per_directory_history_is_global=false
zle -I if [[ $PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE == true ]]; then
echo "using local history" zle -M "using local history"
fi
else else
_per-directory-history-set-global-history _per-directory-history-set-global-history
_per_directory_history_is_global=true _per_directory_history_is_global=true
zle -I if [[ $PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE == true ]]; then
echo "using global history" zle -M "using global history"
fi
fi fi
} }