search
HomeBackend DevelopmentPHP TutorialSublime Text 3 development php

It has been 4 months since the first unboxing review, but because of laziness, there is no further post. Finally, today, I feel like writing a quasi-technical article.

I forgot how I started using ST. I probably started using it after seeing recommendations from others online. I have been using it for half a year. It is an absolute artifact under Windows, unparalleled by Notepad++ and the like; under Linux, because there is vim, I don’t understand vim, so it’s hard to say which one is better. To sum up, it is an artifact-like lightweight text editor for php, python and other developers. It is quite good and recommended to you. I mainly use it to write PHP, it is really easy to use. It may also be useful for writing

python

; I don’t know what the situation is like when writing ruby, and whether anyone has used it to write. In short, ST is more suitable for writing some scripting languages. As for C#, Java, etc., it is better to use traditional and classic IDEs. 1. Install Sublime Text 3

Official website http://www.sublimetext.com/3

Be sure to choose ST3 instead of ST2, 3 is easier to use than 2, really, You'll find out later.

 Choose the corresponding version to install. After completion, you need to install a basic and necessary package management: Package Control, which will be used to install plug-ins in the future.

Package Control Installation

Installation Guidehttps://sublime.wbond.net/installation

 Open ST3, click on the menu View -> Show Console , will A command input box appears at the bottom, then copy the above command into the input box, press Enter, wait, and the installation is successful.


2. Plug-in installation

After installing Package Control above, we can open Package Control through the shortcut key Ctrl+Shift+P to install the plug-in. Enter install in the open input box, and you will automatically be prompted to select Install Package based on your input.

Wait, and then an input box will pop up, allowing you to enter the plug-in you want to install.

We want to install a plug-in that supports UTF8 encoding. We only need to enter convert in the input box. After automatic matching, select the ConvertToUTF8 plug-in, press Enter, wait, and the installation is complete. In this way, ST supports UTF -8 encoded.

I think it is a must-install plug-in

                           ery is mostly applicable to other languages, please make your own choice)

   1. ConvertToUTF8

  Plug-in that supports UTF-8 encoding

 2. Bracket Highlighter

  Used to match brackets, quotes and html tags. Useful for very long codes. After installation, there is no need to set up the plug-in and it will automatically take effect

 3. DocBlockr

 DocBlockr can automatically generate PHPDoc-style comments. The languages ​​it supports include Javascript, PHP, ActionScript, CoffeeScript, Java, Objective C, C, C++

 4. Emmet (Zen Coding)

  A plug-in that quickly generates HTML code snippets. It is unparalleledly powerful. If you don’t know, please ask Google by yourself

 5. SideBar Enhancements

 This plug-in improves the sidebar and adds many functions

 6. Theme management, when switching themes, you don’t need to modify the configuration file yourself, use this You can easily switch themes

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

3. General shortcuts Keys

Understanding and mastering the shortcut keys will allow you to move quickly. So, let’s take a look at some useful shortcut key operations in ST. Here I will only talk about the ones I usually use during development. Complete Readers are asked to google for shortcut key operations.

  1.

Ctrl+Shift+P

   Open Package Control, which has been introduced above. There is another trick here, which can be used in various places below, that is, ST supports fuzzy matching. For example, if you want to find an Install Package, you can install it in the input box of Package Control and it will be automatically matched to the Install Package. You can also simply enter the IP address and it will be matched. This fuzzy matching function is very convenient.

 2.

Ctrl+P

  Open the file based on the file name. For example, if you want to open login/func/funtion.php, you only need to enter login/func/funtion.php in the input box. You can also use fuzzy matching, such as login/function, etc. You should do fuzzy matching yourself. Experience it.

3. After finding the source code file we want to view, what should we do if we want to find function methods?

Ctrl+R

   Enter log to find all methods with log in their names. Enter loginout to locate loginout().

