use utf8;

my %common = (
	'H' => "screen top",
	'j' => "entry <down>",
	'k' => "entry <up>",
	'L' => "screen bottom",
	'^l'=> "redraw",
	'M' => "screen middle",
	'^m'=> "select",
	'n' => "search <down>",
	'q' => "exit",
	't' => "tag",
	'z' => "page <down>",
	'Z' => "page <up>",
	'*' => "last entry",
	'=' => "first entry",
	':' => "enter command",
	';' => "apply to tagged",
	'>' => "line <down>",
	'<' => "line <up>",
	']' => "half page <down>",
	'[' => "half page <up>",
	'?' => "help",
	'!' => "invoke shell",
	'/' => "search <down>",
	'+/'=> "search <up>",
);

{
key => {
	%common,

	'@' => "display sender",
	'.' => "list new mail",
	'|' => "pipe to shell",
	'$' => "save mailbox",
	'#' => "split up thread",
	'&' => "thread tagged",
	'%' => "toggle reado<>nl<>y",

	'a' => "create alias",
	'b' => "bounce",
	'^b'=> "url<>view",
	'+b'=> "search bodies",
	'c' => "open folder",
	'C' => "copy messag<>e",
	'+c'=> "open reado<>nly",
	'+C'=> "make plain copy",
	'd' => "delete",
	'D' => "delete patt<>er<>n",
	'^d'=> "delete thread",
	'+d'=> "delete subthread",
	'e' => "edit",
	'^e'=> "edit con<>tent type",
	'+e'=> "edit+send copy",
	'f' => "forward",
	'F' => "toggle important",
	'^f'=> "forget pass<>phras<>e",
	'g' => "reply to all\nGroup reply",
	'G' => "fetch POP\nGather new mail",
	'h' => "toggle headers",
	'^i'=> "unread msg <down>",
	'+^i'=> "unread msg <up>",
	'j' => "messag<>e <down>",
	'k' => "messag<>e <up>",
	'J' => "any <down>",
	'K' => "any <up>",
	'^k'=> "extract pub keys",
	'+k'=> "send public key",
	'l' => "limit pattern",
	'L' => "reply to list",
	'+l'=> "show current limit",
	'm' => "compo<>s<>e mail",
	'N' => "toggle new",
	'^n'=> "thread <down>",
	'+n'=> "subthr<>ead <down>",
	'o' => "sort",
	'O' => "sort reverse",
	'p' => "print",
	'P' => "to parent",
	'^p'=> "thread <up>",
	'+p'=> "subthr<>ead <up>",
	'+P'=> "check for pgp",
	'q' => "quit",
	'Q' => "query addr<>ess<>es",
	'r' => "reply to sender",
	'R' => "recall postpon<>e<>d",
	'^r'=> "mark thread read",
	'+r'=> "mark sub<>thread r<>ead",
	's' => "move",
	'+s'=> "save and delete",
	'T' => "tag patt<>er<>n",
	'^t'=> "untag pattern",
	'+t'=> "tag thread",
	'u' => "undo delete",
	'U' => "res<>tore pat<>t<>er<>n",
	'^u'=> "restore thread",
	'+u'=> "restore subthread",
	'v' => "attach<>ments",
	'V' => "version",
	'+v'=> "(un)collapse thread",
	'+V'=> "(un)collapse threads",
	'w' => "set flag",
	'W' => "clear flag",
	'x' => "abort",
	'y' => "list incoming mailboxes",

	(map { 'm'.$_ => $common{$_} } keys %common),

	'm|' => "pipe attach<>m<>ent",
	'ma' => "attach file",
	'mA' => "attach messag<>e",
	'mb' => "edit bcc",
	'mc' => "edit cc",
	'mC' => "copy file",
	'md' => "desc<>ribe attach<>m<>ent",
	'mD' => "delete attach<>m<>ent",
	'm^d'=> "dispo<>sition tog<>gle",
	'me' => "edit body",
	'mE' => "edit all",
	'm^e'=> "edit encoding",
	'mf' => "edit fcc",
	'm^f'=> "forget pass<>phrase",
	'm+f'=> "edit from",
	'mF' => "filter attach<>m<>ent",
	'mG' => "get attach<>m<>ent",
	'mh' => "display message",
	'mi' => "run ispell",
	'ml' => "print attach<>m<>ent",
	'mm' => "edit attach<>m<>ent\nMime-appropriate open",
	'mM' => "edit mix",
	'm^m'=> "view attach<>m<>ent",
	'mn' => "new attach<>m<>ent",
	'mP' => "post<>pone",
	'mr' => "edit reply<>-to",
	'mR' => "rename attach<>m<>ent",
	'ms' => "edit subject",
	'mS' => "s/mime options",
	'mt' => "edit to",
	'm^t'=> "ctype attach<>m<>ent",
	'mw' => "copy to folder",
	'mu' => "unlink toggle",
	'mU' => "encode attach<>m<>ent",
	'my' => "send",

	'wD' => "deleted",
	'wN' => "new",
	'wO' => "old",
	'wr' => "replied",
	'w*' => "tagged",
	'w!' => "flagged",

	'/~A' => "all",
	'/~b' => "msg body",
	'/~B' => "whole msg",
	'/~c' => "cc address",
	'/~C' => "to or cc address",
	'/~d' => "date sent ran<>g<>e",
	'/~D' => "deleted",
	'/~e' => "sender",
	'/~E' => "expired",
	'/~f' => "from",
	'/~F' => "flagged",
	'/~g' => "signed",
	'/~G' => "encryp<>ted",
	'/~h' => "header",
	'/~H' => "spam attr<>ib<>ute",
	'/~i' => "msg id",
	'/~k' => "pgp key",
	'/~L' => "receiv<>d by",
	'/~l' => "mailing list",
	'/~m' => "num<>ber ran<>g<>e",
	'/~n' => "score range",
	'/~N' => "new",
	'/~O' => "old",
	'/~p' => "to you",
	'/~P' => "by you",
	'/~Q' => "replies",
	'/~r' => "receive date ran<>ge",
	'/~R' => "read",
	'/~s' => "subject",
	'/~S' => "super<>seded",
	'/~t' => "to address",
	'/~T' => "tagged",
	'/~u' => "subscr<>ibed list",
	'/~U' => "unread",
	'/~v' => "collapsed thread",
	'/~V' => "verified",
	'/~x' => "refer<>ence",
	'/~X' => "attach<>ments",
	'/~y' => "x-label",
	'/~z' => "size range",
	'/~=' => "dupli<>cate",
	'/~$' => "unrefer<>enced",
	'/~(' => "in thread",

	# globally label escape as meta key
	  "\e"=> "+",
	 "m\e"=> "+",
	 "w\e"=> "+",
	"/~\e"=> "+",
},

mode => {
	'' => 'index',
	'm' => 'compose (m)',
	w => 'message flags (w)',
	'/~' => 'search flags (/~)',
},

flag => {
	ci => [aside   => "Temporarily display something without changing state."],
	pm => [select  => "Scroll list and/or select a different line."],
	po => [search  => "Go to a specific message entry."],
	co => [edit    => "Modify message flags or contents."],
	mi => [command => "Any other action which does not alter an existing message."],
	mo => [send    => "Prepare and/or send a (new) message."],
	mv => [leave   => "Exit the opened folder."],
	me => [display => "Permanently alter/toggle current view."],

	arg => ["key<arg>" => "Commands with a dot need an argument afterwards."],
},

}
