Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


history-substring-search doesn't work after update to Ubuntu 12.10 [has workaround] #1433

seriyps opened this Issue · 68 comments

history-substring-search just doesn't work since I update my distro from 12.04 to 12.10.
I mean that when I type smth, eg ls and press up-arrow button, it shows me last history item, not started from ls.

My .zshrc

$ cat .zshrc | grep -v -E "^# .*"
ZSH_THEME="clean" # fletcherm
plugins=(git history-substring-search command-not-found)
source $ZSH/
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

ZSH version

$ zsh --version
zsh 5.0.0 (i686-pc-linux-gnu)

I've just done a clean install of ubuntu 12.10 on a new machine and this seems to be happening to me too.

ZSH: zsh 5.0.0 (x86_64-unknown-linux-gnu), OMZ: 22f827e, dotfiles


Debian Wheezy - same issue - all I did was update oh-my-zsh today (and the issue is present on a server I have running Squeeze)

edit ZSH 4.3.10-14 on the Squeeze machine and 4.3.17-1 on Wheezy


I have this issue too, on two different machines, both on ubuntu 12.10 x64. One of them was an upgrade from 12.04, the other one was a clean install. history-substring-search doesn't work on either.

zsh 5.0.0 (x86_64-unknown-linux-gnu)


+1, Ubuntu 12.10, clean install.
It seems a zsh bug in Ubuntu -


Fortunately, there is a workaround.

Put this line to ~/.zshenv:


Great! It works! Thanks cutalion!


