use utf8;

my %common = (
	"\e"=> 'g9 mode',

	'H' => 'g2', # top-page
	'j' => 'g2', # next-entry, next-undeleted
	'k' => 'g2', # previous-entry, previous-undeleted
	'L' => 'g2', # bottom-page
	'^l'=> 'g1', # refresh
	'M' => 'g2', # middle-page
	'^m'=> 'g6 mode^m', # select-entry, display-message
	'n' => 'g3', # search-next
	'q' => 'g8 mode', # exit
	't' => 'g4', # tag-entry
	'z' => 'g2', # next-page
	'Z' => 'g2', # previous-page

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

{

	'' => {
		%common,

		'@' => 'g1', # display-address
		'.' => 'g8', # buffy-list #TODO
		'|' => 'g6', # pipe-message
		'$' => 'g4', # sync-mailbox
		'#' => 'g4', # break-thread
		'&' => 'g4', # link-threads
		'%' => 'g4', # toggle-write
		' ' => '=^m',

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

	'm' => {
		%common,

		'|' => 'g4',
		'a' => 'g6',
		'A' => 'g6',
		'b' => 'g4',
		'c' => 'g4',
		'C' => 'g6',
		'd' => 'g4',
		'D' => 'g4',
		'^d'=> 'g4',
		'e' => 'g4 linkvi',
		'E' => 'g4 linkvi',
		'^e'=> 'g4',
		'f' => 'g4',
		'^f'=> 'g6',
		'+f'=> 'g4',
		'F' => 'g4',
		'G' => 'g1',
		'h' => 'g1',
		'i' => 'g6',
		'l' => 'g1',
		'm' => 'g4',
		'M' => 'g4',
		'^m'=> 'g1',
		'n' => 'g6',
		'P' => 'g8 mode',
		'r' => 'g4',
		'R' => 'g4',
		's' => 'g4',
		'S' => 'g4 menumS',
		't' => 'g4',
		'^t'=> 'g4',
		'w' => 'g6',
		'u' => 'g6',
		'U' => 'g4',
		'y' => 'g7',
	}, # compose

	w => {
		"\e"=> 'g9 mode',
		'D' => 'g4',
		'd' => '=wD',
		'N' => 'g4',
		'n' => '=wN',
		'O' => 'g4',
		'o' => '=wO',
		'r' => 'g4',
		'R' => '=wr',
		'*' => 'g4',
		'!' => 'g4',
	}, # flag

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

}
