mirror of
				https://github.com/zsh-users/zsh-autosuggestions.git
				synced 2025-10-30 15:26:29 +08:00 
			
		
		
		
	update predefined strategies
This commit is contained in:
		
							parent
							
								
									942662d12d
								
							
						
					
					
						commit
						050143d539
					
				@ -27,7 +27,7 @@ _zsh_autosuggest_predefined_generate() {
 | 
			
		||||
	# skip when ~/.zsh_autosuggest exists
 | 
			
		||||
	[ -f "$pname" ] && return
 | 
			
		||||
 | 
			
		||||
	# echo "autosuggestions is generating: $pname"
 | 
			
		||||
	echo "autosuggestions is generating: $pname"
 | 
			
		||||
 | 
			
		||||
	# copy builtin predefine database
 | 
			
		||||
	local txt="${_zsh_autosuggest_script_path}/predefined.txt"
 | 
			
		||||
@ -36,6 +36,7 @@ _zsh_autosuggest_predefined_generate() {
 | 
			
		||||
 | 
			
		||||
	# enumerate commands in $PATH and add them to ~/.zsh_autosuggest
 | 
			
		||||
    for p ("${(@s/:/)PATH}"); do
 | 
			
		||||
		[ ! -d "$p" ] && continue
 | 
			
		||||
		cd "$p"
 | 
			
		||||
		local files=("${(@f)$(ls -la | awk -F ' ' '{print $9}')}")
 | 
			
		||||
		for fn in ${files}; do
 | 
			
		||||
@ -78,7 +79,7 @@ _zsh_autosuggest_strategy_predefined() {
 | 
			
		||||
	# search the predefine files if nothing found in history
 | 
			
		||||
    if [[ -z "$result" ]]; then
 | 
			
		||||
        if (( ! ${+_ZSH_AUTOSUGGEST_PREDEFINE} )); then
 | 
			
		||||
			_zsh_autosuggest_predefined_generate
 | 
			
		||||
			# _zsh_autosuggest_predefined_generate
 | 
			
		||||
            typeset -g _ZSH_AUTOSUGGEST_PREDEFINE=()
 | 
			
		||||
			local pbase="$_zsh_autosuggest_data_home"
 | 
			
		||||
			local pname="$pbase/predefined"
 | 
			
		||||
@ -99,7 +100,7 @@ _zsh_autosuggest_strategy_predefined() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# _zsh_autosuggest_predefined_generate
 | 
			
		||||
_zsh_autosuggest_predefined_generate
 | 
			
		||||
 | 
			
		||||
#  vim: set ts=4 sw=4 tw=0 noet :
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -593,7 +593,7 @@ _zsh_autosuggest_predefined_generate() {
 | 
			
		||||
	# skip when ~/.zsh_autosuggest exists
 | 
			
		||||
	[ -f "$pname" ] && return
 | 
			
		||||
 | 
			
		||||
	# echo "autosuggestions is generating: $pname"
 | 
			
		||||
	echo "autosuggestions is generating: $pname"
 | 
			
		||||
 | 
			
		||||
	# copy builtin predefine database
 | 
			
		||||
	local txt="${_zsh_autosuggest_script_path}/predefined.txt"
 | 
			
		||||
@ -602,6 +602,7 @@ _zsh_autosuggest_predefined_generate() {
 | 
			
		||||
 | 
			
		||||
	# enumerate commands in $PATH and add them to ~/.zsh_autosuggest
 | 
			
		||||
    for p ("${(@s/:/)PATH}"); do
 | 
			
		||||
		[ ! -d "$p" ] && continue
 | 
			
		||||
		cd "$p"
 | 
			
		||||
		local files=("${(@f)$(ls -la | awk -F ' ' '{print $9}')}")
 | 
			
		||||
		for fn in ${files}; do
 | 
			
		||||
@ -644,7 +645,7 @@ _zsh_autosuggest_strategy_predefined() {
 | 
			
		||||
	# search the predefine files if nothing found in history
 | 
			
		||||
    if [[ -z "$result" ]]; then
 | 
			
		||||
        if (( ! ${+_ZSH_AUTOSUGGEST_PREDEFINE} )); then
 | 
			
		||||
			_zsh_autosuggest_predefined_generate
 | 
			
		||||
			# _zsh_autosuggest_predefined_generate
 | 
			
		||||
            typeset -g _ZSH_AUTOSUGGEST_PREDEFINE=()
 | 
			
		||||
			local pbase="$_zsh_autosuggest_data_home"
 | 
			
		||||
			local pname="$pbase/predefined"
 | 
			
		||||
@ -665,7 +666,7 @@ _zsh_autosuggest_strategy_predefined() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# _zsh_autosuggest_predefined_generate
 | 
			
		||||
_zsh_autosuggest_predefined_generate
 | 
			
		||||
 | 
			
		||||
#  vim: set ts=4 sw=4 tw=0 noet :
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user