Creating a keyboard shortcut to explain the text selection? ( and/or any other prompts )

When writing a new language using cursor i find myself selecting pieces of code, pressing CMD+L and then asking “explain this”.

I’m wondering if there is a way of making a shortcut where:

  1. inserts selection into the chat
  2. adds a custom string, in this case “please explain the pasted code”
  3. submits the question

Here is my imaginary shortcut config:

[
    {
        "key": "cmd+shift+e",
        "command": "runCommands",
        "args": {
            "commands": [
                "aichat.insertselectionintochat",
                "aichat.append 'Please explain this'",
                "aichat.submit"
            ]
        },
        "when": "editorHasSelection"
    }
]