def edit_and_execute(event):
    """
    Invoke an editor on the current command line, and accept the result.
    """
    buff = event.current_buffer

    buff.open_in_editor(event.cli)
    buff.accept_action.validate_and_handle(event.cli, buff)
Invoke an editor on the current command line, and accept the result.