mirror of
				https://github.com/zsh-users/zsh-autosuggestions.git
				synced 2025-10-30 15:26:29 +08:00 
			
		
		
		
	more zsh style code
This commit is contained in:
		
							parent
							
								
									f06305c948
								
							
						
					
					
						commit
						491aff3a51
					
				@ -65,8 +65,11 @@ _zsh_autosuggest_strategy_predefined() {
 | 
				
			|||||||
    emulate -L zsh
 | 
					    emulate -L zsh
 | 
				
			||||||
    setopt EXTENDED_GLOB
 | 
					    setopt EXTENDED_GLOB
 | 
				
			||||||
    local prefix="${1//(#m)[\\*?[\]<>()|^~#]/\\$MATCH}"
 | 
					    local prefix="${1//(#m)[\\*?[\]<>()|^~#]/\\$MATCH}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						# search the history at first
 | 
				
			||||||
    local result="${history[(r)${prefix}*]}"
 | 
					    local result="${history[(r)${prefix}*]}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						# search the predefine files if nothing found in history
 | 
				
			||||||
    if [[ -z "$result" ]]; then
 | 
					    if [[ -z "$result" ]]; then
 | 
				
			||||||
        if (( ! ${+_ZSH_AUTOSUGGEST_PREDEFINE} )); then
 | 
					        if (( ! ${+_ZSH_AUTOSUGGEST_PREDEFINE} )); then
 | 
				
			||||||
            typeset -g _ZSH_AUTOSUGGEST_PREDEFINE=()
 | 
					            typeset -g _ZSH_AUTOSUGGEST_PREDEFINE=()
 | 
				
			||||||
 | 
				
			|||||||
@ -631,8 +631,11 @@ _zsh_autosuggest_strategy_predefined() {
 | 
				
			|||||||
    emulate -L zsh
 | 
					    emulate -L zsh
 | 
				
			||||||
    setopt EXTENDED_GLOB
 | 
					    setopt EXTENDED_GLOB
 | 
				
			||||||
    local prefix="${1//(#m)[\\*?[\]<>()|^~#]/\\$MATCH}"
 | 
					    local prefix="${1//(#m)[\\*?[\]<>()|^~#]/\\$MATCH}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						# search the history at first
 | 
				
			||||||
    local result="${history[(r)${prefix}*]}"
 | 
					    local result="${history[(r)${prefix}*]}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						# search the predefine files if nothing found in history
 | 
				
			||||||
    if [[ -z "$result" ]]; then
 | 
					    if [[ -z "$result" ]]; then
 | 
				
			||||||
        if (( ! ${+_ZSH_AUTOSUGGEST_PREDEFINE} )); then
 | 
					        if (( ! ${+_ZSH_AUTOSUGGEST_PREDEFINE} )); then
 | 
				
			||||||
            typeset -g _ZSH_AUTOSUGGEST_PREDEFINE=()
 | 
					            typeset -g _ZSH_AUTOSUGGEST_PREDEFINE=()
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user