use utf8;

my %common = (
	'H' => ['pm'], # top-page
	'j' => ['pm'], # next-entry, next-undeleted
	'k' => ['pm'], # previous-entry, previous-undeleted
	'L' => ['pm'], # bottom-page
	'^l'=> ['ci'], # refresh
	'M' => ['pm'], # middle-page
	'^m'=> ['mi mode^m'], # select-entry, display-message
	'n' => ['po'], # search-next
	'q' => ['mv mode'], # exit
	't' => ['co'], # tag-entry
	'z' => ['pm'], # next-page
	'Z' => ['pm'], # previous-page

	'*' => ['pm'], # last-entry
	'=' => ['pm'], # first-entry
	':' => ['mi'], # enter-command
	';' => ['mi arg'], # tag-prefix
	'>' => ['pm'], # next-line
	'<' => ['pm'], # previous-line
	']' => ['pm'], # half-down
	'[' => ['pm'], # half-up
	'?' => ['ci'], # help
	'!' => ['ci arg'], # shell
	'/' => ['po arg mode/~'], # search
	'+/'=> ['po arg mode/~'], # search
);

{

'' => {
	%common,

	'@' => ['ci'], # display-address
	'.' => ['mv'], # buffy-list #TODO
	'|' => ['mi'], # pipe-message
	'$' => ['co'], # sync-mailbox
	'#' => ['co'], # break-thread
	'&' => ['co'], # link-threads
	'%' => ['co'], # toggle-write
	' ' => '^m',

	'a' => ['mi'], # create-alias
	'b' => ['mo'], # bounce-message
	'^b'=> ['ci'],
	'+b'=> [undef], # M <search>~b
	'c' => ['mv'], # change-folder
	'C' => ['mi'], # copy-message
	'+c'=> ['mv'], # change-folder-readonly
	'+C'=> [undef], # decode-copy
	'd' => ['co'], # delete-message
	'D' => ['co arg'], # delete-pattern
	'^d'=> ['co'], # delete-thread
	'+d'=> ['co'], # delete-subthread
	'e' => ['co'], # edit
	'^e'=> ['co'], # edit-type
	'+e'=> [undef], # resend-message
	'f' => ['mo modem'], # forward-message
	'F' => ['co'], # flag-message
	'^f'=> ['mi'], # forget-passphrase
	'g' => ['mo modem'], # group-reply
	'G' => ['mi'], # fetch-mail
	'h' => ['me'], # display-toggle-weed
	'^i'=> ['po'], # next-new-then-unread
	'+^i'=> [undef], # previous-new-then-unread
	'j' => ['pm'], # next-undeleted
	'k' => ['pm'], # previous-undeleted
	'J' => ['po'], # next-entry
	'K' => ['po'], # previous-entry
	'^k'=> ['ci'], # extract-keys
	'+k'=> ['mo modem'], # mail-key
	'l' => ['me'], # limit
	'L' => ['mo modem'], # list-reply
	'+l'=> ['ci'], # show-limit
	'm' => ['mo modem'], # mail
	'N' => ['co'], # toggle-new
	'^n'=> ['po'], # next-thread
	'+n'=> ['po'], # next-subthread
	'o' => ['me modeo'], # sort-mailbox
	'O' => ['me modeo'], # sort-reverse
	'p' => ['ci'], # print-message
	'P' => ['po'], # parent-message
	'^p'=> ['po'], # previous-thread
	'+p'=> ['po'], # previous-subthread
	'+P'=> [undef], # check-traditional-pgp
	'q' => ['mv'], # quit
	'Q' => ['ci arg'], # query
	'r' => ['mo modem'], # reply
	'R' => ['mo modem'], # recall-message
	'^r'=> ['co'], # read-thread
	'+r'=> ['co'], # read-subthread
	's' => ['co'], # save-message
	'+s'=> ['co'], # decode-save
	'T' => ['co arg'], # tag-pattern
	'^t'=> ['co'], # untag-pattern
	'+t'=> ['co'], # tag-thread
	'u' => ['co'], # undelete-message
	'U' => ['co arg'], # undelete-pattern
	'^u'=> ['co'], # undelete-thread
	'+u'=> ['co'], # undelete-subthread
	'v' => ['ci'], # view-attachments
	'V' => ['ci'], # show-version
	'+v'=> ['me'], # collapse-thread
	'+V'=> ['me'], # collapse-all
	'w' => ['co arg modew'], # set-flag
	'W' => ['co arg modew'], # clear-flag
	'x' => ['mv'], # exit
	'y' => ['mv'], # M <change-folder>?<toggle-mailboxes>
}, # index

'm' => {
	%common,

	'|' => ['co'],
	'a' => ['mi'],
	'A' => ['mi'],
	'b' => ['co'],
	'c' => ['co'],
	'C' => ['mi'],
	'd' => ['co'],
	'D' => ['co'],
	'^d'=> ['co'],
	'e' => ['co linkvi'],
	'E' => ['co linkvi'],
	'^e'=> ['co'],
	'f' => ['co'],
	'^f'=> ['mi'],
	'+f'=> ['co'],
	'F' => ['co'],
	'G' => ['ci'],
	'h' => ['ci'],
	'i' => ['mi'],
	'l' => ['ci'],
	'm' => ['co'],
	'M' => ['co'],
	'^m'=> ['ci'],
	'n' => ['mi'],
	'P' => ['mv mode'],
	'r' => ['co'],
	'R' => ['co'],
	's' => ['co'],
	'S' => ['co menumS'],
	't' => ['co'],
	'^t'=> ['co'],
	'w' => ['mi'],
	'u' => ['mi'],
	'U' => ['co'],
	'y' => ['mo'],
}, # compose

w => {
	'D' => ['co'],
	'd' => 'wD',
	'N' => ['co'],
	'n' => 'wN',
	'O' => ['co'],
	'o' => 'wO',
	'r' => ['co'],
	'R' => 'wr',
	'*' => ['co'],
	'!' => ['co'],
}, # flag

'/~' => {
	A => [undef],
	b => ['X arg'],
	B => ['arg'],
	c => ['arg'],
	C => ['arg'],
	d => ['arg'],
	D => [undef],
	e => ['arg'],
	E => [undef],
	f => ['arg'],
	F => [undef],
	g => [undef],
	G => [undef],
	h => ['arg'],
	H => ['arg'],
	i => ['arg'],
	k => [undef],
	L => ['arg'],
	l => [undef],
	m => ['arg'],
	n => ['arg'],
	N => [undef],
	O => [undef],
	p => [undef],
	P => [undef],
	Q => [undef],
	r => ['arg'],
	R => [undef],
	s => [undef],
	S => [undef],
	t => ['arg'],
	T => [undef],
	u => [undef],
	U => [undef],
	v => [undef],
	V => [undef],
	x => ['arg'],
	X => ['arg'],
	y => ['arg'],
	z => ['arg'],
	'=' => [undef],
	'$' => [undef],
	'(' => ['arg'],
}, # search option

}