When Oh My ZSH updated on my mac (10.8.2) this started happening to me as well =(

@corpix corpix referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.

Same issue here with unity 12.10. Even work around didn't work for me.


does not work for me either :(

System: Ubuntu 12.10

@Adarsh-Barik Adarsh-Barik referenced this issue in zsh-users/zsh-history-substring-search

zsh-history-substring-search is not working with ubuntu 12.10. #16


@cutalion's suggestion worked for me.


Any news here? I have the same problem and the workaround does not work for me.


@sotte the default setup started working for me again except on one machine where I had enabled some plugins that weren't enabled on the working ones. I disabled them and it works out of the box again.

Double check which plugins you have enabled and test if any of them is still breaking it.


Here is my .zshrc. No plugin is enabled. The workaround has no effect.

source $ZSH/


What version of ZSH do you have?

What commit of Oh-My-Zsh are you at?

EDIT also - did you comment out the workaround because it had no effect or did you add it already commented?


I tried it with and without the workaround. No effect.

omz is the current version: 615e41b
zsh 5.0.0 (x86_64-unknown-linux-gnu)


I have no problems with Ubutu 12.04 and zsh 4.3.17 (x86_64-unknown-linux-gnu). The config is the same. The workaround is not activated.


Same problem for me, and setting DEBIAN_PREVENT_KEYBOARD_CHANGES=yes doesn't help.


In case it's helpful. I have Ubuntu 12.10, zsh 5.0.0 (x86_64-unknown-linux-gnu) with the same issue initially.

Putting "export DEBIAN_PREVENT_KEYBOARD_CHANGES=yes" in .zshrc does not fix the issue.
But putting "DEBIAN_PREVENT_KEYBOARD_CHANGES=yes" into .zshenv appears solving the problem for me.

Could be related to the order of setting this variable.


xubuntu 12.10
updating .zshrc with DEBIAN_PREVENT_KEYBOARD_CHANGES=yes solved the issue


Same issue here. Updated to Ubuntu 12.10. Code below doesn't help:

Fixed with adding this into .zshenv (not .zshrc):


Yes, found solution immediately after posted comment. Editing .zshrc is not required at all. Thanks!


Worked for my ubuntu


Worked for me THANKS Damn it made my day :D

PS : Linux Mint 14 (based on ubuntu 12.10)


Worked for me
Ubuntu 13.04, zsh 5.0.0-2ubuntu3


@cutalion - Great, it works, many thanks! :)
@robbyrussell - Are you going to make this as part of the installation script? If not, then probably this issue should be closed, as it seems is ubuntu-specific... (or?)


this is something I've suffered with for many months, and just dealt with. Finding this fix just made my month.


Its working for me but i am getting this message whenever I use it
_history-substring-search-end:9: _zsh_highlight: function definition file not found
system: ubuntu 13.04


I have the same problem on OS X 10.8.3, zsh 5.0.2 (x86_64-apple-darwin12.2.0), newest omz master


sorry, my bad. I didn't realize that zsh-syntax-highlighting doesn't come with default installation of oh-my-zsh. Installing zsh-syntax-highlighting in plugins directory solved the issue. Commenting 9th line in the function _history-substring-search-end function in history-substring-search.zsh also works if you don't use syntax highlighting.


Just to add another data point, adding DEBIAN_PREVENT_KEYBOARD_CHANGES=yes to ~/.zshenv worked for me on Ubuntu 13.04 64-bit, ZSH 5.0.0


None of these suggestions were working for me on Ubuntu 13.04 with zsh 5.0.0. The thing that finally worked for me was to put the following at the BOTTOM of my .zshrc:

source $ZSH/plugins/history-substring-search/history-substring-search.zsh

I do a fair amount of customizations in my .zshrc including RVM (ruby version manager). I am guessing that something else was conflicting with my history-substring-search.


Funny. On a different Ubuntu 13.04 machine of mine, the echo "DEBIAN_PREVENT_KEYBOARD_CHANGES=yes" >> ~/.zshenv worked like a champ. Oh well. I'm glad it is working regardless. BTW, I'm happy there are some good solutions on bug.


+1. Same problem on Ubuntu 12.10 x64 Desktop with zsh 5.0.0 and rvm

source $ZSH/plugins/history-substring-search/history-substring-search.zs at the bottom of my .zshrc does the trick.


It's somewhere in the debian plugin, worked again for me as soon as i'd deactivated the debian plugin in .zshrc.

Confusing is, reactivating of the debian plugin don't break it again...


I ran into this on Debian 7.2, and nothing worked until I added source $ZSH/plugins/history-substring-search/history-substring-search.zs at the end of my .zshrc .


On my Mac (zsh 5.0.2) the commit which introduces the defect seems to be zsh-users/zsh-history-substring-search@82fbef5


It's not working here too. zsh 5.0.2 and Ubuntu 13.10.

None of the above fixes worked either...


The DEBIAN_PREVENT_KEYBOARD_CHANGES fix in .zshenv worked for me. Using Zsh 5.0.0 and Ubuntu 13.04.


Got it working on Ubuntu 13.10 by adding the paste-safe plugin (suggested here: #1720).

No DEBIAN_PREVENT_KEYBOARD_CHANGES=yes and no source $ZSH/plugins/history-substring-search/history-substring-search.zsh (both didn't work anymore).


@jvf - :+1: That solved the issue for me too (and home/end work again!) :)


Fixed on Ubuntu 13.10 by adding those two line in my .zshrc

bindkey '\eOA' history-substring-search-up
bindkey '\eOB' history-substring-search-down

I also have DEBIAN_PREVENT_KEYBOARD_CHANGES=yes in my zshenv


Neither adding paste-safe nor using the bindkey-trick worked for me. I still have no substring history…

Perhaps there is something wrong in general with my plugin setup…

plugins=(vagrant cabal git git-flow gitignore bundler rails github rvm sublime composer history-sub string-search command-not-found zsh-syntax-highlighting)

on my ubuntu 12.04 i added this to .zshrc:

zmodload zsh/terminfo
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down

and I've DEBIAN_PREVENT_KEYBOARD_CHANGES=yes in my .zshenv


@Eustachy's trick works for me.


As @Eustachy suggested, using

bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down

instead of

bindkey '\e[A' history-substring-search-up
bindkey '\e[B' history-substring-search-down

fixed it for me (on Mac OS X, will test my Ubuntu machine at the beginning of next week) and is a lot cleaner than the paste-safe hack.

To add a (possible) explanation:
The problem seems to be 174c917 introduced 9 days ago through PR #1355. This commit changed the keybindings in lib/key-bindings.zsh from

bindkey '^[[A' up-line-or-search                    # start typing + [Up-Arrow] - fuzzy find history forward
bindkey '^[[B' down-line-or-search                  # start typing + [Down-Arrow] - fuzzy find history backward


 bindkey "${terminfo[kcuu1]}" up-line-or-search      # start typing + [Up-Arrow] - fuzzy find history forward
 bindkey "${terminfo[kcud1]}" down-line-or-search    # start typing + [Down-Arrow] - fuzzy find history backward

When one now attempts to override the keybindings from lib/key-bindings.zsh with '\e[A' (or '^[[A') and '\e[B' (or '^[[B') this doesn't work anymore, so one has to use the terminfo key codes kcuu1 and kcud1.


@Eustachy's trick works for me.


@Eustachy / @jvf thanks so much for the fix


Please test PR #2511 which tries to fix this, +1 it if it works.


@Eustachy & @jvf ... thank you!


@tomek that worked for me. I had a feeling it had something to to with the term I was using (I'm also using tmux on occasion so the history substring sometimes works then doesn't)


For Mac OS X users, I have added this:

bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down

after this line:

source $ZSH/

now it is working like a charm :)


The fix mentioned by @jvf here worked for me on OSX 10.9.2 also!


@robbyrussell This issue has been open for a year and a pull request (#2511) ready for about a month now. Any chance on seeing this merged soon?


#2511 has been merged. Update oh-my-zsh and check that it works, then close the issue.
/cc @seriyps


Works for me


The most recent oh-my-zsh update just broke this for me again on Mac OS 10.9.2


@billcarroll - Yeah, for me it broke again too (a few days back actually, but I wouldn't be able to pin-point which update).

If it weren't annoying, it would be funny how often this brakes! :-/


I'm experiencing this issue on Fedora 20, and have been for some months. Adding DEBIAN_PREVENT_KEYBOARD_CHANGES=yes to .zshenv did not change anything. Moving 'history-substring-search' to the end of the plugin list in .zshrc did not change anything.

I notice that it works fine on NetBSD, through tmux, with TERM=screen.



bindkey '\e[A' history-substring-search-up
bindkey '\e[B' history-substring-search-down

after loading omz works for me, with TERM=screen-256color


@zweifisch Awesome! That's great, thank you!

FWIW, that also works with TERM=xterm-256color (and through tmux)


Is a fix planned for this?


Here's what I use to make it work again:

# history-substring-search stopped working; see `man terminfo`
# keyboard generates cuu1/cud1 instead of kcuu1/kcud1
bindkey "$terminfo[cuu1]" history-substring-search-up
bindkey "$terminfo[cud1]" history-substring-search-down

This bug started to appear for me recently. None of the solutions given above works for me.


I'm having the same issue. On the latest (96e4e5d) with Mac OSX 10.9.5. Here's my plugin setup:

plugins=(git osx history-substring-search)

Strangely, if I source ~/.oh-my-zsh/plugins/history-substring-search/history-substring-search.zsh the plugin directly it works just fine. Any thoughts?

@gabrieldain gabrieldain referenced this issue from a commit in gabrieldain/dotfiles
@gabrieldain gabrieldain [FEATURE] Enable history-substring-search in zsh.
Manually source history-substring-search.zsh in .zshrc. Had to source manually
because adding plugin to oh-my-zsh did nothing. Apparently this is a known bug
that affect Debian-based distros?


Going to close this one out... and hope that it's resolved for folks. (we can open up new issues as necessary)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.