Code Editor sublimetext

Source: Internet
Author: User

Editor sublimetext2

Code Writing and Visual Development

Although visual development is easy to use the entire component, it is restricted by development tools and Component Libraries, and it is also troublesome to modify many attributes of the component. In particular, there is a lack of free visual IDE.
Code development is more flexible and suitable for all scenarios. In addition, it is convenient to write common code as a template. Code development uses a code editor that supports multiple languages.

Code Editor or text editor. For programmers, like swords and warriors, everyone wants to have a sword that can be controlled at will and is very sharp, we will also pursue a powerful and flexible editor that best suits you. I believe you and me are the same and will not be an exception.

I have used many editors ~ However, I don't have any special options, until I met sublime text 2! If the "artifact" is the one that I can give the highest comments to a software, I am happy to block such a title for it. It is small, green, and fast. It supports windows, Mac, and Linux platforms, 32-bit and 64-bit, syntax highlighting, and Code Completion in various popular programming languages, however, it has many cool features not available in other editors, so that its ease of use has reached an unprecedented level ......

About sublime text 2:

Someone once said that there are two kinds of editors in the world, which are easy to use and difficult to use. There are two kinds of editors that are free and expensive. For example, using vim and textmate is a typical example of free and expensive. Unfortunately, sublime text 2, the main character of today, is also an expensive and expensive representative. It is a paid commercial software, with a personal license fee of up to 59 USD (via Paypal ).
However, you don't have to worry about it. Although it is very expensive, the author provides users with unlimited and unlimited trial permissions for free. It will only occasionally remind you that you have made a purchase, the frequency is also very low. That's all. It has almost no impact if you keep using it for free. It is also worth mentioning that users can purchase an authorization and use it on different platforms at the same time, for users like me who often need to switch between MAC and win, it can save a lot of money.
Because the sublime text 2 editor has too many features and skills to use, and I am not very familiar with it, I cannot list and present them one by one. I can only choose a few features that I think are quite distinctive to introduce, in addition, there is no space to introduce various editing techniques, shortcut keys, and so on. If you are willing to spend a bit of time, you will find that its capabilities are far beyond the points described in this article, so this article can only be a reference, I hope you can share some good skills.

Supported platforms
Win/MAC/Linux, supports 32-bit and 64-bit

Installation and plug-ins

Download the installation package at http://www.sublimetext.com/
Package control (do not miss the extension Package Manager)
In addition to its numerous practical functions and features, sublime text 2 can also be installed with various extensions, skins, and color schemes to enhance itself. The package control introduced now can be regarded as an Extension Manager of st2, you can download, install, and delete various plug-ins and skins of sublime text 2 in amazing, simple, and convenient ways. Believe me, to better use st2, you absolutely cannot leave it alone! However, st2 does not own this tool. We need to install it on our own. The method is simple:
1. Find the data> installed packages folder in the sublimetext2 directory (if not, manually create a folder)
2. Download the package control. sublime-package file here.
3. Put the downloaded file in installed packages.
4. Restart sublime text.

If the package control has been installed successfully, you can run the relevant commands in the preference-package control menu. We often use install package and list packages to list all extensions), remove package (remove extension), upgrade package (upgrade extension ).
On the Command Panel, enter "package control: Install package" to list all the extensions that can be installed (required to connect to the network, for example). You can see from the list that, 4gl and aaapackagedev are plug-ins. You can select them to download and install them. From this list, we can see that the various extensions of st2 are already very rich!
Of course, different extensions are used in different ways and in different forms. In this case, you can only go to the web version to check some specific instructions on the use of this plug-in. This cannot be generalized here. But in general, installing and using plug-ins is so simple. With various plug-ins, You can implement almost any function you want. The plug-in API is also available for st2. If you have the ability, you can try to develop a plug-in API. Refer to the API documentation here. Some useful plug-ins will be recommended later in this article.
Here are some plug-ins that I think are good. You are welcome to recommend and supplement them:
Gits: GitHub can be easily integrated
SFTP: directly edit files on the FTP or SFTP Server
Zencoding: This product is incredibly difficult for front-end students to write HTML files (video demonstration) in ultra-fast mode)
Converttoutf8: st2 only supports utf8 encoding, which can display and edit files encoded such as GBK, big5, EUC-KR, EUC-JP, shift_jis, etc.
Clipboard history: clipboard history
WordPress: integrates some WordPress functions. This is especially useful for people like me who often need to write WP templates and plug-ins!
Htmltidy: clear and typeset your HTML code
Alignment: Statement alignment plug-in
Yui Compressor: compresses JS and CSS files

