mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2024-11-18 09:51:06 +01:00
Add widget autosuggest-execute-suggestion
It basically means this: go to the end of line (i.e. accept the suggestion) and then hit enter.
This commit is contained in:
parent
c6afbaf254
commit
6de948c9c5
2 changed files with 11 additions and 0 deletions
|
@ -114,6 +114,7 @@ bindkey '^T' autosuggest-toggle
|
||||||
List of widgets:
|
List of widgets:
|
||||||
|
|
||||||
- `autosuggest-toggle` – disable/enable autosuggestions.
|
- `autosuggest-toggle` – disable/enable autosuggestions.
|
||||||
|
- `autosuggest-execute-suggestion` – accept the suggestion and execute it.
|
||||||
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
|
@ -250,6 +250,15 @@ autosuggest-accept-suggestion() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
autosuggest-execute-suggestion() {
|
||||||
|
if [[ -n $ZLE_AUTOSUGGESTING ]]; then
|
||||||
|
zle autosuggest-end-of-line-orig
|
||||||
|
autosuggest-invalidate-highlight-cache
|
||||||
|
autosuggest-highlight-suggested-text
|
||||||
|
fi
|
||||||
|
zle .accept-line
|
||||||
|
}
|
||||||
|
|
||||||
autosuggest-invalidate-highlight-cache() {
|
autosuggest-invalidate-highlight-cache() {
|
||||||
# invalidate the buffer for zsh-syntax-highlighting
|
# invalidate the buffer for zsh-syntax-highlighting
|
||||||
_zsh_highlight_autosuggest_highlighter_cache=()
|
_zsh_highlight_autosuggest_highlighter_cache=()
|
||||||
|
@ -259,6 +268,7 @@ zle -N autosuggest-toggle
|
||||||
zle -N autosuggest-start
|
zle -N autosuggest-start
|
||||||
zle -N autosuggest-accept-suggested-small-word
|
zle -N autosuggest-accept-suggested-small-word
|
||||||
zle -N autosuggest-accept-suggested-word
|
zle -N autosuggest-accept-suggested-word
|
||||||
|
zle -N autosuggest-execute-suggestion
|
||||||
|
|
||||||
zle -N autosuggest-paused-self-insert
|
zle -N autosuggest-paused-self-insert
|
||||||
zle -N autosuggest-insert-or-space
|
zle -N autosuggest-insert-or-space
|
||||||
|
|
Loading…
Reference in a new issue