1. The question
Recently, when I wrote Python code using sublime Text 2, I found two small problems:
If the code uses the IMG and other functions to interact, the direct use of ctrl+b to compile, the running Information Bar can not enter interactive information, the program will prompt an error.
Under Win 8.1, when compiling with Ctrl+b, the Run Information column does not display the compilation information, a blank (this does not know is the case, set the error or bug, etc.)
2. Installed Plug-ins
Sublimerepl
For the above two issues, I found the SUBLIMEREPL plug-in, which can be used to run and debug programs that require interaction, and work under Win 7 and win 8.1.
The good is that this plugin can support multiple languages, and Python also supports a variety of operating modes, and I'm more commonly used to Python and python-run current file.
Sublimecodeintel
Sublimecodeintel can support the automatic completion of the code, as well as member/method hints, and so on, after installing this plugin, Sublime Text 2 is a little IDE feeling.
Sublimelinter
Sublimelinter is used to do code checking when writing code, to check whether Python code meets PEP8 requirements.
3. Optimize
SUBLIMEREPL Add shortcut keys
Sublimerepl after installation does not have shortcut keys, each run the program must use the mouse to point the toolbar, some uncomfortable, so you need to add shortcut keys to SUBLIMEREPL.
Here you can see the names and IDs of all the Python methods, depending on which user shortcuts can be customized, in preference-key bindings-user input:
The code is as follows |
Copy Code |
[{"Keys": ["F5"], "caption": "Sublimerepl:python-run current File", "Command": "Run_existing_window_command", "args": { "id": "Repl_python_run", "File": "Config/python/main.sublime-menu" }} ] |
This article only defines the shortcut keys for python-run current file, where I use F5, which can be flexibly adjusted to suit my needs.
Code area and compilation area separate display
Select View--Layout--row: 2, split the sublime into the upper and lower parts, select F5 for Code compilation, the compilation information will be displayed in the following compilation area.
The following recommended several essential common plug-ins:
1.Tag Plugin
The tag plug-in can provide Web developers with HTML and CSS tags that are very handy and useful for Web front-end designers.
2.PREFIXR Plugin
Provide some prefixes for CSS3, such as
3.Terminal Plugin
Terminal plug-in can be allowed to open the cmd command window in Sublime Text2, a very useful plug-in, install the plug-in well, open the CMD Command Window shortcut keys are
Ctrl+shift+t.
4.SublimeTmpl Plugin
This plugin allows users to define templates for files, such as when writing an HTML file, always duplicate the header of some of the introduction of information is cumbersome, you can define a template directly generate the necessary information, specific Sublimetmpl plug-in usage please own Baidu.
5.SideBarEnhancements Plugin
An enhanced Sidebar folder browsing function of Plug-ins, relatively good.
6.DocBlockr Plugin
The plug-in used to generate the comment block, after installation, enter "/*" directly, and then press ENTER to generate a code comment block.
7.SublimeCodeIntel Plugin
Smart hint plugin, the smart hints feature of this plugin is very powerful, you can customize the content Library of hints, my Python smart hint settings (profile path is packagessublimecodeintel-master.codeintelconfig) are:
The code is as follows |
Copy Code |
{ "Python": { "Python": ' D:/program files/python26/python.exe ', "Pythonextrapaths": [' D:/program files/python26 ', ' D:/program files/python26/dlls ', ' D:/program Files/Python26/Lib ', ' D:/program files/python26/lib/plat-win ', ' D:/program files/python26/lib/lib-tk ', ' D:/program Files/Python26/Lib/ Site-packages '] } } |
where "Pythonextrapaths" is the content library that needs to be used for smart hints.
8.AndyPython Plugin
A smart hint plugin for the Python language, the keywords and functions that need to be prompted can be set in packagesandypythonpythoncompletions.py.
9.ANDYJS2 Plugin
A plugin for javsscript and jquery smart hints.
10.jquery Plugin
jquery Hints Library.
11.Ctags Plugin
This plugin can be used to quickly navigate to the location of the function definition.
12. In order to avoid opening the file containing Chinese characters garbled, you need to install GBK Encoding support this plug-in, and then install the ConvertToUTF8 plug-in.
If a friend feel that there is no sign up sometimes there is a window is more annoying, here is a way to crack:
Open the file Sublime_text.exe in the sublime Text 2 installation directory with a hexadecimal editor (the UltraEdit I'm using here), which is best backed up before, and if not cracked successfully can be restored, then navigate to the 000cbb70 line and find 8A C3, modify it to B0 01, and then save it,
About Sublime Text 2 for the time being only introduced so much, to some plug-ins interested friends can find relevant information on the GitHub on the line, let us experience sublime text2 convenient place