mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2026-01-12 16:12:19 +01:00
Refactor to remove prev cmd function and simplify escaping
This commit is contained in:
parent
c5f57da2b8
commit
011d8bdfd1
6 changed files with 20 additions and 48 deletions
|
|
@ -5,11 +5,11 @@
|
|||
|
||||
# Delegate to the selected strategy to determine a suggestion
|
||||
_zsh_autosuggest_suggestion() {
|
||||
local prefix="$1"
|
||||
local escaped_prefix="$(_zsh_autosuggest_escape_command "$1")"
|
||||
local strategy_function="_zsh_autosuggest_strategy_$ZSH_AUTOSUGGEST_STRATEGY"
|
||||
|
||||
if [ -n "$functions[$strategy_function]" ]; then
|
||||
echo -E "$($strategy_function "$prefix")"
|
||||
echo -E "$($strategy_function "$escaped_prefix")"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -19,8 +19,3 @@ _zsh_autosuggest_escape_command() {
|
|||
# Escape special chars in the string (requires EXTENDED_GLOB)
|
||||
echo -E "${1//(#m)[\\()\[\]|*?]/\\$MATCH}"
|
||||
}
|
||||
|
||||
# Get the previously executed command
|
||||
_zsh_autosuggest_prev_command() {
|
||||
echo -E "${history[$((HISTCMD-1))]}"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue