Although the online tutorial a lot of, however, are not comprehensive, encountered the situation of the various pits are not written.
First, installation
If you installed the package Control, see Mac Sublime Text 3 Configuring the Python environment and installing the plugin
Preferences->package Control->package control:install package, input SUBLIMEREPL, enter the installation is OK.
Ii. use of 1. Interactive window
Sublime running Python is not able to receive external input values, you need to open an interactive window with the Sublimerepl plugin.
How to use: Tools->sublimerepl->python->python-run current file
There are pits here:
For example, you add sys.stdout = io at the beginning of the code in order for the code to support Chinese encoding. Textiowrapper (sys.stdout.buffer,encoding= ' UTF8 ') #改变标准输出的默认编码
Running the interactive window will cause an error. or some other error. The workaround is to set the version of SUBLIMEREPL using the Python command. The steps are as follows:
Preferences->browse Packages Find the installation package location open FileSublimeREPL/config/Python/Main.sublime-menu。找到如下代码:
{"Command":"Repl_open", "caption":"python-run Current File", "ID":"Repl_python_run", "Mnemonic":"R", "args": { "type":"subprocess", "encoding":"UTF8", "cmd": ["/library/frameworks/python.framework/versions/3.6/bin/python3","- u","$file _basename"], "CWD":"$file _path", "Syntax":"Packages/python/python.tmlanguage", "external_id":"python", "extend_env": {"pythonioencoding":"Utf-8"} } },
Change the Python path in the cmd line to your new Python path
2. Progressive Run function
A.tools-Sublimerepl python, python, open a SUBLIMEREPL debug page, don't shut it down.
B. Go back to the code page and select one or more lines of statements to execute, SUBLIMEREPL, Eval REPL, Tools----Lines, back to the interactive page of Sublimerepl, which has been executed, You can print the variables you want to see.
Precautions:
For example, I can't directly select line 13th to execute because I don't know A and b at this time. You can do 11th, 12, 13, in the order of one row, or the three rows are checked for execution.
Third, set shortcut keys
To use the above features is too cumbersome, you can set shortcut keys.
For example, set the Run Interactive window shortcut key "ctrl+b", open a SUBLIMEREPL page shortcut "Ctrl + a ", execute a row shortcut key "control +z"
Preferences Key Bindings After you enter the following in the brackets in the default (Windows). sublime-keymap-user File:
[ { "Keys":["ctrl+b"], "caption":"sublimerepl:python-run Current File", "Command":"Run_existing_window_command", "args": { "ID":"Repl_python_run", "file":"Config/python/main.sublime-menu" } }, { "Keys": ["Ctrl + A"],"caption":"Sublimerepl:python","Command":"Run_existing_window_command","args": {"ID":"Repl_python","file":"Config/python/main.sublime-menu" } }, { "Keys": ["Ctrl + Z"],"Command":"repl_transfer_current","args": {"Scope":"selection" } }]
Iv. Other Skills
Code window and plug-in window need to switch back and forth to view, very inconvenient, can be set to display these several windows, click View---Layout--Rows:2
Then take off the tab of the plugin, such as
MAC SUBLIMEREPL plug-in installation use and solve various pits