Patch-Source: https://github.com/zsh-users/zsh-history-substring-search/commit/c765a4a17c951c27abc3dd485c61b7cb17616b25 (modified) -- From 4ee70abb6f96012bd561c93b75fe764229e24734 Mon Sep 17 00:00:00 2001 From: Eric Nielsen Date: Thu, 9 Jan 2020 18:43:41 -0500 Subject: [PATCH] Don't overwrite config with default values otherwise users are obliged to set the config values *after* sourcing the plugin. They're not able to do it before. Also, re-sourcing the plugin will reset the values to the defaults again. A similar change was done in zsh-autosuggestions in the past: https://github.com/zsh-users/zsh-autosuggestions/commit/9e4d3c3 --- README.md | 2 +- zsh-history-substring-search.zsh | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5f58ba2..f1cb706 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ Configuration ------------------------------------------------------------------------------ This script defines the following global variables. You may override their -default values only after having loaded this script into your ZSH session. +default values. * `HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND` is a global variable that defines how the query should be highlighted inside a matching command. Its default diff --git a/zsh-history-substring-search.zsh b/zsh-history-substring-search.zsh index 7e72994..be21b78 100644 --- a/zsh-history-substring-search.zsh +++ b/zsh-history-substring-search.zsh @@ -43,11 +43,11 @@ # declare global configuration variables #----------------------------------------------------------------------------- -typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold' -typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold' -typeset -g HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i' -typeset -g HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE='' -typeset -g HISTORY_SUBSTRING_SEARCH_FUZZY='' +: ${HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold'} +: ${HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold'} +: ${HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'} +: ${HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=''} +: ${HISTORY_SUBSTRING_SEARCH_FUZZY=''} #----------------------------------------------------------------------------- # declare internal global variables