Key Bindings #12

Closed
sorin-ionescu opened this Issue Mar 30, 2012 · 4 comments

Comments

3 participants
@sorin-ionescu
Member

sorin-ionescu commented Mar 30, 2012

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

This comment has been minimized.

Show comment
Hide comment
@brendonrapp

brendonrapp Nov 22, 2012

^[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.

^[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

This comment has been minimized.

Show comment
Hide comment
@sunaku

sunaku Nov 22, 2012

Member

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.

Member

sunaku commented Nov 22, 2012

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

This comment has been minimized.

Show comment
Hide comment
@sunaku

sunaku Dec 6, 2012

Member

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

Member

sunaku commented Dec 6, 2012

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

sunaku added a commit that referenced this issue Jan 6, 2013

@sunaku sunaku closed this Jan 6, 2013

@sunaku

This comment has been minimized.

Show comment
Hide comment
@sunaku

sunaku Feb 22, 2013

Member

@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.

Member

sunaku commented Feb 22, 2013

@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 added a commit to ornicar/zsh-history-substring-search that referenced this issue Apr 2, 2013

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment