EDITORIAL words: usually do a project with eclipse and vs, but for some small projects, I feel no need to do so much a tool, such as writing a small micro-mall, put forward a small script what it has been in with Sublime Text, fresh and simple interface, so no extra user OCD crazy point, so today I will briefly summarize the most used in the process of using a number of tips to others.
Start of text
1.Sublime Text2 or Sublime Text 3?
Although both almost used up, but still with the latest version of it, although it is in beta, but after all, also have some updates, such as some small changes in the UI interface, package files are installed is mounted directly on the sublime text3 folder inside, but not installed in another directory C drive, but also a green version, some configuration can be convenient backup retention.
2.Sublime Text3 green version, and how to add to the context menu, you can quickly use Sublime Text3 open?
(1) cmd command run: regedit, open the registry.
(2) in turn found HKEY_CLASSESS_ROOT -> * -> Shell, the following new item named Edit with Sublime Text3.
(3) In the new string value under the "Edit with Sublime Text", named Icon, is "C: \ Program Files \ Sublime Text Build 3065 \ sublime_text.exe, 0", the address of which is black Sublime Text file address.
(4) Under the new item "Edit with Sublime Text" item Command, under the Command key to modify the default value is "C: \ Program Files \ Sublime Text Build 3065 \ sublime_text.exe, 1".
(5) setting, without having to restart the computer, you can right-click menu to display the Edit with Sublime Text3.
3.Sublime Text3 basic interface parameters set?
Sublime Text3 default interface settings profile Preferences ----> Settings-Default.
We can increase in Settings-User profile value to override the settings in the Setting-Default, formatting, values can be found in Setting-Default profile settings, such as the following I set the font size, line and highlight side sidebar folder icon bold. After setting after Ctrl + S to save, without rebooting Sublime Text3 to take effect immediately.
4.Sublime Text3 commonly used shortcuts?
There are many shortcuts and the operating system is the same, there are many other interesting shortcut keys, the default shortcut key settings in the Preferences ---> Key Bindings-Default, and which can be found in all of the shortcuts, you can also Key Bindings-User, and re-set the new value to override the default settings. The figure is two shortcuts my custom settings.
Here I put some common keyboard shortcuts are summarized below:
(1) formatting code: alt + shift + f their own settings, select the code Press shortcut keys can be formatted code.
(2) Folding Code: ctrl + shift + [own settings, the method can be folded inside the code, when a class file method is relatively long, it can be used.
(3) Open the window just closed: ctrl + shift + T default settings.
(4) Full Screen: F11 default settings.
(5) Do Not Disturb full screen: Shift + F11 default settings, larger than the F11 display.
(6) to select the same word many: Ctrl + D, Ctrl + U fallback select the default settings, useful, you can try.
(7) cancellation of window display: ESC default settings, such as when we Ctrl + F search, the search box at the bottom will be, unable to find the above Close ×, therefore press ESC, it can be easily closed.
(8) Add a new line in the code above: Ctrl + shift + Enter default settings
(9) by moving words: Ctrl + left and right keys to the default settings, direct left-right is a letter of the alphabet movement.
(10) show classes and methods outline: Ctrl + R default settings, you can easily know which class has a method.
(11) Display n window: alt + shift + 1, or 2, 3, ... n display window, for example, to write css, they can open a window html, css open a window
5.Sublime Text3 some interesting plug-ins?
Sublime Text3 have a lot of interesting plug-ins, we can easily code, but the use of plug-ins should not be flooding, otherwise, it might as well use IDE. To facilitate the installation and management plug-in, plug-ins should be installed first, in fact, it is the package management plug-in, Package Control, so that later to install the plug more convenient.
(1) Package Control plug-in installed:
1) Select the Sublime Text3 menu bar View ---> Show Console, Console box appears at the bottom.
2) Enter the code below Console box, press Enter, wait for the installation to succeed.
import urllib.request, os, hashlib; h = 'eb2297e1a458f27d836c04bb0cbaf282' + 'd0e7a3098092775ccb37ca9d6b2e4b7d'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path (); urllib.request.install_opener (urllib.request.build_opener ( urllib.request.ProxyHandler ())); by = urllib.request.urlopen ( 'http://packagecontrol.io/' + pf.replace ( '', '% 20')) read ();. dh = hashlib .sha256 (by) .hexdigest ();! print ( 'Error validating download (got% s instead of% s), please try manual install'% (dh, h)) if dh = h else open (os.path. join (ipp, pf), 'wb') .write (by)
3) After successful installation, after the installation of another package, press the shortcut keys Ctrl + Shift + P, enter the install, you can install the package; Enter remove to remove installed packages.
(2) folded state retention plug: BufferScroll
After we set up shortcuts front folding code, but each restart Sublime Text3 or reopen the page, folded state will disappear after installation this plug-in, code folding state can be retained. Installation is as follows: Press Ctrl + Shift + P -> Enter the install, select Install Package -> input BufferScroll, can be installed.
6.Sublime Text3 configuration X-debug breakpoint debugging PHP code?
Sublime Text3 write js, css and html very good use, write php is also very comfortable, although debugging PHP with other software is better, but the feeling with customary Sublime Text3, and therefore also to find ways for it to set up complete debugging features for debugging generally small projects enough. Setting steps are as follows:
(1) x-debug configuration plug-in for PHP
1) Create a new php file, write a method phpinfo (), runs in the browser, right view the source code, html code is copied into the clipboard.
2) Open the URL: http: //xdebug.org/wizard.php, the front copy and paste the html source code to the site text box, click Analyse my phpinfo () output.
3) according to the results of the analysis instructions to install the appropriate x-debug plug until the installation is successful.
4) modify the php.ini file, add the code below:
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 9000
xdebug.remote_log = "C: \ Program Files \ PHP \ xdebuglog \ xdebug.log"
Wherein xdebug.remote_log configuration xdebug log file location can be set to the address you want.
5) Restart Apache or other with the Web Server.
So far, the php configuration x-debug plug-in success.
(2) Configuration Sublime Text3 x-debug plug
1) Press Ctrl + Shift + P -> Enter the install, select Install Package -> Install Xdebug client.
2) Select the Sublime Text3 menu bar: Tools ---> Xdebug ---> Settings ---> User Customizations debugging information, wherein Settings ---> Default Xdebug is the default configuration file. (Sublime Text3 with similar software, plug-in also has its own default configuration file for the user to customize settings and configuration files)
3) Settings-User Configuration increase configuration information is as follows:
Wherein launch_browser set to true, debugging, will open the browser; close_on_stop set to true, then at the end of debugging, you can turn off unnecessary display of the debug window; url set the debug entry address, when you press the button debugging, directly He jumped into the entry address.
At this point, you can use x-debug debugging, but if you feel that the use Xdebug default shortcut key is not convenient, you can set the shortcut keys you want. Setting method, see below.
4) custom debugging shortcuts
Since Xdebug not have their own shortcuts custom profile, so we set the Sublime Text3 software shortcuts configuration file. Open the menu bar Preferences ---> Key Bindings-User, add the following code:
Xdebug which shortcut is the default, modify it to your liking shortcuts on the line, for example, consistent with vs or eclipse.
So far, Sublime Text3 basic settings like, set almost went reassuring to write the code.