SublimeText2phpTidy plug-in assembly and BUG fixing

Source: Internet
Author: User
Tags coding standards
The phpTidy plug-in of the sublimeText2phpTidy editor is used to format php code. ps: I originally wanted to use PhpBeautifier, but it was too troublesome to install it. first, install packagecontrol. click view-& gt; showc sublime Text2 phpTidy plug-in on the menu bar of sublime to install and fix bugs.

The phpTidy plug-in of the sublime Text2 editor is a tool used to format php code.

Ps: I originally wanted to use PhpBeautifier, but it was too troublesome to install it.

Installation:

First install package control

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()) 

? After running, restart the editor to view the package control in Preferences.



?

Install phpTidy



?

Wait for response

Enter

Phptidy

Enter

Installation complete

?

BUG:



?

When formatting php using phptidy, a BUG occurs.

Cannot be formatted when the file contains Chinese characters

Cause Analysis: character issues.

Solution:

Find? Php_tidy.py File (\ Sublime Text 2 \ Packages \ PhpTidy \ php_tidy.py)

Add the edit file to the top

Import sys

Reload (sys)

?

Sys. setdefaultencoding ('utf-8 ')



? Save> restart? Sublime Text2?

?

Okay, the problem is fixed.

Appendix 1:

Which of the following URLs can be viewed? Sublime Text 2 has those plug-ins

Http://wbond.net/sublime_packages/community#sort-installs

Appendix 2:

Common plug-ins

Zen CodingEmmet? 7/18/13 v2013.07.18.09.23.04? 588124 instils (28%)

Emmet (ex-Zen Coding) for Sublime Text?

?

Format js code JsFormat? 7/10/13 v2013.07.10.20.36.57? 169961 instils (8%)

Javascript formatting for Sublime Text 2? ?

?

GBK encoding package ConvertToUTF8? 7/24/13 v1.2.2? 58626 instils (3%)

For editing and saving files encoded in GBK, BIG5, EUC-KR, EUC-JP, Shift_JIS, etc.

?

Syntax test SublimeLinter? Unknown v1.7.0? 301033 instils (14%)

Inline lint highlighting for the Sublime Text 2 editor

?

Highlight "" [] {} and so on BracketHighlighter? 7/16/13 v2013.07.16.23.30.30? 288886 instils (14%)

Bracket and tag highlighter for Sublime Text 2

?

Format HTML code HtmlTidy? 4/17/13 v2013.04.17.11.33.31? 31973 instils (2%)

Tidy, clean and prettify your HTML code with this plugin for Sublime Text 2

?

Format PHP code PhpTidy? 6/9/13 v2013.06.09.08.26.10? 25952 instils (1%)

Plugin for Sublime Text 2 to format PHP code to meet the WordPress Coding Standards using a modified version of phptidy

?

Format sqlFormat? SQL? 2/5/12 v1.0.1? 13547 instils (1%)

Formatting? SQL? Statement to a more readable form by using python-sqlparse library

?

Get HTTP request in sublime Http? Requester? 6/26/13 v2013.06.262.164.30.38? 13997 instils (1%)

HTTP client plugin for Sublime Text 2

?

Comment block DocBlockr? 6/18/13 v2013.06.18.11.58.38? 138951 instils (7%)

Simplifies writing? DocBlock comments in Javascript, PHP, CoffeeScript, Actionscript, C & C ++

?

Cross-page search function definition and automatic completion of SublimeCodeIntel? 7/19/13 v2.0.1? 226341 instils (11%)

Full-featured code intelligence and smart autocomplete engine

?

?

?

?

?

?


?

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.