|
|
@ -49,7 +49,7 @@ HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i' |
|
|
|
# the main ZLE widgets |
|
|
|
# the main ZLE widgets |
|
|
|
#----------------------------------------------------------------------------- |
|
|
|
#----------------------------------------------------------------------------- |
|
|
|
|
|
|
|
|
|
|
|
function history-substring-search-up() { |
|
|
|
function history-substring-search-up { |
|
|
|
_history-substring-search-begin |
|
|
|
_history-substring-search-begin |
|
|
|
|
|
|
|
|
|
|
|
_history-substring-search-up-history || |
|
|
|
_history-substring-search-up-history || |
|
|
@ -59,7 +59,7 @@ function history-substring-search-up() { |
|
|
|
_history-substring-search-end |
|
|
|
_history-substring-search-end |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function history-substring-search-down() { |
|
|
|
function history-substring-search-down { |
|
|
|
_history-substring-search-begin |
|
|
|
_history-substring-search-begin |
|
|
|
|
|
|
|
|
|
|
|
_history-substring-search-down-history || |
|
|
|
_history-substring-search-down-history || |
|
|
@ -93,7 +93,7 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then |
|
|
|
# simply removes any existing highlights when the |
|
|
|
# simply removes any existing highlights when the |
|
|
|
# user inserts printable characters into $BUFFER. |
|
|
|
# user inserts printable characters into $BUFFER. |
|
|
|
# |
|
|
|
# |
|
|
|
function _zsh_highlight() { |
|
|
|
function _zsh_highlight { |
|
|
|
if [[ $KEYS == [[:print:]] ]]; then |
|
|
|
if [[ $KEYS == [[:print:]] ]]; then |
|
|
|
region_highlight=() |
|
|
|
region_highlight=() |
|
|
|
fi |
|
|
|
fi |
|
|
@ -136,8 +136,7 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then |
|
|
|
# |
|
|
|
# |
|
|
|
#--------------8<-------------------8<-------------------8<----------------- |
|
|
|
#--------------8<-------------------8<-------------------8<----------------- |
|
|
|
# Rebind all ZLE widgets to make them invoke _zsh_highlights. |
|
|
|
# Rebind all ZLE widgets to make them invoke _zsh_highlights. |
|
|
|
_zsh_highlight_bind_widgets() |
|
|
|
function _zsh_highlight_bind_widgets { |
|
|
|
{ |
|
|
|
|
|
|
|
# Load Zsh module zsh/zleparameter, needed to override user defined widgets. |
|
|
|
# Load Zsh module zsh/zleparameter, needed to override user defined widgets. |
|
|
|
zmodload zsh/zleparameter 2>/dev/null || { |
|
|
|
zmodload zsh/zleparameter 2>/dev/null || { |
|
|
|
print 'history-substring-search: failed loading: zsh/zleparameter' >&2 |
|
|
|
print 'history-substring-search: failed loading: zsh/zleparameter' >&2 |
|
|
@ -163,7 +162,7 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then |
|
|
|
zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; |
|
|
|
zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; |
|
|
|
|
|
|
|
|
|
|
|
# Builtin widget: override and make it call the builtin ".widget". |
|
|
|
# Builtin widget: override and make it call the builtin ".widget". |
|
|
|
builtin) eval "_zsh_highlight_widget_$cur_widget() { builtin zle .$cur_widget -- \"\$@\" && _zsh_highlight }; \ |
|
|
|
builtin) eval "function _zsh_highlight_widget_$cur_widget { builtin zle .$cur_widget -- \"\$@\" && _zsh_highlight }; \ |
|
|
|
zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; |
|
|
|
zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; |
|
|
|
|
|
|
|
|
|
|
|
# Default: unhandled case. |
|
|
|
# Default: unhandled case. |
|
|
@ -176,7 +175,7 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then |
|
|
|
_zsh_highlight_bind_widgets |
|
|
|
_zsh_highlight_bind_widgets |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
function _history-substring-search-begin() { |
|
|
|
function _history-substring-search-begin { |
|
|
|
setopt LOCAL_OPTIONS EXTENDED_GLOB |
|
|
|
setopt LOCAL_OPTIONS EXTENDED_GLOB |
|
|
|
|
|
|
|
|
|
|
|
_history_substring_search_move_cursor_eol=false |
|
|
|
_history_substring_search_move_cursor_eol=false |
|
|
@ -244,7 +243,7 @@ function _history-substring-search-begin() { |
|
|
|
fi |
|
|
|
fi |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function _history-substring-search-end() { |
|
|
|
function _history-substring-search-end { |
|
|
|
setopt LOCAL_OPTIONS EXTENDED_GLOB |
|
|
|
setopt LOCAL_OPTIONS EXTENDED_GLOB |
|
|
|
|
|
|
|
|
|
|
|
_history_substring_search_result=$BUFFER |
|
|
|
_history_substring_search_result=$BUFFER |
|
|
@ -278,7 +277,7 @@ function _history-substring-search-end() { |
|
|
|
true |
|
|
|
true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function _history-substring-search-up-buffer() { |
|
|
|
function _history-substring-search-up-buffer { |
|
|
|
# |
|
|
|
# |
|
|
|
# Check if the UP arrow was pressed to move the cursor within a multi-line |
|
|
|
# Check if the UP arrow was pressed to move the cursor within a multi-line |
|
|
|
# buffer. This amounts to three tests: |
|
|
|
# buffer. This amounts to three tests: |
|
|
@ -307,7 +306,7 @@ function _history-substring-search-up-buffer() { |
|
|
|
false |
|
|
|
false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function _history-substring-search-down-buffer() { |
|
|
|
function _history-substring-search-down-buffer { |
|
|
|
# |
|
|
|
# |
|
|
|
# Check if the DOWN arrow was pressed to move the cursor within a multi-line |
|
|
|
# Check if the DOWN arrow was pressed to move the cursor within a multi-line |
|
|
|
# buffer. This amounts to three tests: |
|
|
|
# buffer. This amounts to three tests: |
|
|
@ -336,7 +335,7 @@ function _history-substring-search-down-buffer() { |
|
|
|
false |
|
|
|
false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function _history-substring-search-up-history() { |
|
|
|
function _history-substring-search-up-history { |
|
|
|
# |
|
|
|
# |
|
|
|
# Behave like up in Zsh, except clear the $BUFFER |
|
|
|
# Behave like up in Zsh, except clear the $BUFFER |
|
|
|
# when beginning of history is reached like in Fish. |
|
|
|
# when beginning of history is reached like in Fish. |
|
|
@ -358,7 +357,7 @@ function _history-substring-search-up-history() { |
|
|
|
false |
|
|
|
false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function _history-substring-search-down-history() { |
|
|
|
function _history-substring-search-down-history { |
|
|
|
# |
|
|
|
# |
|
|
|
# Behave like down-history in Zsh, except clear the |
|
|
|
# Behave like down-history in Zsh, except clear the |
|
|
|
# $BUFFER when end of history is reached like in Fish. |
|
|
|
# $BUFFER when end of history is reached like in Fish. |
|
|
@ -381,7 +380,7 @@ function _history-substring-search-down-history() { |
|
|
|
false |
|
|
|
false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function _history-substring-search-up-search() { |
|
|
|
function _history-substring-search-up-search { |
|
|
|
_history_substring_search_move_cursor_eol=true |
|
|
|
_history_substring_search_move_cursor_eol=true |
|
|
|
|
|
|
|
|
|
|
|
# |
|
|
|
# |
|
|
@ -460,7 +459,7 @@ function _history-substring-search-up-search() { |
|
|
|
fi |
|
|
|
fi |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function _history-substring-search-down-search() { |
|
|
|
function _history-substring-search-down-search { |
|
|
|
_history_substring_search_move_cursor_eol=true |
|
|
|
_history_substring_search_move_cursor_eol=true |
|
|
|
|
|
|
|
|
|
|
|
# |
|
|
|
# |
|
|
|