Skip to content

Instantly share code, notes, and snippets.

@docwhat
Last active November 6, 2016 02:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save docwhat/0cd192c066a5f9da69244f1631c5d481 to your computer and use it in GitHub Desktop.
Save docwhat/0cd192c066a5f9da69244f1631c5d481 to your computer and use it in GitHub Desktop.
zsh-syntax-hightling + zsh-autocorrect breaks history-incremental-pattern-search-backward
/zsh-autosuggestions/
/zsh-syntax-highlighting/
HISTFILE=~/zsh_history
HISTSIZE=50000
SAVEHIST=$(( $HISTSIZE - 200 )) # Give space for saving dups
setopt HIST_BEEP
setopt EXTENDED_HISTORY
setopt NO_SHARE_HISTORY
setopt NO_INC_APPEND_HISTORY
setopt INC_APPEND_HISTORY_TIME
setopt HIST_REDUCE_BLANKS
setopt HIST_IGNORE_DUPS
setopt HIST_VERIFY
setopt HIST_FCNTL_LOCK
bindkey "^R" history-incremental-pattern-search-backward
bindkey "^S" history-incremental-pattern-search-forward
zle-isearch-update() {}; zle -N zle-isearch-update
source ~/zsh-autosuggestions/zsh-autosuggestions.zsh

This is to reproduce a bug in either zsh, or zsh-autocorrect.

  • ./setup.sh -- clones the zsh-autocorrect plugin
  • ./fake-home.sh -- starts zsh with the current directory as HOME

Steps to reproduce:

  • Press ^R to start searching backwards.
  • Type "hi" -- You should get echo "hi 6"
  • Press ^R again and see that it doesn't search backwards through the history.

I expect it to search backwards through echo "hi 5" ... echo "hi 1"

#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")"
if [[ "$TERM" = tmux-256color ]]; then
TERM=screen-256color
fi
exec env -i \
"HOME=$PWD" \
"USER=$USER" \
"TERM=$TERM" \
"LANG=$LANG" \
"PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" \
zsh -l
#!/bin/bash
git clone git://github.com/zsh-users/zsh-autosuggestions
# EOF
: 1478228220:0;echo "hi 1"
: 1478228225:0;echo "hi 2"
: 1478228226:0;echo "hi 3"
: 1478228227:0;echo "hi 4"
: 1478228229:0;echo "hi 5"
: 1478228230:0;echo "hi 6"
: 1478228240:0;exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment