Fix loading history-search-end

This commit is contained in:
Anthony Rose 2022-08-19 15:27:34 +01:00
parent 42b33bf233
commit 25d2812e49
2 changed files with 1 additions and 30 deletions

View file

@ -147,36 +147,6 @@ fi
if [ -n "$ZSH_VERSION" ] if [ -n "$ZSH_VERSION" ]
then then
function history-search-end {
#
# This implements functions like history-beginning-search-{back,for}ward,
# but takes the cursor to the end of the line after moving in the
# history, like history-search-{back,for}ward. To use them:
# zle -N history-beginning-search-backward-end history-search-end
# zle -N history-beginning-search-forward-end history-search-end
# bindkey '...' history-beginning-search-backward-end
# bindkey '...' history-beginning-search-forward-end
integer cursor=$CURSOR mark=$MARK
if [[ $LASTWIDGET = history-beginning-search-*-end ]]; then
# Last widget called set $MARK.
CURSOR=$MARK
else
MARK=$CURSOR
fi
if zle .${WIDGET%-end}; then
# success, go to end of line
zle .end-of-line
else
# failure, restore position
CURSOR=$cursor
MARK=$mark
return 1
fi
}
zle -N history-beginning-search-backward-end history-search-end zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end zle -N history-beginning-search-forward-end history-search-end
bindkey -e bindkey -e

View file

@ -1,3 +1,4 @@
autoload -U history-search-end
if [ -e $HOME/.bashrc ] if [ -e $HOME/.bashrc ]
then then
emulate sh -c ". $HOME/.bashrc" emulate sh -c ". $HOME/.bashrc"