You may notice that after Ctrl+R, there will automatically be an @ in the input box, which means to match the method. Well, in addition to this, there are some useful matching symbols, which I will mention together.

After locating the line , Ctrl+G, or Ctrl+P, enter: the number of lines in the box, such as: 58, then jump to line 58.

Look for the logo , followed by Ctrl+P, # logo.

4. After learning the above shortcut operations, you can basically play ST. Being able to write PHP in ST is no longer a problem. It is very satisfying to switch between various files and quickly jump to methods. But if you want to use it more comfortably, smoother, and smooth as silk, you can also look at the following

Synchronized editing in multiple places, Ctrl+D, I often use this function, it is very good.

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

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

  $user['age'] = 28;

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

    The user in

                                                     in user    ,                             ’’’” being all changed to “member”, user can be selected by double-clicking it, and then Ctrl+D will be selected continuously downwards. Repeat , until you are satisfied with the position, and then you can edit it uniformly.

---->

Someone said, Tsk, this is nothing, you can completely use search and replace. Yes, search and replace can be achieved, but this method is more convenient for me. It's more intuitive and less error-prone. As the saying goes, heroes see each other differently, so please judge for yourself.

                       In fact, in addition to using the Ctrl+D shortcut key, there is also a way to use the mouse to achieve continuous selection. Hold down Ctrl and double-click to select multiple items.

              In fact, in addition to the above two ways to achieve simultaneous editing, there is another way. That is, hold down Shift, then hold down the right mouse button, and finally, pull down vertically. This method has limitations, that is, it can only be selected vertically. It is suitable for scenarios where the code segment is a bit long, as follows

5. It feels like writing like this is too crippled. I can’t be so detailed. Let’s put it below The important details are written in detail and can be found on the Internet, so just briefly talk about it

  What I’m going to talk about below is commonplace for everyone, but I still want to talk about it.

Ctrl+F, search, I won’t say much about the options on the left, just read the prompts yourself, in English, it tells you not to study English well, by the way, now the college entrance examination seems to be gradually weakening the weight of English. Note that at the bottom, you will be prompted for 2 of 5 matches. A total of 5 matches have been found. The one you are matching now is the second one. I think this tip is very useful.

  After Ctrl+F, Enter

finds the next one,

Shift+Enter, finds the previous one.

Ctrl+H, search and replace, not much to say.

Ctrl+Shift+F, this one needs to be bold and red, just point at it and it’s alive. How to put it, it can be called full-project search, which means searching in the project you are currently opening based on the characters you input. As above, we look for files containing have_posts in the wp folder. In just a few words, I may not be able to tell you all about its usage, so please experience it yourself.

                                                                                       intule’sWhen I only used NotePad++, I wrote a PHP script to implement this function in order to realize full-text search and replacement.

   ----------I feel tired from writing. This job is really hard to do. Writing a blog seriously is not easy. There seems to be nothing to describe in detail about the remaining shortcut keys. Please refer to the online information by yourself ----------

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

4. Let’s talk about the benefits of ST

  1. PHP code automatic prompt; and existing string automatic prompt

  Leverage It's easy to use, the PHP code automatically prompts, no need to explain. There is already an automatic prompt for strings, please see the picture below

  $st_so_powerful is not a built-in variable in PHP, but it can have automatic prompts because it already exists in the code, so it can prompt that it already exists characters, this function can greatly save your time typing code.

  2. Code template, quickly generate code

   If you type ifelse, it will help you quickly generate an if else code template. The key is that corresponding content will be generated in the PHP code and in the HTML code. It is difficult to explain in words. Please look at the picture below.

Generated in the PHP code Generated in the HTML code

