0

This question already has an answer here:

When I use OMZ, I have a very, very nice feature I like to call context-sensitive history. It's easier to show than describe. If I run:

% abc
% cba

And then I type % a[up], without CS history I get% cba. With it I get % abc. What in OMZ causes this?

EDIT: I want this to give me results based on the beginning of the command. With the substring search suggested by @Thomas Dickey, it matches if what I typed was anywhere in the command.

EDIT 2: @jasonwryan's answer in How can I search history with what is already entered at the prompt in zsh? is almost it; the only thing is that the cursor should be at the end of the new line rather than staying at its current location.

marked as duplicate by jasonwryan, Community Sep 26 '16 at 0:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

That sounds like zsh-history-substring-search, which according to the webpage is inspired by the fish shell (and offhand sounds like the way vi-like-emacs implements command history — there are probably several variations).

For other possibilities, see @jasonwryan's answer in How can I search history with what is already entered at the prompt in zsh?

  • I have never had that plugin enabled. – Duncan X Simpson Sep 25 '16 at 21:19
  • And I just tried adding the script, and it doesn't work for some reason. – Duncan X Simpson Sep 25 '16 at 21:44
  • Okay, it works but it's not what I'm looking for. Updating question. – Duncan X Simpson Sep 25 '16 at 21:49
  • 1
    You could have something simpler, like this – Thomas Dickey Sep 25 '16 at 21:53
  • That's almost it! Just one other thing, with OMZ the cursor ends up at the end of the line, while this leaves it at its original position. Updating question. – Duncan X Simpson Sep 25 '16 at 21:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.