Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Key Bindings #12

Closed
sorin-ionescu opened this Issue · 4 comments

3 participants

@sorin-ionescu

Should it bind itself, or should it allow the user to bind it manually, and if it should bind itself, should not it bind itself to more keys?

Right now, it only binds itself to the following sequences, which I believe are not valid for all terminals. There are also ^[OA, ^[OB, for example.

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

In my OMZ fork, I actually use $terminfo to get the sequences, but I also bind it to more keys.

bindkey -M emacs "^P" history-substring-search-up
bindkey -M emacs "^N" history-substring-search-down
bindkey -M vicmd "k" history-substring-search-up
bindkey -M vicmd "j" history-substring-search-down

for keymap in 'emacs' 'viins'; do
  bindkey -M "$keymap" '\e[A' history-substring-search-up
  bindkey -M "$keymap" '\e[B' history-substring-search-down
done
unset keymap
@brendonrapp

^[0A and ^[0B are exactly what I have to bind myself to get this to work on my Ubuntu terminals. Thanks for this bug report, it helped clue me in as to why this was working great on my Mac but not at all on my Ubuntu machine.

@sunaku
Owner

I have added Sorin's suggestion to a new bindkey branch. Please try it out.

If there are no problems, I'll release it by merging it into the master branch.

@sunaku
Owner

Any feedback on these changes? Shall I merge them into master?

@sunaku sunaku closed this
@sunaku
Owner

@LegionSB and other Ubuntu or Debian users take note!

Adding this snippet to your ~/.zshenv file solves the problem:

# allow UP and DOWN arrow keys in xterm(1) to be re-bindable within ZSH           
# https://bugs.launchpad.net/ubuntu/+source/zsh/+bug/1048212/comments/6           
DEBIAN_PREVENT_KEYBOARD_CHANGES=yes

This worked for me in Ubuntu 12.10.

@ornicar ornicar referenced this issue from a commit in ornicar/zsh-history-substring-search
@ornicar ornicar Merge branch 'master' of https://github.com/zsh-users/zsh-history-sub…
…string-search

* 'master' of https://github.com/zsh-users/zsh-history-substring-search:
  we need to bind ^[[A and ^[[B not ^[A and ^[B
  GH-12: fix arrow bindkey and support emacs & vicmd

Conflicts:
	zsh-history-substring-search.zsh
92bfd1c
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.