Sublime Text 3 Development php

Source: Internet
Author: User
Tags sublime text zend
from the first article of the Open-box hydrology, has been 4 months, but because of laziness, there is no following. Finally, today, I feel like writing a quasi-technical article.

Forget how to start with the St, should be on the Internet to see others recommended to use it, with a half year. Under Windows is the absolute artifact, notepad++ such as incomparable, Linux, because there is a vim, I do not understand vim, so what better, not to say. Summed up is that the artifact of the general lightweight for PHP, Python and other developers of the text editor , quite gray often good, recommended to you.

I mainly use it to write PHP, it is quite useful. It may also be useful in writing Python , and writing Ruby does not know what the situation is and whether it is used to write it. In short, ST is more suitable for writing some scripting languages, such as C#,java and so on or with the traditional classic IDE bar.

First, install sublime Text 3

Official website HTTP://WWW.SUBLIMETEXT.COM/3

Be sure to choose ST3, not st2,3 than 2 good, really, behind you will know.

Select the appropriate version to install. When you're done, install a basic, Essential package management: The packages control, used to install plugins later.

Package Control Installation

Installation Guide https://sublime.wbond.net/installation

Open ST3, click on the menu View, show Console, will appear at the bottom of a command input box, and then copy the above command into the input box, enter, wait, the installation is successful.

Second, plug-in installation

After installing the package control above, we can install the plugin by opening the package control via the shortcut key ctrl+shift+p. Enter install in the input box that opens, and automatically prompts you to select the install package based on your input.

Wait, and then an input box pops up, allowing you to enter the plugin you want to install.

We want to install a plugin that supports UTF8 encoding, just enter convert in the input box, automatically match, select ConvertToUTF8 plug-in, enter, wait, install complete, so that St support UTF-8 encoded.

I thought the plug-in must be installed

(mainly for PHP development, other languages are most common, please choose the reader)

1,ConvertToUTF8 support UTF-8 encoded plug-in

2.Bracket highlighter is used to match parentheses, quotes, and HTML tags. Useful for very long code. After installation, you do not need to set the plugin to take effect automatically.

3.Docblockr Docblockr can automatically generate Phpdoc-style annotations. It supports languages such as JavaScript, PHP, ActionScript, Coffeescript, Java, Objective C, C, C + +

4,Emmet (Zen Coding) fast generation of HTML code Snippets plug-in, powerful to unparalleled, do not know, Google

5,SideBar enhancements This plugin improved the sidebar, adding a lot of features

6,themr theme Management, switch themes, do not have to modify the configuration file, with this can easily switch themes

Please refer to http://www.ladyloveit.com/sublime/developers-commonly-used-10-sublime-text-plugin

III. General shortcut keys

Understand and master the shortcut key, in order to let you have legs bright, so, below we understand what easy to use the shortcut key operation, here only to talk about my usual development, the complete shortcut key operation please google.

1,ctrl+shift+p

Open the package Control, as described above. Here is a technique that can be used in various places below, that is, St supports fuzzy matching. For example, you want to find the install package, you install in the input box of the package Control, you can automatically match the install package, you can simply enter the IP, you can also match to it, this fuzzy matching function is very convenient.

2,ctrl+p

Open the file based on the file name. For example, you want to open login/func/funtion. php, you just enter login/func/funtion.php in the input box, you can also use fuzzy matching, such as login/function, fuzzy matching or to experience it yourself.

3, found we want to view the source file, want to find a function method how to do?

Ctrl+r

Enter log, you can find all the names with log method, enter Loginout, you can locate to Loginout ().

You may notice that after ctrl+r, the input box will automatically have an @, that is, to match the meaning of the method. Well, in addition, there are some useful matching symbols, said the same.

After locating the line , Ctrl+g, or ctrl+p, enter in the box: number of lines, such as: 58, to jump to 58 rows.

After you find the identity , Ctrl+p, #标识.

4, learned the above quick operation, basically can play to turn St, can use St to write PHP is not a problem, in each file cut to cut, fast jump to method, are very cool. But want to use more cool, more smooth, such as silk-like bright, also see below

many simultaneous edits, Ctrl+d, this feature I used, very good.

When you want to modify multiple identical code at the same time, for example,

$user [' name '] = ' bananaplan ';

$user [' age '] = 28;

$user [' desc '] = ' brother to be 28 years old forever ';

In the user unified change to member, you can double-click to select User, and then Ctrl+d, will be down to the user, repeat, until you satisfied with the location, and then you can unified editing.

---->

Someone said, cut, this is nothing, can be used to find a replacement ah, yes, find the replacement is achievable, but I feet this way more intuitive, and not easy to make mistakes. As the so-called, heroes see, each has a different, please crossing self-pour.

In fact, in addition to using Ctrl+d shortcut keys, but also the way to achieve the use of mouse hunting. Hold down CTRL, and then double-click to select Multiple.

