-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.zsh_keybindings
44 lines (37 loc) · 1.55 KB
/
.zsh_keybindings
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
# vim: ft=zsh
# NOTE many keybindings handled by zsh-vim-mode plugin
# Vi style keybindings
bindkey -v
bindkey -M viins 'kj' vi-cmd-mode
bindkey -rM viins '^[' # unbind esc, use kj instead
zmodload zsh/terminfo
# FUNCTIONS
# delete a Word backwards (like bash)
function bash-backward-kill-word() {
local WORDCHARS='/*?_-.[]~=&;!#$%^(){}<>'
zle backward-kill-word
}
zle -N bash-backward-kill-word
# VI MODE KEYBINDINGS (ins mode)
bindkey -M viins '^r' history-search-multi-word
bindkey -M viins '^p' history-beginning-search-backward
bindkey -M viins '^n' history-beginning-search-forward
# alt-. for last argument, or alt-n alt-. for nth last argument of command
# press repeatedly to apply to previous commands in history
bindkey -M viins "^[." insert-last-word
bindkey -M viins "^[0" digit-argument
bindkey -M viins "^[1" digit-argument
bindkey -M viins "^[2" digit-argument
bindkey -M viins "^[3" digit-argument
bindkey -M viins "^[4" digit-argument
bindkey -M viins "^[5" digit-argument
bindkey -M viins "^[6" digit-argument
bindkey -M viins "^[7" digit-argument
bindkey -M viins "^[8" digit-argument
bindkey -M viins "^[9" digit-argument
bindkey -M viins '\eOH' beginning-of-line # Home
bindkey -M viins '\eOF' end-of-line # End
bindkey -M viins '\e[2~' overwrite-mode # Insert
bindkey -M viins '\e[5~' history-beginning-search-backward # PageUp
bindkey -M viins '\e[6~' history-beginning-search-forward # PageDown
bindkey -M viins '\e[3;5~' kill-word # ctrl-delete