Sublime Text3 is configured to run the python shortcut key in an interactive environment. sublimepython

Source: Internet
Author: User

Sublime Text3 is configured to run the python shortcut key in an interactive environment. sublimepython
Install plug-ins

It feels good to write code under Sublime Text3, But I encountered some problems when writing Python.
Use Sublime Text3 to open the python file, or write the python code under Sublime Text3. Run the shortcut key ctrl + B. The running result is displayed below the current window. For example

print("hello world!")

However, if an interactive function such as input is used, an error occurs when ctrl + B is run.

print("hello world!")x = input("please input a string :")print(x)

Running result

 

This problem can be solved by installing a plug-in sublimeREPL.
If you have installed the Package ManagerHereIn the "Installation Package Manager" section), press ctrl + shift + p to call out an input box, enter Install Package, press enter, and enter SublimeREPL in the new input box, in the following selection list, press enter to start installation. Generally, the installation can be completed in a few seconds.
Click tools> sublimeREPL> python run current file in the top menu bar on the python file interface. A new window will pop up just like IDLE, it is interactive and can be input

Set shortcuts

But every time you choose tools-> sublimeREPL-> python run current file, it is a headache to think about whether to set a shortcut key to run. Because I used to write python Using IDLE, I plan to run it with F5.

We know that Sublime Text is set through the json file. You can open preferences-> Key Binding-Default to see the setting of the original shortcut Key, which is in json format.

Open preferences-> Key Binding-User, and rewrite the relevant properties of the shortcut Key according to the preceding format to overwrite the default settings.
However, the format is not easy to understand. For more information, seeUnofficial documentation

You can set "command" to "run_macro_file" and "args" to the file name of the recording macro to quickly call this macro. But this attempt failed, probably because

Note that the macro buffer will remember only the latest recorded macro. Also, macros only record commands sent to the buffer: window-level commands, such creating a new file, will be ignored.

Macros cannot create new windows.

After a long time, I found related content on the Internet and found a solution.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.