zsh-vi-mode icon indicating copy to clipboard operation
zsh-vi-mode copied to clipboard

History search not working as before/intended

Open yuannan opened this issue 3 years ago • 2 comments

General information

Basic examination

  • [x] I have read through the README page
  • [x] I have the latest version of zsh-vi-mode
  • [x] I have tested with another terminal program

Problem description

Searching using arrow keys no longer works. The binds from "bindkey" do not differ for "^[[A" and "^[[B" which confuses me.

As per: https://github.com/jeffreytse/zsh-vi-mode/issues/12 I tried

zvm_after_init_commands+=("bindkey '^[[A' up-line-or-search" "bindkey '^[[B' down-line-or-search")

This works for the command key word but not the entire command. For example using vi-mode:

ping 1.1

*up*

ping 1.1.1.1

This searches for "^ping 1.1[.*]" and completes the command as well as the string after wards. Working as intended.

However while using zsh-vi-mode:

ping 1.1

*up*

ping 9.9.9.9

This searches for "^ping[.*]". It does search for ping but for all pings. Removing functionality that was once had.

I have read the README.md and know about { /, n, N} to search and then navigate back and forwards. This gets back some functionality but not all as this instead searches for "[.*]ping 1.1[.*]" which is all history containing the string "ping 1.1".

I just want to search like I was doing before. This should be easily avoided by the code first checking for binds and then ignoring them if it detects previous binds instead of just assuming the user wants to use zsh-vi-mode binds.

This all works completely normally and expected with "vi-mode" plugin that this is supposedly better and should replace. Until this is fixed I cannot say this is better or improved. Just different.

yuannan avatar Dec 01 '21 20:12 yuannan

I had the same issue, and It doesn't look like that this is currently possible with zsh-vi-mode.

Here's a useful post I found on the internet that accomplishes this without the plugin, all you have to do is paste the code snippet in the post into your .zshrc

JettChenT avatar May 30 '22 12:05 JettChenT

This works for the command key word but not the entire command.

@yuannan I know it's been 2 years, but for this specific behavior, you need zvm_after_init_commands+=("bindkey '^[[A' up-line-or-beginning-search" "bindkey '^[[B' down-line-or-beginning-search")

45mg avatar May 29 '23 09:05 45mg