I won’t explain. Yes, please enlighten yourself.

                                           ules Me in code generated keywords in HTML: php  echo  if ifelse foreach, is that enough?

  Not enough? ? ? Oh, for the advanced usage of this piece of code template customization, please google: Sublime Text Snippet

   You have to come back and make up for it, otherwise you may have to scold me. Because after you entered if, there was no response. You have to press the Tab key, brother.

  3. I’m really tired of writing, so let’s end it. Put a heavyweight bombshell function at the end. Please note that this function is only valid in ST3

  Why do I use an IDE? , by the way, first let me tell you which IDE I use, that is the very easy-to-use Zend Studio. I only care about its two functions: 1. Code jump, that is, jump to the place where the variable or function is defined; 2. Function Where is it referenced (this is a heavyweight killer feature that no other PHP IDE I have tried has).

 Of course you can’t expect our little ST to have this heavyweight killer function, but now ST3 has the first function, which is code jump, which can jump to the place where the function is defined. The significance of this feature is that you can now use ST3 to replace other non-Zend Studio IDEs, really. Above:

If the function you want to jump to is defined in only one file, jump directly to it; otherwise, you will be provided with options to choose which file to jump to.

   Although this function is not as smart as Zend Studio (Zend jumps to the corresponding file directly and intelligently), it is already very good, isn't it?

                  Yah, I need to make up for it again. I am getting older and my brain is not working well. Forgot to mention the jump method, select the called function method name, click F12, and you can jump to it. If the F12 shortcut key is occupied, please modify the default shortcut key and customize the shortcut key to jump to the function. It can be customized as { "keys": ["f3"], "command": "goto_definition" } , because I used to write Java and have used Eclipse for many years, so I am used to F3 jumping to functions, so readers can do it at their own convenience. As for how to customize shortcut keys, please google

   4. Although I was tired of writing and published it, I suddenly remembered that there is another very important function that I have to say, so I came back to add it

  That is , add the folder to the project, click the menu Project -> Add Fold To Project, just select the folder you want to add to the project.

  When you add many folders to the project, you will find a small problem, that is, when Ctrl+P switches files, the list of options is a bit long. That is because you have many projects, maybe There will be many files with the same name, and the project list on the left doesn't look clean. What? If you don't see the item list on the left, please click View -> Side Bar -> Show Side Bar.

  So, we can occupy one workspace for one project, and switch to whichever project we want to write.

 Specific operation: After you add a folder to the project, click the menu Project -> New Workspace For Project, create a workspace for this separate project. Note that there must be only one project currently. If there are two or more projects, then these will be added to the new workspace. I'm not sure about this, but it seemed like this the last time I did it. The new workspace and project save path can be placed in the root directory of your project. For example, my project folder is mybiaoke, and I save the two files here.

 After finishing the work, what should we do if we want to switch projects? We can use the shortcut keys Ctrl+Alt+P and we can switch quickly.

  For this function, I don’t know if my operation method and steps are scientific, but at least it can be achieved. Please give me some advice from students who know it.

The above introduces the development of PHP with Sublime Text 3, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
The Continued Use of PHP: Reasons for Its EnduranceThe Continued Use of PHP: Reasons for Its EnduranceApr 19, 2025 am 12:23 AM

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python: Exploring Their Similarities and DifferencesPHP and Python: Exploring Their Similarities and DifferencesApr 19, 2025 am 12:21 AM

PHP and Python are both high-level programming languages ​​that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP and Python: Different Paradigms ExplainedPHP and Python: Different Paradigms ExplainedApr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP and Python: A Deep Dive into Their HistoryPHP and Python: A Deep Dive into Their HistoryApr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

Choosing Between PHP and Python: A GuideChoosing Between PHP and Python: A GuideApr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Frameworks: Modernizing the LanguagePHP and Frameworks: Modernizing the LanguageApr 18, 2025 am 12:14 AM

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHP's Impact: Web Development and BeyondPHP's Impact: Web Development and BeyondApr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

How does PHP type hinting work, including scalar types, return types, union types, and nullable types?How does PHP type hinting work, including scalar types, return types, union types, and nullable types?Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.