-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_zlerc
64 lines (50 loc) · 2.01 KB
/
_zlerc
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
61
62
63
64
# vim:ft=zsh
typeset -A key
key[Home]="${terminfo[khome]}"
key[End]=${terminfo[kend]}
key[Insert]=${terminfo[kich1]}
key[Delete]=${terminfo[kdch1]}
key[Up]=${terminfo[kcuu1]}
key[Down]=${terminfo[kcud1]}
key[Left]=${terminfo[kcub1]}
key[Right]=${terminfo[kcuf1]}
key[PageUp]=${terminfo[kpp]}
key[PageDown]=${terminfo[knp]}
key[Enter]=${terminfo[kent]}
autoload up-line-or-beginning-search
autoload down-line-or-beginning-search
autoload -U edit-command-line
expand-or-complete-with-dots() {
echo -n "\e[31m......\e[0m"
zle expand-or-complete
zle redisplay
}
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
zle -N expand-or-complete-with-dots
zle -N edit-command-line
bindkey -v
bindkey "^[w" kill-region
bindkey "^r" history-incremental-search-backward
# setup key accordingly
bindkey "${key[Home]}" beginning-of-line
bindkey "${key[End]}" end-of-line
bindkey "${key[Insert]}" overwrite-mode
bindkey "${key[Delete]}" delete-char
bindkey "${key[Up]}" up-line-or-beginning-search
bindkey "${key[Down]}" down-line-or-beginning-search
bindkey "^n" up-line-or-beginning-search
bindkey "^p" down-line-or-beginning-search
bindkey "${key[Left]}" backward-char
bindkey "${key[Right]}" forward-char
bindkey "^[[Z" reverse-menu-complete
bindkey "^[m" copy-prev-shell-word
bindkey "^I" expand-or-complete-with-dots
bindkey -s "\el" "ls\n" # ls on <M-l>
bindkey -s "\e " "vim " # vim on <M-Space>
bindkey -M menuselect '^o' accept-and-infer-next-history
bindkey -M vicmd v edit-command-line
bindkey -M vicmd h vi-backward-char # left
bindkey -M vicmd k up-line-or-beginning-search # up
bindkey -M vicmd l vi-forward-char # right
bindkey -M vicmd j down-line-or-beginning-search # bottom