Sublime Text Configuration

Source: Internet
Author: User
Tags beautifier goto pear php file php code svn sublime directory sublime text

Original: http://blog.csdn.net/w6611415/article/details/7725566/, bbs.chinaunix.net/thread-4083964-1-1.html


1. Preparation: Install the package control

We use sublime almost will first install this plug-in, this plug-in is the function of the management plug-in, first install it, and then install the other plug-in is convenient. Installation method:
Click the Sublime menu bar view->show Console, now open the console, this console has two columns, the above column will show real-time sublime executed what plug-in, output execution results, if you install a plug-in does not work properly, Should be here first to see if there is an error. The following column is an input box that allows you to run Python code. We enter the following code click Enter to run, you can install 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 the code
Then we hold the ctrl+shift+p.  An input box is output and the install is entered. Select Package Contrl:install the package to enter, you need to set a little bit, the lower right corner of the status bar will display the text being connected.

2,ctags. This plugin can jump across files and jump to the point where a function declaration is specified. Use the package control to search CTags for installation (installing the CTags plugin is OK, and a CTags for PHP plugin is useless). Note You need to install the Ctags command after installing the plugin. Window Download Ctags.exe http://vdisk.weibo.com/s/7QZd7. Place the Ctags.exe file where an environment variable can be accessed. Open cmd, enter ctags, if there is this command, proves successful. Ubuntu under Install Run command: sudo apt-get install exuberant-ctags.
Then in the Sublime project folder right-click, the Ctag:rebuild Tags menu will appear. Click on it, and the. tags file will be generated.

Then in your code, the cursor is placed on a function, click ctrl+shift+ left mouse button can jump to function declaration place.

3, Sublimecodeintel code hint. Sublime The default code hints can only prompt system functions, the user creates their own functions, classes cannot be prompted. If you want to prompt yourself to establish a function. You can install the Sublimecodeintel plugin.

Sublimecodeintel configuration required after installation, file: Add-ons directory/.codeintel/config
"PHP": {
"PHP": ' D:\SaeServer\php\php.exe ',
"Phpextrapaths": [' D:\SaeServer\php\stdlib '],
"Phpconfigfile": ' D:\SaeServer\apache\php.ini '
}, copy the code
Configure the PHP executable file address, PHP configuration file address, Phpextrapaths is additional code hint of the class library, in addition to the current project PHP code can be prompted outside the phpextrapaths defined in the directory PHP code can also prompt. D:\SaeServer\php\stdlib is the directory of the SAE local simulation files in Saeserver, so there is a hint of the SAE code wherever it is configured.

After installing Sublimecodeintel, press ALT + left mouse button to jump to the function declaration as well as Ctags. But if you have two files that declare a function of the same name, Sublimecodeintel will only jump to the first found function, and ctags will let you choose which file to jump to. So we generally still use the ctags jump function.

4, syntax hints. We need to write code if there is a syntax error, can prompt us immediately, can install the two plugins: Sublimelint and Phpcs, Sublimeint need the system has PHP command. So you need to set the environment variables of PHP. Sublimelint syntax error hints are displayed on the status bar, so be careful to look at the status bar when writing a program. The syntax error of PHPCS is that when we save the file, the Universal panel displays the error, Sublimelint's error prompt is real-time but not obvious. Phpcs error hints are not real-time, but they are obvious.  So we generally have to install both plugins. Phpcs In addition to the code hint of the total, there are other features, but I do not understand the other features how to use, we can go to study, if you know how to use and tell me again.

5,goto document. This plugin can help us to quickly view manuals. For example, when we write PHP code, suddenly forget how a function, put the mouse on the function, and then press F1, it can quickly open the PHP manual to explain the function of the place.
After installing the Goto document plugin, we then configure the shortcut key F1 to jump to the document. Open the Sublime menu bar Preferences->key bindings-user set shortcut keys:
[
{"Keys": ["F1"], "command": "Goto_documentation"}
After copying the code, press F1 to jump to the document.

6,function name display. This plugin can display the current cursor in which function in the status bar.

7,GBK Encoding Support. The sublime itself does not support GBK encoding and can be installed by this plugin to support it.

8,SVN plugin. Tortoise and TORTOISESVN clients can be installed under Windows. You can then submit SVN in the sublime directory or file right-click. Under Ubuntu You can install Rabbitvcs combined with this plugin: Https://github.com/kervin/sublime-svn/downloads to achieve the same functionality.

9,gist. When we build HTML files, we do some of the same code. At this time we like to have a code template, cannot write duplicate the same code, Gits plug-in can implement the function of code template. It can see the code templates that we created ourselves, and the code snippets remain under gist in GitHub. Http://lucifr.com/2012/03/07/sub. al-snippet-manager/the detailed usage is described here.

10, code comment formatting.

Additional PHP snippet plugin can prompt phpdocument format code

can also quickly output open source protocol, input php-will be prompted

Install the Docblockr plugin to form a comment block. Do not use a slash or an asterisk every time you tap a comment.

11, paired matching enhancements. Like these symbols are paired: curly braces {}, brackets [], brackets: (), quotation marks "" and so on. These symbols when we put the mouse at the beginning of the position of the symbol, we hope to see clearly where the end of the symbol where the sublime default is underlined, it is not obvious, want to be obvious, you can install plug-in Brackethighlighter.

12. Format the PHP code. Installing the Php-beautifier plugin and using Php-beautifier also requires the installation of the PHP Beutifier Pear package:
Pear Install Php_beautifier

Once installed, open the PHP file and ctrl+alt+f will automatically format the code for you.


13,xdebug. Can install Xdebug plug-in, Do code debugging function. This is the function of the large IDE, small editor can rarely do, but sublime but the corresponding plug-in can realize the function of Xdebug.

14,sublimerepl. Allows you to run the Python interpreter directly from the editing interface. I tend to run with Bpython in a separate terminal window, but sometimes sublimerepl is helpful.


15,pylinter. This plugin provides the best Pylint editor integration I have ever seen. It automatically checks the. py file whenever it is saved and displays the Pylint violation directly in the editing interface. It also has a shortcut to disable the partial pylint check by inserting a #pylint: disables the comment. This plugin is really useful for me.

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.