Hello everyone, today I will share with you an Editor: sublime text2 I have used many editors, Editplus, emeditor, notepad ++, notepad2, ultraedit, editra, Vim, and netbeans, zendstudio, and Dreamweaver. Finally, I met sublime text. Sublime is the best editor I have ever seen. You can use sublime to install corresponding plug-ins for functions that can be implemented by large ides. It is a small editor that runs fast. Now is the time to take the courage to replace your previous editor. If you have never heard of sublime before, you can see this introduction video: http://v.youku.com/v_show/id_XMzU5NzQ5ODgw.html
Sublime itself has limited functions. We need to install some plug-ins to make it powerful. Sublime can be run in various operating systems, but you need to pay attention to Chinese input when running it in Linux. Next I will introduce the common plug-ins, configuration suggestions, and precautions for running in Linux.
I. Common plug-ins
1. Package control. We almost always use sublime to install this plug-in first. This plug-in is a function for managing plug-ins. It is convenient to install other plug-ins first. Installation Method: Click View-> show console in the sublime menu bar. Now the console is opened, which has two upper and lower columns. The above column displays the plug-ins executed by sublime in real time and outputs the execution results, if a plug-in you installed does not run properly, check whether an error is reported. The following is an input box for running Python code. Enter the following code and press enter to run the package control.
- 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 ())
Copy code Then press Ctrl + Shift + P. In this case, an input box is output and install is input. Select package contrl: Install package and press Enter. You need to wait a moment. The status bar in the lower-right corner will display the prompt text that is being connected. When using sublime, pay attention to the status bar in the lower right corner. Many plug-in prompts are displayed here. This status bar is very small and may not be noticed by people who use it for the first time.
<Ignore_js_op>
After a while, it will display a list of plug-ins. You can also enter text in the input box to search for plug-ins. Find the plug-in you want to install, select it, and press Enter. It will be automatically installed for you.
If you want to uninstall the plug-in, press Ctrl + Shift + P and enter remove. Select package control: Remove package and then select the installed plug-in. Press enter to uninstall the plug-in.
If package control fails to install the plug-in, we can manually install the plug-in, search for the plug-in on Google, and download the plug-in source code. In the sublime menu bar, click preferences-> browse package .. the plug-in directory will be opened. Then copy the source code of the plug-in you downloaded.
What is the panel of the input box opened by Ctrl + Shift + P? The English name is "Anything panel". Any operation can be done in this panel. I will translate it into "Universal panel" for the moment ". There are several ways to open the universal panel. When Ctrl + Shift + P is enabled, we need to enter a command in the panel and then execute the command. You can enter a command to perform operations on all menu bar operations. When Ctrl + P is opened, you can quickly find the file. When Ctrl + R is enabled, you can find functions in the current file. When Ctrl + G is enabled, you can jump to the specified row.
When people started to access sublime, they were not very familiar with its environment. I have mentioned a little more here. Let's briefly summarize what we mentioned above.
The role of the console: You can execute Python code here and view some execution results. If the plug-in is not running properly, you can check whether an error is reported here. Status Bar in the lower-right corner: A lot of prompts will be displayed there, and you should check them frequently. Universal panel: All operations can be performed here. You can enter commands here, search for files, or search for functions here. Plug-in Installation Method: In addition to package control installation, you can also manually install the plug-in.
2. ctags. This plug-in can jump to the specified function declaration place across files. Use package control to search for ctags for installation (you can install the ctags plug-in, and a ctags for PHP plug-in is useless ). After installing the plug-in, install the ctags command. Window to download the ctags.exe http://vdisk.weibo.com/s/7QZd7. Place the ctags.exe file in a place where environment variables can be accessed. Open CMD and enter ctags. If this command exists, it indicates that the command is successful. Run the following command on Ubuntu: sudo apt-Get install exuberant-ctags. Right-click the sublime project folder and the CTAG: rebuild tags menu is displayed. Click it to generate the. tags file. <Ignore_js_op>
In your code, place the cursor on a function, and click Ctrl + Shift + the left mouse button to jump to the function declaration.
3. sublimecodeintel code prompt. The default sublime code prompt only prompts system functions. The user-created functions and classes cannot prompt. If you want to prompt yourself to create a function. You can install the sublimecodeintel plugin. <Ignore_js_op> Sublimecodeintel must be configured after installation. The file is added to the plug-in directory/. codeintel/config.
- "Php ":{
- "Php": 'd: \ saeserver \ PHP \ php.exe ',
- "Phpextrapaths": ['d: \ saeserver \ PHP \ stdlib '],
- "Phpconfigfile": 'd: \ saeserver \ apache \ PHP. ini'
- },
Copy code The PHP Execution file address and PHP configuration file address are configured. phpextrapaths is a class library that requires code prompts, in addition to the PHP code in the current project, the PHP code in the directory defined in phpextrapaths can also be prompted. D: \ saeserver \ PHP \ stdlib is the directory of the SAE local simulated file in saeserver. Therefore, the prompt for Sae code is displayed wherever it is configured.
After installing sublimecodeintel, press Alt + the left mouse button to jump to the function declaration area like ctags. However, if two files declare functions with the same name, sublimecodeintel will only jump to the first function found, and ctags will let you select the file to jump. So we usually use the jump function of ctags.
4. Syntax prompt. If a syntax error occurs during code writing, we can immediately prompt you to install these two plug-ins: sublimelint and phpcs. sublimeint requires the system to have PHP commands. Therefore, you need to set the PHP environment variables. The sublimelint syntax error prompt is displayed on the status bar. Therefore, when writing a program, always check the status bar. The syntax error message of phpcs is that an error is displayed on the universal panel when the file is saved. The error message of sublimelint is real-time but not obvious. The error message of phpcs is not real-time, but it is obvious. Therefore, we usually need to install these two plug-ins. In addition to code prompts, phpcs also have other functions, but I have not figured out how to use other functions for the moment. You can study them. If you know how to use them, let me know.
5. Goto document. This plug-in can help us quickly view the manual. For example, when we were writing PHP code, we suddenly forgot how to use a function, put the mouse over the function, and then press F1, it can quickly go to the PHP manual to describe how to use this function. After installing the Goto document plug-in, we can configure the shortcut key F1 to jump to the document. Open the sublime menu bar preferences-> key bindings-user to set the shortcut key:
- [
- {"Keys": ["f1"], "command": "goto_documentation "}
- ]
Copy code After this setting, Press F1 to jump to the document.
6. function name display. This plug-in shows the function in which the current cursor is located in the status bar.
7. GBK encoding support. Sublime itself does not support GBK encoding. you can install this plug-in to support it.
8. SVN plug-in. In Windows, you can install the tortoise and tortoisesvn clients. In sublime, you can submit SVN by right-clicking the directory or file. In ubuntu, rabbitvcs can be installed with this plug-in: The https://github.com/kervin/sublime-svn/downloads achieves the same functionality.
9. Gist. When creating an HTML file, we do some same code. At this time, we like to have a code template. We cannot write the same code repeatedly. The gits plug-in can implement the Code Template Function. It can be seen in the code template we have created. The code snippets are kept under gist in GitHub. Http://lucifr.com/2012/03/07/sub... Al-snippet-Manager/here detailed usage is introduced.
10. code annotation formatting.
The additional Php snippet plug-in prompts the phpdocument format code. <Ignore_js_op>
You can also quickly output open-source protocols. Input PHP-a prompt will be displayed. <Ignore_js_op>
Install the docblockr plug-in to form a comment block. You do not need to press a slash or Asterisk for each comment.
11. Paired matching enhancement. These symbols are paired with braces {}, braces [], Parentheses (), and quotation marks. When we move the cursor over the start symbol, we hope to clearly see where the end symbol is. The Sublime is underlined by default, which is not obvious. To be clear, we can install the plug-in brackethighlighter.
12. format the PHP code. Install the PHP-beautifier plug-in. To use PHP-beautifier, you also need to install the pear package of PHP beutifier: Pear install php_beautifier After the installation, open the PHP file and press CTRL + ALT + F to automatically format the code.
|
|