aboutsummaryrefslogtreecommitdiffstats
path: root/zsh/keybindings.zsh
blob: fb2b94a24bb0182ab6006f17df944c584bcc1049 (plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
##
# Keybindings
#


# Make sure the terminal is in application mode when zle is active. Only then
# are the values from $terminfo valid.
zle-line-init() {
	printf '%s' "${terminfo[smkx]}"
}
zle-line-finish () {
	printf '%s' "${terminfo[rmkx]}"
}
zle -N zle-line-init
zle -N zle-line-finish
zle -N edit-command-line


# Don't skip over / in e.g. paths
# <http://zshwiki.org/home/zle/bindkeys>
export WORDCHARS="${WORDCHARS:s#/#}"


bindkey -v

# Shift-tab
bindkey $terminfo[kcbt] reverse-menu-complete

# Insert
bindkey $terminfo[kich1] overwrite-mode

# Delete
bindkey $terminfo[kdch1] delete-char

bindkey $terminfo[khome] beginning-of-line
bindkey $terminfo[kend] end-of-line

# Backspace (and <C-h>)
bindkey $terminfo[kbs] backward-delete-char

# Do history expansion on space
bindkey ' ' magic-space

bindkey '^H' backward-delete-char
bindkey '^[w' backward-kill-word

bindkey '^[f' forward-word
bindkey '^[b' backward-word

bindkey '^[r' redo
bindkey '^[u' undo

# Patterned history search with zsh expansion, globbing, etc.
bindkey '^R' history-incremental-pattern-search-backward

# Verify search result before accepting
bindkey -M isearch '^M' accept-search

# Misc
bindkey -M vicmd 'ga' what-cursor-position