Skip to content

Commit be0fe1f

Browse files
committed
Clean up global variable declarations
- Remove duplicate declarations - Separate internal variables from configuration variables
1 parent fd27842 commit be0fe1f

File tree

1 file changed

+15
-22
lines changed

1 file changed

+15
-22
lines changed

zsh-history-substring-search.zsh

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,36 +40,30 @@
4040
##############################################################################
4141

4242
#-----------------------------------------------------------------------------
43-
# declare global variables
43+
# declare global configuration variables
44+
#-----------------------------------------------------------------------------
45+
46+
typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold'
47+
typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold'
48+
typeset -g HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'
49+
typeset -g HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=''
50+
typeset -g HISTORY_SUBSTRING_SEARCH_FUZZY=''
51+
52+
#-----------------------------------------------------------------------------
53+
# declare internal global variables
4454
#-----------------------------------------------------------------------------
4555

4656
typeset -g BUFFER MATCH MBEGIN MEND CURSOR
47-
typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
48-
typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
49-
typeset -g HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS
50-
typeset -g HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE
5157
typeset -g _history_substring_search_refresh_display
5258
typeset -g _history_substring_search_query_highlight
5359
typeset -g _history_substring_search_result
5460
typeset -g _history_substring_search_query
5561
typeset -g -a _history_substring_search_query_parts
56-
typeset -g -A _history_substring_search_raw_matches
62+
typeset -g -a _history_substring_search_raw_matches
5763
typeset -g -i _history_substring_search_raw_match_index
58-
typeset -g -A _history_substring_search_matches
59-
typeset -g -A _history_substring_search_unique_filter
64+
typeset -g -a _history_substring_search_matches
6065
typeset -g -i _history_substring_search_match_index
61-
62-
#-----------------------------------------------------------------------------
63-
# configuration variables
64-
#-----------------------------------------------------------------------------
65-
66-
typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold'
67-
typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold'
68-
typeset -g HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'
69-
typeset -g HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=''
70-
typeset -g HISTORY_SUBSTRING_SEARCH_FUZZY=''
71-
typeset -g _history_substring_search_{refresh_display,query_highlight,result,query,match_index,raw_match_index}
72-
typeset -ga _history_substring_search{,_raw}_matches
66+
typeset -g -A _history_substring_search_unique_filter
7367

7468
#-----------------------------------------------------------------------------
7569
# the main ZLE widgets
@@ -280,8 +274,7 @@ _history-substring-search-begin() {
280274
#
281275
_history_substring_search_raw_match_index=0
282276
_history_substring_search_matches=()
283-
unset _history_substring_search_unique_filter
284-
typeset -A -g _history_substring_search_unique_filter
277+
_history_substring_search_unique_filter=()
285278

286279
#
287280
# If $_history_substring_search_match_index is equal to

0 commit comments

Comments
 (0)