In bash, you can kill words (Alt-Backspace) or lines (Ctrl-k), and yank them back later with C-y, and cycling the kill-ring with Alt-y.

Now when I'm using zsh, it is weird that Alt-y is not working (nothing happens when I press it), although I've set it to use emacs keybindings (bindkey -e).

Any ideas how to fix it?

zsh --version returns 4.3.12

bindkey | grep yank shows that yank-pop is already bound to ^[y (Alt-y).

UPDATED: debugging results

A. How do I test that Alt-y is not working?

  1. I type 'abc'
  2. I kill it by pressing Alt-Backspace
  3. I type 'efg'
  4. I kill it again by Alt-Backspace
  5. I press Ctrl-y to yank it back - and I got 'efg'
  6. I press Alt-y - and I should have got 'abc', but it remained as 'efg' - nothing happened.

B. M-x yank-pop is not working either.

C. I run zsh -f and bindkey -e. Then I try the debug process again - it works this time!

So I guess there must be something wrong with my .zshrc - I'm gonna bisect it out.

One ore thing to mention: I'm using the oh-my-ssh package with the following plugins enabled: git django extract gem heroku history-substring-search pip rvm

Thanks Gilles for the zsh -f trick - I didn't realize that the problem was in the configuration files.

  • It works for me. Where did you get your zsh binary? What happens if you run zsh -f? How exactly do you determine that M-y isn't working? What about M-x yank-pop? – Gilles 'SO- stop being evil' Oct 24 '11 at 22:18
  • @Gilles 1. I installed it from pacman -S 2. I've edited my question to include the debug results. Thanks very much. – Limbo Peng Oct 25 '11 at 23:56

After bisecting my .zshrc, I found that the problem was in the oh-my-ssh plugins, namely the history-substring-search plugin.

So I disabled it and ALT+Y works well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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