Objective
Code Editor or text editor, for programmers, like Swords and warriors, who want to have a can be mastered and sharp sword, and every programmer will also go to the most suitable for their own powerful, flexible editor, I believe you and I, no exception.
If the word "artifact" is the highest rating I can give a software, then I would be happy to seal it with such a title. Sublime Text 2 (hereinafter referred to as ST2) small green and very fast, cross-platform support Win/mac/linux, support 32 and 64-bit, support the syntax highlighting of a variety of popular programming languages, code complement the same, but ST2 has a lot of other editors do not have cool features, It's easy to use to reach an unprecedented degree ...
ST2 is not free, but can be used for free forever, but in the time of saving, occasionally pop up to buy the registration dialog box, that's all. Software official website: HTTP://WWW.SUBLIMETEXT.COM/2. Go to download and try it ~
ST2 has been used recently because DW is too bloated, and ST2 writing code is fast and light ~
Advantages
SUBLIMETEXT2 supports but is not limited to C, C + +, C #, CSS, D, Erlang, HTML, Groovy, Haskell, HTML, Java, JavaScript, LaTeX, Lisp, Lua, Markdown, Syntax highlighting for mainstream programming languages such as Matlab, OCaml, Perl, PHP, Python, R, Ruby, SQL, TCL, Textile and XML. ST2 has excellent code auto-completion function (auto brace, curly brace and other matching symbols, automatic completion of the words that have already appeared, auto-complete function name), very smart, and ST2 also has the function of code Snippets (Snippet), you can save the common code snippets, and call them whenever necessary.
Powerful multi-line selection and multi-line editing
Code maps, multiple interface layouts, and full screen intrusion-free mode
Shortcut keys
Powerful shortcut keys to improve your coding efficiency.
Common shortcut keys
- CTRL + N: New file
- Ctrl+w: Close File
- Ctrl+o: Open File
- CTRL + Z: Undo
- Ctrl+y: Undo Restore
- Ctrl+f: Find
- Ctrl+h: Replace
- ESC: Gadget window hidden
Encoding shortcut keys
- Ctrl+shift+p Open the command panel, such as setting the encoding language
- Tab: Indent, auto-complete
- Shift+tab removing indents
- Ctrl+j merge rows (multiple rows that need to be merged are selected)
- Ctrl+t Word Exchange
- Ctrl+u Soft Undo
- Ctrl+k Backspace Delete from cursor to beginning of line
- CTRL+KK Delete from cursor to end of line
- Ctrl+k+t Collapsing properties
- Ctrl+k+u Change to uppercase
- Ctrl+k+l Change to lowercase
- Ctrl+k+0 Expand All
- Ctrl+enter Insert Line (quick line wrapping)
- ctrl+shift+/Comment Selected content
- Ctrl+shift+↑ can move this line of code, with upstream interchange
- Ctrl+shift+↓ can move this line of code, with the downstream interchange
- Ctrl+shift+[Folding Code
- Ctrl+shift+] Unwind code
- ctrl+/Comment Entire line (if selected, same as "ctrl+shift+/" effect)
- Ctrl+shift+a Select the cursor position parent tag pair child
- Ctrl+shift+d the entire line where the cursor is copied, before inserting the line
- Ctrl+shift+k Delete an entire row
- Ctrl+shift+l the mouse to select multiple rows (pressing the shortcut key), you can edit the lines at the same time
- Ctrl+shift+m Select the contents in parentheses (press and hold-continue to select the parent bracket)
- Ctrl+shift+enter Cursor Front Insertion
- Ctrl+pagedown, ctrl+pageup files are switched on and off in the open sequence
- CTRL + left mouse button to select multiple text to edit at the same time
- shift+ the right mouse button (or using the middle mouse button) can use the mouse to select the vertical multi-line
Find shortcut keys
- Ctrl+p: Find the file and quick Search in the current project, quickly find the label location
- Ctrl+p Enter @ To find the main title/function of the file, or enter: Jump to a file line
- Ctrl+g: Jump to the specified line
- Ctrl+f: Find
- Ctrl+d Word Selection (press the shortcut key repeatedly to continue to edit the next same text at the same time)
- Ctrl+l Select Entire row (press and hold-continue to select the downstream)
- Ctrl+m cursor to start or end position within parentheses
- Ctrl+r quickly list/jump to a function
- Ctrl+shift+f in folders, unlike normal editors, Sublime allows you to add multiple folders to find
Other shortcut keys
- Ctrl+k+b Toggle Sidebar on/off
- Ctrl+tab tab Toggle in the current window
- CTRL+F2 setting bookmarks
- Shift+f2 Previous Bookmark
- Alt+shift+1 (non-keypad) window split screen, restore the default 1 screen
- Alt+shift+2 left and right split screen-2 columns
- Alt+shift+3 left and right split screen-3 columns
- Alt+shift+4 left and right split screen-4 columns
- Alt+shift+5 4 Screen
- Alt+shift+8 Vertical Split Screen-2 screen
- Alt+shift+9 Vertical Split Screen-3 screen
- ALT +. Close the current label
- Alt+f3 selected text Press the shortcut key, you can select all the same text at once to edit simultaneously
- Tab Indent Auto-complete
- F2 Next Bookmark
- F6 Detecting syntax errors
- F9 row sort (by A-Z)
- F11 Full Screen mode
Install plug-in preparation steps
- 1. Install a plug-in for a management plugin, required: Package control
1.Press Ctrl + `to bring up the console
2. Paste the following code on the bottom line of code and press Enter:
import urllib2, os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path (); os.makedirs (ipp) if not os.path.exists (ipp) else None; open (os.path.join (ipp, pf), 'wb') .write (urllib2.urlopen ('http://sublime.wbond.net/'+pf.replace (' ','% 20 ')). read ())
3. Restart sublime text. If you see package control in References-> package settings, the installation is successful.
- 2. Click Preferences→package Control to display the following pop-up windows:
Disable Package: Disable the plugin
enable Package: enable plugin
Install Package: Install the plugin
List Package: View a list of installed plugins
Remove Package: Remove plugin
Upgrade Package: upgrade plugin
Preferences→package Control→install Package, enter the name of the plug-in, you will see the bottom of the editor in the loading download installation, after installation, general restart.
Plugin and function recommended coding shortcut key, front-end prerequisite-emmet
Emmet as an upgraded version of Zen coding, for the front end, but a must-have plugin, if you are not familiar with it, you can see the specific video tutorial on its official website (http://docs.emmet.io/). Or you can see http://docs.emmet.io/cheat-sheet/here.
Example: Ul#nav>li.item$*4>a{item $} and then the TAB key
Display the result is
<ul id="nav">
<li class="item1"><a href="">Item 1</a></li>
<li class="item2"><a href="">Item 2</a></li>
<li class="item3"><a href="">Item 3</a></li>
<li class="item4"><a href="">Item 4</a></li>
</ul> |
|
Is it fast enough? For more examples, see http://docs.emmet.io/abbreviations/syntax/
Shortcut output DTD header file, i.e. HTML header information
In the case of Emmet plug-in, if the input HTML, the display is only a simple HTML structure, does not include the DTD header file, which is very depressing. But the following solution is very good, support a variety of header files, HTML5 's writing also support Oh ~
After the Emmet plugin is installed, you can use one of the 6 DTD settings in html:4t, html:4s, Html:xt, Html:xs, Html:xxs, Html:5, and then tab to quickly generate the header file. With regard to header files, it was often used in the format of HTML:XT, which is the auto-generated header file of Dreamweaver. But now the standard is Html:5 's header file, the basic browser is supported, no problem.
Let sublime Text2 support shortcut keys in Browser preview
The students who have used Dreamweaver know that F12 can quickly browse the files being edited in the browser. And this function is needed in sublime, right click, then open in browser. This is obviously not convenient enough. Here's how to solve it ~
Sublime TEXT2 supports writing plug-ins in Python, with detailed steps:
First, click menu Tools, New Plugin ..., enter the following in the created PY file:
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import sublime, sublime_plugin
import webbrowser
url_map = {
'/Users/jerry/Sites/test/' : 'http://test/',
}
class OpenBrowserCommand(sublime_plugin.TextCommand):
def run(self,edit):
window = sublime.active_window()
window.run_command('save')
url = self.view.file_name()
for path, domain in url_map.items():
if url.startswith(path):
url = url.replace(path, domain).replace('\\', '\/')
break
webbrowser.open_new(url)
Save the file to the Packages/user directory (Packages can go through the menu browser Packages ... Open), the file name is arbitrary, such as open_browser.py. The plugin was partially completed.
Next, assign the shortcut key for the plugin just now. Click menu Tools, Command Palette ..., or F12, open the command set, select "Key Bindings–user" to open the Personal accelerator configuration and enter the following:
|
[{ "keys": ["F12"], "command": "Open_browser" }] |
That's all the work you have to do, and you can test it out. Open an HTML file, F12 try it, and the file will open in the default browser, no surprises. The site Directory-to-URL mappings configured in Url_map should also be available.
PS: If you want to specify what browser to preview, you can also change the last line of code to this:
|
WebBrowser. Get(' Safari '). Open_new(url) |
WebBrowser specifically supports get which browsers, can be viewed through webbrowser._browsers. Only, ST2 default is python2.6, under my Mac OS, python2.6 can't find any available browsers. A patch is available in the 2.7 webbrowser.py to find Firefox and Safari. Fortunately, it's enough for me to preview the default browser.
JS Format-javascript Code Formatting Plugin
Many of the site's JS code is compressed, one-line or even confusing compression, which makes us look very laborious. And this plugin can help us to format the original code, including line wrapping and indentation, and so on, is the code at a glance, faster read ~
Less-less Highlight Plugin
With less, the students know that sublime does not support the syntax highlighting, so this plugin can help us
Postscript
However, because the editor is too fast, that is, too lazy, it is not recommended for beginners to use ~–– and more features, waiting for you to find
New Plugin Introduction article: http://www.xuanfengge.com/practical-collection-of-sublime-plug-in.html
Sublime Text 2 front-end encoding artifact-shortcut keys and tips for use