#bindkey -k up		history-search-backward		# Up
#bindkey -k down		history-search-forward		# Down
bindkey '\e[1~'		beginning-of-line		# Home
#bindkey '\e[2~'	dabbrev-expand			# Insert
bindkey '\e[2~'		overwrite-mode			# Insert
bindkey '\e[3~'		delete-char			# Del
bindkey '\e[4~'		end-of-line			# End
bindkey '\e[5~'		history-search-backward		# Page up: search history backwards for line
#bindkey '\e[5~'	complete-word-back		# page up
bindkey '\e[6~'		history-search-forward		# Page down: search history forwards for line
#bindkey '\e[6~'	complete-word-fwd		# page down
bindkey '\e[20~'	complete-word-fwd		# F9
bindkey '\e[21~'	complete-word-back		# F10
bindkey ^[[3D		backward-word			# Alt-left arrow
bindkey ^[[3C		forward-word			# Alt-right arrow
bindkey -b M-\b		backward-delete-word		# Meta-backspace

bindkey -b M-s		i-search-fwd
bindkey -b M-r		i-search-back
bindkey -b M-$		expand-variables
#bindkey '\244'		expand-variables		# M-$ notation seems to be broken
bindkey -b M-*		expand-glob
bindkey -b M-8		expand-glob
#bindkey '\e8'		expand-glob
bindkey -b M-4		expand-variables
#bindkey '\e4'		expand-variables
bindkey -b M-_		insert-last-word
bindkey ' '		magic-space

bindkey -b M-b		backward-word
bindkey -b M-c		capitalize-word
bindkey -b M-d		delete-word
bindkey -b M-f		forward-word
bindkey -b M-h		run-help
bindkey -b M-l		downcase-word
bindkey -b M-n		history-search-forward
bindkey -b M-p		history-search-backward
bindkey -b M-r		toggle-literal-history
bindkey -b M-u		upcase-word
bindkey -b M-w		copy-region-as-kill
bindkey -b M-y		yank				# Yank cut text
bindkey -b C-space	set-mark-command		# Ctrl-space: mark text

### Don't work, or I don't know what they do.
#bindkey '\e[7~'	beginning-of-line		# rxvt home
#bindkey '\e[8~'	end-of-line			# rxvt end
#bindkey '\e[\304'	backward-word			# rxvt M-left
#bindkey '\e[\303'	forward-word			# rxvt M-right
#bindkey '\e[\301'	beginning-of-line		# rxvt M-up
#bindkey '\e[\302'	end-of-line			# rxvt M-down
#bindkey '\eOd'		backward-word			# rxvt C-left
#bindkey '\eOc'		forward-word			# rxvt C-right
#bindkey '\eOa'		upcase-word			# rxvt C-up
#bindkey '\eOb'		downcase-word			# rxvt C-down
#bindkey '\e[3\376'	delete-word		# rxvt M-delete


### ESC-left-arrow : go to beginning of left word.
### The second version is used to fix a strange bug where the binding
### stops working after some usage. Did not manage to recreate.
#bindkey    ^[^[[D vi-word-back
#bindkey    \x{4420}vi-word-back

### ESC-right-arrow : go to beginning of right word.
### The second version is used to fix a strange bug where the binding
### stops working after some usage. Did not manage to recreate.
#bindkey    ^[^[[C vi-word-fwd
#bindkey    \x{4320}vi-word-fwd

### F1 : help on command currently typed(if 'ls passwd', help on 'ls').
### first: while in console mode, second: while in X
#bindkey    ^[[[A   run-help
#bindkey    \x{5020}   run-help

### F2 : set the mark command to cursor position.
### first: while in console mode, second: while in X
#bindkey  ^[[[B    set-mark-command
#bindkey  \x{5120}    set-mark-command

### F3 : move cursor to the marked position.
### first: while in console mode, second: while in X
#bindkey   ^[[[C   exchange-point-and-mark
#bindkey   \x{5220}   exchange-point-and-mark

### F4 : --empty--
### first: while in console mode, second: while in X
#bindkey   ^[[[D   undefined-key
#bindkey   \x{5320}  undefined-key

### F5 : check line for spelling and make changes.
### first: while in console mode, second: while in X
#bindkey    ^[[[E   spell-line
#bindkey    [15~   spell-line

### F6 : check current word for spelling and make changes.
### same in both console and X modes
#bindkey    ^[[17~  spell-word

### F7 : insert last item of previous command.
#bindkey    ^[[18~  insert-last-word

### F8 : search in history backwards for line beginning as current.
#bindkey   ^[[19~  history-search-backward

### F9 : clear screen.
### You may be in the middle of a command when you use this.
### Does not affect what you are writing at the moment.
#bindkey    ^[[20~  clear-screen

### F10 : do an 'ls -l'.    (\16 is Ctrl-U on Linux(and Sun?))
#bindkey -s ^[[21~  "\16ls -l\n"

### F11 : display load average and current process status.
#bindkey    ^[[23~  "/usr/bin/uptime ; ps"

### F12 : do a ala-csh completion.
#bindkey    ^[[24~  complete-word-raw

### Thanks to Carlos Duarte <cgd@teleweb.pt>
### Eazy edit of path, type Ctrl-X p
bindkey -s '^Xp'        '. `echo $path`^X*)^A^Dset path = ( '

### Ctrl-X *   Expand glob. example: ls *<^X*>  will expand the line
bindkey -s ^[[21~  "\16ls -l\n"

### F11 : display load average and current process status.
#bindkey    ^[[23~  "/usr/bin/uptime ; ps"

### F12 : do a ala-csh completion.
#bindkey    ^[[24~  complete-word-raw

