diff --git a/mitmproxy/tools/console/defaultkeys.py b/mitmproxy/tools/console/defaultkeys.py index 799ffb4ea..182980037 100644 --- a/mitmproxy/tools/console/defaultkeys.py +++ b/mitmproxy/tools/console/defaultkeys.py @@ -1,6 +1,6 @@ def map(km): - km.add(":", "console.command ''", ["global"], "Command prompt") + km.add(":", "console.command ", ["global"], "Command prompt") km.add("?", "console.view.help", ["global"], "View help") km.add("C", "console.view.commands", ["global"], "View commands") km.add("K", "console.view.keybindings", ["global"], "View key bindings") diff --git a/mitmproxy/tools/console/keymap.py b/mitmproxy/tools/console/keymap.py index 19994db7f..06bcca9a7 100644 --- a/mitmproxy/tools/console/keymap.py +++ b/mitmproxy/tools/console/keymap.py @@ -60,9 +60,12 @@ class Keymap: return None def list(self, context: str) -> typing.Sequence[Binding]: - b = [b for b in self.bindings if context in b.contexts or context == "all"] - b.sort(key=lambda x: x.key) - return b + b = [x for x in self.bindings if context in x.contexts or context == "all"] + single = [x for x in b if len(x.key.split()) == 1] + multi = [x for x in b if len(x.key.split()) != 1] + single.sort(key=lambda x: x.key) + multi.sort(key=lambda x: x.key) + return single + multi def handle(self, context: str, key: str) -> typing.Optional[str]: """