summaryrefslogtreecommitdiff
path: root/user:hugues/KeyBindings.zsh
blob: b06844ddd6e7b4d627f82c193004982930547542 (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
##
## Part of configuration files for Zsh 4
## by Hugues Hiegel <hugues@hiegel.fr>
## 
## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS
##
## You are encouraged to use, modify, and redistribute
## these files with or without this notice.
## 

## Key bindings
#
# Lancez un chtit bindkey dans votre zsh pour voir... 
#

bindkey '[3~' delete-char			# delete
bindkey '[2~' overwrite-mode			# insert
bindkey '' up-line-or-history		# up
bindkey '' down-line-or-history		# down
bindkey '' history-search-backward	# META-up
bindkey '' history-search-forward		# META-down
bindkey '' forward-word			# ESC right
bindkey '' backward-word			# ESC left
bindkey '[3~' kill-region			# ESC del

test $TERM = 'rxvt' -o $TERM = 'xterm' -o $TERM = 'aterm' &&
{
    bindkey '[1~' beginning-of-line	# home
    bindkey '[4~' end-of-line		# end-of-line
    bindkey 'Oc' forward-word		# CTRL right
    bindkey 'Od' backward-word	# CTRL left
    bindkey '[3$' vi-set-buffer		# SHIFT del
    bindkey 'Oa' history-search-backward	# CTRL UP
    bindkey 'Ob' history-search-forward	# CTRL DOWN
}
# (gnome-terminal)
test $TERM = 'xterm' &&
{
    bindkey 'OH' beginning-of-line	# home
    bindkey 'OF' end-of-line		# end-of-line
}

#
# First pass with my personal bindings in vicmd-mode
# 
bindkey -A vicmd main ; source $0:h/Bindings
# And here we re-define the 'push-line' macro
bindkey -s "q" "iq"
bindkey -s "Q" "iQ"

# Second pass with my personal bindings in viins-mode
bindkey -A viins main ; source $0:h/Bindings

# Start every line editor in vicmd-mode.
# 'bindkey -A vicmd main' is not the good way since
# there is no way to enter viins-mode !!.. How tricky..
zle-line-init() { zle vi-cmd-mode }
zle -N zle-line-init
# Go see man zshzle for more details.