mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2025-12-06 23:30:39 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd71081303 | ||
|
|
9788c2ee49 | ||
|
|
ebcfc46b72 | ||
|
|
b49d002888 |
@@ -132,7 +132,7 @@ Before reporting an issue, please try temporarily disabling sections of your con
|
||||
|
||||
When reporting an issue, please include:
|
||||
|
||||
- The smallest, simplest `.zshrc` configuration that will reproduce the problem
|
||||
- The smallest, simplest `.zshrc` configuration that will reproduce the problem. See [this comment](https://github.com/tarruda/zsh-autosuggestions/issues/102#issuecomment-180944764) for a good example of what this means.
|
||||
- The version of zsh you're using (`zsh --version`)
|
||||
- Which operating system you're running
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
#----------------#
|
||||
#--------------------------------------------------------------------#
|
||||
# Widget Helpers #
|
||||
#----------------#
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# Bind a single widget to an autosuggest widget, saving a reference to the original widget
|
||||
_zsh_autosuggest_bind_widget() {
|
||||
@@ -55,7 +55,7 @@ _zsh_autosuggest_bind_widgets() {
|
||||
local widget;
|
||||
|
||||
# Find every widget we might want to bind and bind it appropriately
|
||||
for widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|autosuggest-*|$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX*|run-help|which-command|beep|set-local-history|yank)}; do
|
||||
for widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|autosuggest-*|$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX*|zle-line-*|run-help|which-command|beep|set-local-history|yank)}; do
|
||||
if [ ${ZSH_AUTOSUGGEST_MODIFY_WIDGETS[(r)$widget]} ]; then
|
||||
_zsh_autosuggest_bind_widget $widget _zsh_autosuggest_modify
|
||||
elif [ ${ZSH_AUTOSUGGEST_CLEAR_WIDGETS[(r)$widget]} ]; then
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
#--------------------------------#
|
||||
#--------------------------------------------------------------------#
|
||||
# Global Configuration Variables #
|
||||
#--------------------------------#
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# Color to use when highlighting suggestion
|
||||
# Uses format of `region_highlight`
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
|
||||
#-------------------------------------#
|
||||
#--------------------------------------------------------------------#
|
||||
# Handle Deprecated Variables/Widgets #
|
||||
#-------------------------------------#
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
unset _ZSH_AUTOSUGGEST_DEPRECATED_START_WIDGET_WARNING_SHOWN
|
||||
_zsh_autosuggest_deprecated_warning() {
|
||||
>&2 echo "zsh-autosuggestions: $@"
|
||||
}
|
||||
|
||||
_zsh_autosuggest_check_deprecated_config() {
|
||||
if [ -n "$AUTOSUGGESTION_HIGHLIGHT_COLOR" ]; then
|
||||
@@ -23,17 +25,12 @@ _zsh_autosuggest_check_deprecated_config() {
|
||||
fi
|
||||
}
|
||||
|
||||
_zsh_autosuggest_deprecated_warning() {
|
||||
>&2 echo "zsh-autosuggestions: $@"
|
||||
}
|
||||
|
||||
_zsh_autosuggest_deprecated_start_widget() {
|
||||
if [ -z "$_ZSH_AUTOSUGGEST_DEPRECATED_START_WIDGET_WARNING_SHOWN" ]; then
|
||||
_zsh_autosuggest_deprecated_warning "The autosuggest-start widget is deprecated. Use the autosuggest_start function instead. For more info, see README at https://github.com/tarruda/zsh-autosuggestions."
|
||||
_ZSH_AUTOSUGGEST_DEPRECATED_START_WIDGET_WARNING_SHOWN=true
|
||||
fi
|
||||
|
||||
autosuggest_start
|
||||
_zsh_autosuggest_deprecated_warning "The autosuggest-start widget is deprecated. For more info, see the README at https://github.com/tarruda/zsh-autosuggestions."
|
||||
zle -D autosuggest-start
|
||||
eval "zle-line-init() {
|
||||
$(echo $functions[${widgets[zle-line-init]#*:}] | sed -e 's/zle autosuggest-start//g')
|
||||
}"
|
||||
}
|
||||
|
||||
zle -N autosuggest-start _zsh_autosuggest_deprecated_start_widget
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
#--------------#
|
||||
#--------------------------------------------------------------------#
|
||||
# Highlighting #
|
||||
#--------------#
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# If there was a highlight, remove it
|
||||
_zsh_autosuggest_highlight_reset() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
#-------#
|
||||
#--------------------------------------------------------------------#
|
||||
# Start #
|
||||
#-------#
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# Start the autosuggestion widgets
|
||||
_zsh_autosuggest_start() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
#------------#
|
||||
#--------------------------------------------------------------------#
|
||||
# Suggestion #
|
||||
#------------#
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# Get a suggestion from history that matches a given prefix
|
||||
_zsh_autosuggest_suggestion() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
#------------------------------------#
|
||||
#--------------------------------------------------------------------#
|
||||
# Autosuggest Widget Implementations #
|
||||
#------------------------------------#
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# Clear the suggestion
|
||||
_zsh_autosuggest_clear() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Fish-like fast/unobtrusive autosuggestions for zsh.
|
||||
# https://github.com/tarruda/zsh-autosuggestions
|
||||
# v0.2.3
|
||||
# v0.2.4
|
||||
# Copyright (c) 2013 Thiago de Arruda
|
||||
# Copyright (c) 2016 Eric Freese
|
||||
#
|
||||
@@ -25,9 +25,9 @@
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#--------------------------------#
|
||||
#--------------------------------------------------------------------#
|
||||
# Global Configuration Variables #
|
||||
#--------------------------------#
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# Color to use when highlighting suggestion
|
||||
# Uses format of `region_highlight`
|
||||
@@ -86,11 +86,13 @@ ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS=(
|
||||
vi-forward-blank-word-end
|
||||
)
|
||||
|
||||
#-------------------------------------#
|
||||
#--------------------------------------------------------------------#
|
||||
# Handle Deprecated Variables/Widgets #
|
||||
#-------------------------------------#
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
unset _ZSH_AUTOSUGGEST_DEPRECATED_START_WIDGET_WARNING_SHOWN
|
||||
_zsh_autosuggest_deprecated_warning() {
|
||||
>&2 echo "zsh-autosuggestions: $@"
|
||||
}
|
||||
|
||||
_zsh_autosuggest_check_deprecated_config() {
|
||||
if [ -n "$AUTOSUGGESTION_HIGHLIGHT_COLOR" ]; then
|
||||
@@ -110,24 +112,19 @@ _zsh_autosuggest_check_deprecated_config() {
|
||||
fi
|
||||
}
|
||||
|
||||
_zsh_autosuggest_deprecated_warning() {
|
||||
>&2 echo "zsh-autosuggestions: $@"
|
||||
}
|
||||
|
||||
_zsh_autosuggest_deprecated_start_widget() {
|
||||
if [ -z "$_ZSH_AUTOSUGGEST_DEPRECATED_START_WIDGET_WARNING_SHOWN" ]; then
|
||||
_zsh_autosuggest_deprecated_warning "The autosuggest-start widget is deprecated. Use the autosuggest_start function instead. For more info, see README at https://github.com/tarruda/zsh-autosuggestions."
|
||||
_ZSH_AUTOSUGGEST_DEPRECATED_START_WIDGET_WARNING_SHOWN=true
|
||||
fi
|
||||
|
||||
autosuggest_start
|
||||
_zsh_autosuggest_deprecated_warning "The autosuggest-start widget is deprecated. For more info, see the README at https://github.com/tarruda/zsh-autosuggestions."
|
||||
zle -D autosuggest-start
|
||||
eval "zle-line-init() {
|
||||
$(echo $functions[${widgets[zle-line-init]#*:}] | sed -e 's/zle autosuggest-start//g')
|
||||
}"
|
||||
}
|
||||
|
||||
zle -N autosuggest-start _zsh_autosuggest_deprecated_start_widget
|
||||
|
||||
#----------------#
|
||||
#--------------------------------------------------------------------#
|
||||
# Widget Helpers #
|
||||
#----------------#
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# Bind a single widget to an autosuggest widget, saving a reference to the original widget
|
||||
_zsh_autosuggest_bind_widget() {
|
||||
@@ -181,7 +178,7 @@ _zsh_autosuggest_bind_widgets() {
|
||||
local widget;
|
||||
|
||||
# Find every widget we might want to bind and bind it appropriately
|
||||
for widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|autosuggest-*|$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX*|run-help|which-command|beep|set-local-history|yank)}; do
|
||||
for widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|autosuggest-*|$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX*|zle-line-*|run-help|which-command|beep|set-local-history|yank)}; do
|
||||
if [ ${ZSH_AUTOSUGGEST_MODIFY_WIDGETS[(r)$widget]} ]; then
|
||||
_zsh_autosuggest_bind_widget $widget _zsh_autosuggest_modify
|
||||
elif [ ${ZSH_AUTOSUGGEST_CLEAR_WIDGETS[(r)$widget]} ]; then
|
||||
@@ -205,9 +202,9 @@ _zsh_autosuggest_invoke_original_widget() {
|
||||
fi
|
||||
}
|
||||
|
||||
#--------------#
|
||||
#--------------------------------------------------------------------#
|
||||
# Highlighting #
|
||||
#--------------#
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# If there was a highlight, remove it
|
||||
_zsh_autosuggest_highlight_reset() {
|
||||
@@ -227,9 +224,9 @@ _zsh_autosuggest_highlight_apply() {
|
||||
fi
|
||||
}
|
||||
|
||||
#------------------------------------#
|
||||
#--------------------------------------------------------------------#
|
||||
# Autosuggest Widget Implementations #
|
||||
#------------------------------------#
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# Clear the suggestion
|
||||
_zsh_autosuggest_clear() {
|
||||
@@ -314,9 +311,9 @@ _zsh_autosuggest_widget_clear() {
|
||||
zle -N autosuggest-accept _zsh_autosuggest_widget_accept
|
||||
zle -N autosuggest-clear _zsh_autosuggest_widget_clear
|
||||
|
||||
#------------#
|
||||
#--------------------------------------------------------------------#
|
||||
# Suggestion #
|
||||
#------------#
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# Get a suggestion from history that matches a given prefix
|
||||
_zsh_autosuggest_suggestion() {
|
||||
@@ -333,9 +330,9 @@ _zsh_autosuggest_suggestion() {
|
||||
echo ${history_matches[1]}
|
||||
}
|
||||
|
||||
#-------#
|
||||
#--------------------------------------------------------------------#
|
||||
# Start #
|
||||
#-------#
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# Start the autosuggestion widgets
|
||||
_zsh_autosuggest_start() {
|
||||
|
||||
Reference in New Issue
Block a user