#=== Supported languages
Almost all advanced languages: C, C ++, C #, CSS, D, Erlang, HTML, groovy, Haskell, HTML, Java, JavaScript, latex, lisp, Lua, markdown, syntax highlighting and Automatic completion of mainstream programming languages such as MATLAB, ocaml, Perl, PHP, Python, R, Ruby, SQL, TCL, textile and XML.
If the opened Code cannot be automatically recognized, use menu view-Syntex.
Chinese support: You can display Chinese characters by installing the utf8 or GBK plug-in. However, currently, you cannot directly enter Chinese characters in the Chinese input method, but you can only paste them. In addition, many friends reflect that there will be garbled characters to open Chinese, in fact, because st2 itself only supports UTF-8 encoding, and we often encounter Chinese files may be GBK or gb2312 encoding, the solution is to install a converttoutf8 or GBK encoding support plug-in, which is not a big problem.

Coffeescript support
Sublime text2: Use package control to install the coffeescript plug-in.
First install package control:
Then install the coffeescript editing plug-in: coffeescript and coffeecompile (used to browse pre-compiled JavaScript files ).
You can set the common work folder as a project to open it in a tree.
Use the $ coffee -- watch -- compile-output CS cs1.coffee command in the command line to compile cs1.coffee into a JS file with the same name and save it to the CS folder. Once cs1.coffee is saved, cs1.js will automatically recompile and save it. Form an association ".
In the work folder, choose View> layout> columns: 2, which is divided into two screens: left and right. The coffee file is opened on the left screen, and the JS file associated with the right screen can be viewed in real time.
The coffee-I command enters the interaction environment. Control + V enters multi-line mode, and Control + V then runs the code.

Basic usage method: Basic screen Layout

Tree sidebar on the left: You can use project-add folder to project to set a work folder as a project, and view-Sidebar-show sidebar to bring up the tree Sidebar of the folder.
By default, it is saved in this folder.
Shortcut view: by default, a file is opened, a tag is opened, and its shortcut view (minimap) is displayed on the right side, which allows you to quickly locate the code.
Screen segmentation: menu view-layout can split the Left and Right screens or up and down into multiple screens. Click the cursor in the area and open the file to display the file content in the area.

File Search

Open the Command Panel (CTRL + Shift + p) and enter the "Search" command to bring up the file search function. You can enter a keyword to query all files in the system.
Lightning-like Fast File switching:
If you open multiple files at the same time, or you often need to edit different files in your project, when there are a large number of files, you often need to spend a lot of energy searching in the past, very annoying. Now, in sublime text 2, you only need to press Ctrl + P (Win/Linux) or SHIFT + command + P (MAC) to bring up the file switching panel. Then you only need to enter the file name, after you press enter, you can instantly switch over! And fuzzy match is supported. You only need to enter a part you remember. For example, if you want to find "www.iplaysoft.com. PHP file, you only need to enter "IPL" or "IPs. C "can be matched. This feature is very good!

Internal jump

Jump as you like: quickly list and locate function/HTML elements, jump to a specified row
Using the Fast File switching function described above, you can easily open/switch to the document you want to edit, but if the code of this file is very long, what are the best methods to easily jump to the location you want to edit? Sublime text 2 has been ready for you for a long time. Similarly, press Ctrl + P (WIN) or SHIFT + command + P (MAC) As mentioned earlier. This time, try to enter a @ number first? Well, that's good! This list will help you to list all functions in this file now! Similarly, fuzzy match is used to quickly enter several keywords and locate the function !!! This function is especially useful when you need to continuously jump between multiple functions ~ Mom no longer needs to worry about finding a function! When you edit HTML, the items listed here are the ID elements of HTML. I believe the front-end students are excited. Enter @ to start with this magical effect, then try entering an English colon
: Start, and enter another number. Well, this time you can jump to the specified number of rows. Enter a # number to start listing/searching text; you can also use Quick shortcuts. For example, the quick list/jump function is Ctrl + R (command + R in MAC), which is equivalent to entering @ After Ctrl + P @; the jump to the specified row number is Ctrl + g (the Mac is command + G ).
You can also use the Goto menu.

Multi-line editing

