summaryrefslogtreecommitdiff
path: root/source/bindkeys.zsh
blob: 0c7864614db51876b637d4ce69fc0cb3d263693f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# this is totally not shamelessly stolen from omz-keybindings and zshwiki
# definitely not
# no way

# basic bindings
bindkey ${terminfo[khome]} beginning-of-line
bindkey ${terminfo[kend]}  end-of-line

bindkey ${terminfo[kdch1]} delete-char

bindkey ${terminfo[kcuu1]} up-line-or-history
bindkey ${terminfo[kcud1]} down-line-or-history

bindkey ${terminfo[kcub1]} backward-char
bindkey ${terminfo[kcuf1]} forward-char

bindkey '^?'               backward-delete-char
bindkey ${terminfo[kdch1]} delete-char

# opinionated bindings
bindkey '^r'              history-incremental-search-backward
bindkey '^[[1;5C'         forward-word
bindkey '^[[1;5D'         backward-word
bindkey ${terminfo[kcbt]} reverse-menu-complete

# make sure terminfo keys make actual sense
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
    function zle-line-init () {
        echoti smkx
    }
    function zle-line-finish () {
        echoti rmkx
    }
    zle -N zle-line-init
    zle -N zle-line-finish
fi