Sublime Text 3 useful features and common shortcut key collection

Source: Internet
Author: User



Below is I through the online video tutorials or text materials to learn sublime TEXT3 when the collection of some useful functions and common shortcut keys, now share out, if there are other useful features can leave a message below, in order to learn from each other.



Ps:st3 is a big difference between Mac Ox and Windows under different platform shortcuts. The following is a commentary for the Windows platform.


1. You can open the picture directly


Version 3 has a good feature (for the front end): You can open the picture directly in the ST3.


2. Goto anything function-Quick Find (Ctrl + P)
    • The input@+函数名can quickly find the function.
    • #+文本the input can quickly match text within a file.
3. Multi-line cursor function (CTRL + D, very practical)


How do I change one word in a file to another?
Method One : Take advantage of the Find and replace function:ctrl + H
method Two (recommended) : Multi-line cursor function, select one, pressctrl+dcan select another, with another cursor .



However, a multi-row cursor can accomplish work that the find and replace function cannot .
For example, to add a new line after some qualifying statements, and adding some new text, how do you quickly achieve this?


  • You can select one of the modes and thenctrl+Dselect another, and if there are some modes that you do not want to add new rows, pressctrl+K,ctrl+Dskip this to enter the next qualifying pattern line.
  • can also pressalt + F3shortcut keys Select all the words that match the conditions, producing multiple cursors withoutctrl+dis selected.
  • If you want to add a cursor to each line, you can doctrl+Aso firstctrl+shift+L.
  • If you want to add a cursor after multiple lines of a character, you can place the cursor behind the character, hold down the SHIFT key, and then right-drag to create multiple cursors.
4. Command mode (should be used as much as possible without wasting brain cells remembering a large number of commands shortcut keys)


For example, using CTRL + N to create a new file, the default is plain text, no syntax highlighting function, how to set the syntax mode?


  • You can select the syntax mode you want to set by using the grammar selection section in the lower right corner.
  • There is another better way to usectrl + SHIFT + Pto open command mode and enterset syntax [language]is set to a language syntax pattern, such asset syntax Javais set to Java syntax highlighting.
  • ST3 Support fuzzy matching, you can also directly inputsyntax javaorssjava.
  • If you are currently in a language syntax mode, you can switch directly to other languages (without enteringset syntaxorsyntax), for example, Java syntax mode, then the direct input JS can immediately switch to JavaScript syntax mode.


You can also enter tominimaphide or show the minimap miniature on the right


5. Jump to a line quickly


Press toCtrl + Genter a line number to quickly jump to that line.


6. Quickly add new lines
    • Ctrl + EnterYou can create a new row under the current line.
    • Ctrl + Shift + EnterYou can add a row above the current row.
7. Multi-line indentation

When multiple rows are selected, pressCtrl + ]You can increase indentation, pressCtrl + [Indentation can be reduced.
PS: Found withTabAndShift + Tabis also possible.

8. Complete copy to avoid formatting confusion


We found that when you copy a piece of code from another file, it's mostly just the first line indent, the back is messy, you can useCtrl + Shift + Vto paste, you can remain indented during the paste process, and the format is correct.


9. Reopen the closed label


In Chrome, if you accidentally close a tab and want to restore it, you can press toShift + Ctrl + Treopen it.
In ST3, too, if you accidentally close a file, you can pressShift + Ctrl + Tquick resume. Repeat the button consecutively, and St will reopen the tab in the order in which it was closed.


10. Press and holdshift + ctrland then press←Or→You can quickly select a part of a row and continuously press to expand the selection range.


For example, if you need to comment (ctrl+/) or delete a certain part, it is convenient to use this function.


11. Move the row up or down


Position the cursor or select an area, and then pressshift+ctrl+↑↓to move the row up or down.


12.shift + ctrl + dYou can quickly copy the entire line where the cursor is located and before it is copied to the line. 13.Ctrl+Shift+M: The entire contents of the curly braces are not included in the {}. 14.Ctrl+Shift+K: Deletes the entire row. 15. Quickly close the tags in html

Using shortcut keys when writing HTML filesAlt + .You can quickly close a label, such as writingBut this is still very cumbersome, you can use the front-end plug-inEmmet插件, directly in the new HTML file (first set syntax mode for HTML) directly input! (represents the HTML document in HTML5 format) and then press Ctrl+e.

Attached: How to install the package control


through shortcut keysctrl+\ ' orView > Show Console ' menu to open the console, enter the following Python execution code (for python3.x interpreter):


import urllib.request,os; pf=‘Package Control.sublime-package‘; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler( ))); open( os.path.join( ipp, pf), ‘wb‘ ).write( urllib.request.urlopen( ‘http://sublime.wbond.net/‘ +pf.replace( ‘ ‘,‘%20‘ )).read()); print( ‘Please restart Sublime Text to finish installation‘)
Resources
    • Front-end development tool Tips Introduction-sublime
    • 10 Sublime Text plugins required for full stack development
    • Sublime Text Shift+ctrl Magical
    • How to use the Sublimetext style code highlighting style in your blog
    • Sublime Text 2 under the markdown writing


Sublime Text 3 useful features and common shortcut key collection


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.