Use a macro that runs when saving python with vscode

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"
}

Postscript

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

Use a macro that runs when saving python with vscode
[python] A note when trying to use numpy with Cython
I want to use a wildcard that I want to shell with Python remove
[Python] A program that creates stairs with #
[Python] Create a LineBot that runs regularly
A typed world that begins with Python
Error when installing a module with Python pip
Create a page that loads infinitely with python
A memo when creating a python environment with miniconda
[python] [vscode] When you get angry with space-tab-mixed
[Web development with Python] Precautions when saving cookies
When writing tests with python unittests, use doCleanups for setUps that can fail
A story that I was addicted to when I made SFTP communication with python
[Python] Use JSON with Python
Use mecab with Python3
Use DynamoDB with Python
Use Python 3.8 with Anaconda
Use python with docker
String manipulation with python & pandas that I often use
I made a VM that runs OpenCV for Python
Use Cursur that closes automatically with sqlite3 in Python
Problems when creating a csv-json conversion tool with python
What's in that variable (when running a Python script)
A server that echoes data POSTed with flask / python
Troublesome story when using Python3 with VScode on ubuntu
Use communicate () when receiving output in a Python subprocess
A memo that I touched the Datastore with python
[Python] I want to use only index when looping a list with a for statement
A template that I often use when making Discord BOT in Python (memorial note)
Create a discord bot that notifies unilaterally with python (use only requests and json)
A memo that uses an interactive display mode like Jupyter notebook with VSCode + Python
A story that stumbled when I made a chatbot with Transformer
Solution when you want to use cv_bridge with python3 (virtualenv)
A memo that reads data from dashDB with Python & Spark
Use Twitter API with Python
[Python] Use a string sequence
Use TUN / TAP with Python
Let's create a script that registers with Ideone.com in Python.
A memo when face is detected with Python + OpenCV quickly
Summary of points to keep in mind when writing a program that runs on Python 2.5
A story that went missing when I specified a path starting with a tilde (~) in python open
Make a fortune with Python
Error when playing with python
Create a simple Python development environment with VSCode & Docker Desktop
A program that failed when trying to create a linebot with reference to "Dialogue system made with python"
Use subsonic API with python3
Precautions that must be understood when building a PYTHON environment
Create a directory with python
When using property, use a class that inherits object (new-style class)
When I tried to use pip with python, I was told that XML_SetHashSalt could not be found.
Here's a summary of things that might be useful when dealing with complex numbers in Python
A story that didn't work when I tried to log in with the Python requests module
[Python, Selenium, PhantomJS] A story when scraping a website with lazy load
Create a Python execution environment for Windows with VScode + Remote WSL
[Python] Make a graph that can be moved around with Plotly
I made a package that can compare morphological analyzers with Python
A note on what you did to use Flycheck with Python
Easy! Implement a Twitter bot that runs on Heroku in Python
Make a cat detector with Google Colabratory (Part 2) [Python] ~ Use OpenCV ~
[Python] A memo that I tried to get started with asyncio
I made a shuffle that can be reset (reverted) with Python