Tuesday, September 10, 2013

Setup KeySequences and Bindings Manually

Recently, I switch from bash to zsh, and face some keys binding issue. The [Home] and [End] keys are not working like bash.

Then I learn a manual way to setup the correct key-sequences and binding them manually that will always work. For example, here's how I test the 3 key-sequences, [Home] and [End]:
$ cat > /dev/null
^[[1~
^[[4~
^C
Then, I setup the key bindings in my $HOME/.zshrc file:
bindkey '^[[1~' beginning-of-line      # Home
bindkey '^[[4~' end-of-line            # End
bindkey '^[[2~' beep                   # Insert
bindkey '^[[3~' delete-char            # Del
bindkey '^[[5~' vi-backward-blank-word # Page Up
bindkey '^[[6~' vi-forward-blank-word  # Page Down