Powerful multi-line selection and multi-line editing:
During code writing, we often need to edit multiple lines of code or variables at the same time. Sublime text 2 has a very practical multi-line operation technique, which can greatly improve the editing speed! I believe that in the future, you may ask yourself, "How did I live when there was no such editor ?!"
Below are some of the multi-line editing methods I know:
Select multiple rows with the mouse, and press Ctrl + Shift + L (command + Shift + l) to edit these rows at the same time;
Press Ctrl + d (command + d) to select the next text and edit it at the same time;
Select the text with the mouse, and press Alt + F3 (WIN) or Ctrl + command + g (MAC) to select all the same text for editing at the same time;
Shift + right-click (WIN) or option + left mouse (MAC) or middle mouse buttons can be used to select vertical lines;
CTRL + left mouse (WIN) or command + left mouse (MAC) You can manually select multiple texts to be edited at the same time
There are still many similar skills. Please add ......

Uniform indent

In the menu view-indent, you can set the number of indentions of the tab key. After multiple lines are selected, you can press the tab key to indent them.

Change the subject or color scheme:

If you are tired of reading the original version of sublimetext, you can also change the skin. For example, theme-soda is a popular theme. It is basically the same as installing the plug-in. Use package control to go To the install package list and find it for installation. You can also find some st2 topics on the internet, download them and put them in the data \ packages folder of the installation directory, and then select to switch the topic. The operation of the color scheme is similar. Let's study it by yourself. We will not introduce it here.

User-Defined

Fully open user-defined configuration and magic and practical editing status recovery:
All the configurations of sublime text 2 are controlled by the configuration file, which can be completely customized by users. If you are willing to work hard, you can even change it to a completely different operating experience from the original version. As shown in the figure below, the setting-default menu will open the default software configuration file (this file will record many configuration information such as the font used ), key bindings-default is the default shortcut key configuration file. You can open them to see how some of the original settings are configured, but it is not recommended to modify them directly here! You can change it in the file ending with "-user" (that is, the meaning of user-defined configuration) by drawing a gourd. If there is the same project on both sides, it will
-The definitions in the user file shall prevail.

Shortcut Key

CTRL + Shift + P Call Command Panel
For example, "set Syntax: PhP" can be used to highlight the current file into a PHP syntax; "Convert case: swap case" can be used to reverse the case of the selected text; "file: save all "can save all files at a time;" file: Close all "can close all files at a time ...... In addition, the list here supports Fuzzy Matching (this product is really a good thing !). Because there are too many commands and a wide range of functions, I cannot introduce them one by one here. If you are interested, you can call a panel to see what commands are in the list, learn more, try more, and digest it slowly. I believe it will make you unable to do without it any more.

CTRL + Shift + B run
The running result is displayed below. Currently, CS is supported, but JS is not supported. You can only use node commands on the console.

CTRL ++ zoom in the font size
CTRL -- reduce font size

Click the inverted triangle on the right of the row number to collect the function, and then click to expand it.

CTRL + l select the entire line (Press and hold-continue to select downstream)
CTRL + KK Delete from cursor to end of line
CTRL + Shift + k Delete the entire row
CTRL + Shift + D copy the entire row where the cursor is located and insert it before this row
CTRL + J merge rows (multiple rows to be merged have been selected)
CTRL + Ku to uppercase
CTRL + KL to lowercase
CTRL + d (Press and hold-continue to select the next same string)
CTRL + M move the cursor to the start or end position in parentheses
CTRL + Shift + M select the content in the brackets (Press and hold-continue to select the parent bracket)
CTRL +/comment out the entire line (if the selected content is used, the effect is the same as that of "Ctrl + Shift +)
CTRL + Shift +/comment on selected content
CTRL + z undo
CTRL + y resume undo
CTRL + M jump to the corresponding parentheses
Alt +. Close the current tag
CTRL + Shift + A select the cursor position parent tag
CTRL + Shift + [collapse code
CTRL + Shift +] Show Code
CTRL + KT fold Property
CTRL + K0 show all
CTRL + u soft undo
CTRL + T word Interchange
Tab indent automatically completed
Shift + TAB remove indentation
CTRL + Shift + swap and uplink swap
CTRL + Shift + swap and downstream
CTRL + k backspace Delete from cursor to first line
CTRL + enter insert row after cursor
CTRL + Shift + enter insert row before cursor
CTRL + F2 set bookmarks
Next bookmarks on F2
Shift + F2 bookmarks

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.