In fact, in addition, the above 2 in the way to achieve synchronous editing, there is a way. That is, hold down SHIFT, and then hold down the right mouse button, and finally, pull down vertically. There is a limit to this approach, which can only be selected vertically, for scenarios where the code snippet is a bit long, as follows

5, feel so write, not write residue, not so detailed, the following important detailed written, online can find, simply say can

The following is a common practice, but I would like to say a few words.

ctrl+f, find, left the option to say, you see the hint, English, that you are not good to learn English, say, now the college entrance examination seems to gradually weaken the weight of English. Note that the bottom, you will be prompted 2 of 5 matches, a total of 5 found, you now match to the second one, I think this tip is very useful.

After Ctrl+f,Enter to find the next,Shift+enter, find Previous.

ctrl+h, find a replacement, not much to say.

Ctrl+shift+f, this is bold, floating red, pointing to it alive. How to say, can be called full-item search, that is, in your currently open project, based on the characters you entered to find.

As above, we find files containing have_posts in the WP folder. Few words, you may not be able to use it, please crossing your own experience.

Think at the beginning, I do not know that there is such a good thing, just use notepad++, in order to achieve full-text search and replace, deliberately wrote a PHP script to achieve this function.

----------feel tired of writing, this job is really not good to do, serious and really write Bo not easy ah. The rest of the shortcut keys as if there is nothing to be bold in detail, please refer to the online information----------

Reference http://ce.sysu.edu.cn/hope/Item/106853.aspx

Iv. talking about the benefits of St

1. Automatic prompting of PHP code, and automatic prompt for strings

The use of leverage, PHP code automatically prompt, do not explain. A string is automatically prompted, see

$st _so_powerful is not a PHP built-in variable, but it can be automatically prompted, because it already exists in the code, so you can prompt the existing characters, this function can greatly reduce the time you hit the code.

2, code template, quickly generate code

You knock on a ifelse to help you quickly generate the If else code template. The key is in the PHP code and in the HTML code, will generate the corresponding content, speech difficult table, see

Generated in the HTML code in the PHP code.

I will not explain, please self-awareness.

Again the code generated in the HTML keyword:php Echo if IfElse foreach, enough not?

Not enough to use??? Oh, that piece of code template custom Advanced usage, please google:sublime Text Snippet yourself

You have to come back to mend it, or you may have to scold me. Because you entered the IF, no response, to press the Tab key Ah, Big Brother.

3, sincerely write tired, it is over, at the end of a heavy-weight blockbuster function , please note that this function is only valid in ST3

Why do I use the IDE, OH, right, I have to say what I use the IDE, that is very useful Zend Studio, I only care about its two functions: 1, code jump, that is, jump to a variable or function definition where, 2, where the function is referenced (this is the heavyweight killer function, I've tried other PHP Ides.

Of course you can't expect our little St to have this heavyweight killer feature, but now ST3 has the first feature, the code jump, that jumps to where the function is defined. The important point of this feature is that you can now completely replace the other non-Zend Studio ides with ST3, really. :

If the function you want to jump to is defined in only one file, it jumps directly past; otherwise, an option is provided to let you choose which file to jump to.

Although this feature is not Zend Studio Smart (Zend is directly smart to jump to the corresponding file), but it is very good, is not it?

Ya, still have to mend again, old age, the brain is not good. Forget to say Jump method, check the function method name called, point F12, you can jump past. If the F12 shortcut key is occupied, modify the default shortcut, jump to the function's shortcut key customization, can be customized as {"Keys": ["F3"], "command": "Goto_definition"}, because I used to write Java, With eclipse for many years, so accustomed to F3 jump to the function, the reader help yourself. For a custom shortcut key, please Google

4, although write tired, released, but also suddenly remembered there is a very important function, have to say, so come back to mend

That is, add the folder to the project, click Menu Project, add Fold to project, select the folder you want to join the project to.

When you add a lot of folders to the project, you will find a small problem, that is, when the ctrl+p switch files, the optional list is a bit long, that is because you have more projects ah, there may be many files of the same name, and the list of items on the left does not look refreshing. What the? You don't see the list of items on the left, click Show Side Bar, View-Side bar.

So, we can have a project to occupy a workspace, to write which project, switch to which project to go.

What to do: When you add a folder to your project, click Menu Project, New Workspace for project, to build a workspace for this individual project, note that there is currently only one project, if there are two or more items, So this is going to be added to the new workspace, and for that I'm not quite sure, but the last time I did it seemed like this. The new workspace and save path to the project can be placed in the root directory of your project. For example, my project folder was Mybiaoke, and I saved the two files down here.

After the finished, we want to switch the project also how to do, with the shortcut key ctrl+alt+p , quickly cut past.

For this function, I do not know the way of operation and the process is not science, but at least can be achieved, please understand the students pointing.

The above describes the sublime Text 3 development PHP, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.