174c9177aa34b4c05bb5a1c6f637e6fa479a8e10

Author
Felix Dreissig <f30@f30.me>
Committer
Felix Dreissig <f30@f30.me>
Date

Message

Replace hardcoded key escape sequeneces with dynamic ones from terminfo.

Diff

 1diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh
 2index a57b041222c5f5d8ce74618d8218bf646622dbc3..4a00764da67bc39d51a72b4fa8cb889834e9a487 100644
 3--- a/lib/key-bindings.zsh
 4+++ b/lib/key-bindings.zsh
 5@@ -20,31 +20,24 @@ bindkey -e                                          # Use emacs key bindings
 6 bindkey '\ew' kill-region                           # [Esc-w] - Kill from the cursor to the mark
 7 bindkey -s '\el' 'ls\n'                             # [Esc-l] - run command: ls
 8 bindkey '^r' history-incremental-search-backward    # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line.
 9-bindkey '^[[5~' up-line-or-history                  # [PageUp] - Up a line of history
10-bindkey '^[[6~' down-line-or-history                # [PageDown] - Down a line of history
11+bindkey "${terminfo[kpp]}" up-line-or-history       # [PageUp] - Up a line of history
12+bindkey "${terminfo[knp]}" down-line-or-history     # [PageDown] - Down a line of history
13 
14-bindkey '^[[A' up-line-or-search                    # start typing + [Up-Arrow] - fuzzy find history forward
15-bindkey '^[[B' down-line-or-search                  # start typing + [Down-Arrow] - fuzzy find history backward
16+bindkey "${terminfo[kcuu1]}" up-line-or-search      # start typing + [Up-Arrow] - fuzzy find history forward
17+bindkey "${terminfo[kcud1]}" down-line-or-search    # start typing + [Down-Arrow] - fuzzy find history backward
18 
19-bindkey '^[[H' beginning-of-line                    # [Home] - Go to beginning of line
20-bindkey '^[[1~' beginning-of-line                   # [Home] - Go to beginning of line
21-bindkey '^[OH' beginning-of-line                    # [Home] - Go to beginning of line
22-bindkey '^[[F'  end-of-line                         # [End] - Go to end of line
23-bindkey '^[[4~' end-of-line                         # [End] - Go to end of line
24-bindkey '^[OF' end-of-line                          # [End] - Go to end of line
25+bindkey "${terminfo[khome]}" beginning-of-line      # [Home] - Go to beginning of line
26+bindkey "${terminfo[kend]}"  end-of-line            # [End] - Go to end of line
27 
28 bindkey ' ' magic-space                             # [Space] - do history expansion
29 
30 bindkey '^[[1;5C' forward-word                      # [Ctrl-RightArrow] - move forward one word
31 bindkey '^[[1;5D' backward-word                     # [Ctrl-LeftArrow] - move backward one word
32 
33-bindkey '^[[Z' reverse-menu-complete                # [TODO] - Perform menu completion, like menu-complete, except that if a menu completion is already in progress, move to the previous completion rather than the next.
34+bindkey "${terminfo[kcbt]}" reverse-menu-complete   # [Shift-Tab] - move through the completion menu backwards
35 
36-# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~
37-bindkey '^?' backward-delete-char                   # [Delete] - delete backward
38-bindkey '^[[3~' delete-char                         # [fn-Delete] - delete forward
39-bindkey '^[3;5~' delete-char                        # [TODO] - delete forward
40-bindkey '\e[3~' delete-char                         # [TODO] - delete forward
41+bindkey '^?' backward-delete-char                   # [Backspace] - delete backward
42+bindkey "${terminfo[kdch1]}" delete-char            # [Delete] - delete forward
43 
44 # consider emacs keybindings:
45