#StackBounty: #oh-my-zsh oh-my-zsh cursor up before program has finished vs after, how to make them behave consistantly

Bounty: 100

I’ve noticed that if I press up arrow at a prompt then I get the previous command and up again gets me the command before that.

Whereas if I press up arrow before the previous program has completed then instead I get the previous command displayed, the cursor is at the end of the line, but oh-my-zsh is now in “search for lines that start with … ” mode meaning I can’t press up to get the previous command.

I’m sure this behavior is well known and expected but just in case you don’t get it you can repo it like this

  1. Type ls return
  2. Type sleep 3 return
  3. wait 3 seconds for prompt to appear
  4. press (should show sleep 3)
  5. press again (should show ls)
  6. press return (to run ls)
  7. Type sleep 3 return (press the up arrow before the 3 seconds elapses)
  8. It should now be showing sleep 3
  9. Press
    it will still be showing sleep 3 but it want it to be showing ls. Instead it is in “search for commands that start with sleep 3 mode instead of just go to previous command mode.

To make try to clear in both cases these are the steps

  1. lsreturn
  2. sleep 3return

But they end up with different results depending on if step3 happens before step2 finished or after.

Note I saw this Q&A: How to make oh-my-zsh history behavior similar to Bash's?

But that doesn’t seem to be what I’m looking for. I like oh-my-zsh’s partial line + up = search for lines that start with the partial. What I’m trying to fix is that if I press up on step 2 above it magically inserts a partial where as if I wait until step 2 finishes it doesn’t.

How do I get oh-my-zsh to be consistent here so that a premature up arrow behaves the same as a normal up arrow? Thank you


Get this bounty!!!

Leave a Reply