Install the appropriate macro extension https://marketplace.visualstudio.com/items?itemName=geddski.macros
Set macros in settings.json
"macros":{
"redirectTextFileAndRunPython":[
"workbench.action.files.save",
{
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "python app.py < input.txt\n" }
},
],
},
Describe the macro name in keybindings.json
{
"key":"ctrl+q",
"command":"macros.redirectTextFileAndRunPython"
}
I was able to keybind without adding extensions! It's embarrassing!
only this!
{
"key":"ctrl+q",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "python app.py < input.txt\n"}
}
Recommended Posts