由于zend又出新版的studio,为了感受一下所说的快速,安装了zend studio 9 特意感受一把。一直以来,都不觉得zend studio比dreamweaver好用。可能是先入为主的观念,我把zend studio8的代码着色风格全改成了DW风格,哈哈。现在装了zs9,从头修理一下,稍作修改,特以记录。
一、修改字体
没想到zend studio 9中对中文显示不太好看,似乎有点小了。修改如下:打开Window->Preferences->General->Appearance->Colors and Fonts,找到Basic->Text Font,如果想用系统默认字体,就点Use System Font,我知道你似乎也不太愿意用系统默认字体,那就点Edit选择你想要的字体吧。
这时win7用户可能会出现一种情况(XP不知道,其他系统也不清楚),发现字体列表里,没自己想要的字体,明明系统中有N多字体,这里才显示了一小部分。遇到这种情况可以点“显示更多字体”,会打开系统字体文件夹,找到你想要的字体,应该是隐藏属性,然后就 右键->显示,就OK了。选择后点 确定->apply->OK就可以了。
本人比较喜欢Courier New字体作为代码编辑字体。
二、修改字体颜色
目前感觉zend studio自带的PHP代码着色方案不是很好,特别是关键字没有高亮,修改方法也很简单。Window->Preferences->PHP->Editor->Syntax Coloring。修改对应的颜色就可以了。下面提供一套仿dreamweaver的着色方案,仅供参考。
中文英文HEXRGB变量Variable#0066FF0,102,255字符串String#CC00000,12,0常数/内部常数constants/internal constants#55220085,34,0数字Number#FF0000255,0,0保留关键字Keyword#0066000,102,0块分隔符PHP tags#FF0000255,0,0注释PHPDoc comment#FF9900255,135,0注释PHPDoc#FF4400255,68,0单/多行注释Single/Multi-line comment#FF9900255,135,0
三、使用模板格式化
Window->Preferences->PHP->Code style->Formatter
导入以下的XML文件。
使用Ctrl + Shift + F自动格式化php文件。
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles>
<profile name="MO-STAR PHP Conventions">
<setting id="com.zend.php.core.formatter.insert_new_line_in_function_invoke" value="80"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_force_split" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_indent_policy" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_line_wrap_policy" value="1"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_force_split" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_indent_policy" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_line_wrap_policy" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_assignment_force_split" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_assignment_indent_policy" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_assignment_line_wrap_policy" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_binary_expression_force_split" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_binary_expression_indent_policy" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_binary_expression_line_wrap_policy" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_compact_if_force_split" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_compact_if_indent_policy" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_compact_if_line_wrap_policy" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_conditional_expression_force_split" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_conditional_expression_indent_policy" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_conditional_expression_line_wrap_policy" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_force_split" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_indent_policy" value="2"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_line_wrap_policy" value="3"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_force_split" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_indent_policy" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_line_wrap_policy" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_force_split" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_indent_policy" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_line_wrap_policy" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_force_split" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_indent_policy" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_line_wrap_policy" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.blank_lines_before_field" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.blank_lines_before_member_type" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.blank_lines_before_method" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.blank_lines_between_type_declarations" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.brace_position_for_block" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.brace_position_for_method_declaration" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.brace_position_for_switch" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.brace_position_for_type_declaration" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.continuation_indentation" value="2"/>
<setting id="com.zend.php.formatter.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
<setting id="com.zend.php.formatter.core.formatter.format_guardian_clause_on_one_line" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.indent_breaks_compare_to_cases" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.indent_empty_lines" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.indent_statements_compare_to_block" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.indent_statements_compare_to_body" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.indentation.size" value="4"/>
<setting id="com.zend.php.formatter.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_new_line_before_catch_in_try_statement" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_new_line_before_else_in_if_statement" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_new_line_before_while_in_do_statement" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_new_line_in_empty_block" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_new_line_in_empty_method_body" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_new_line_in_empty_type_declaration" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_arrow_in_array_creation" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_arrow_in_field_access" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_arrow_in_foreach" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_arrow_in_method_invocation" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_assignment_operator" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_binary_operator" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_closing_brace_in_block" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_closing_paren_in_cast" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_colon_in_conditional" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_coloncolon_in_field_access" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_coloncolon_in_method_invocation" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_comma_in_array_creation" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_comma_in_echo" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_comma_in_for_inits" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_comma_in_global" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_comma_in_list" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_comma_in_multiple_constant_declarations" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_comma_in_static" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_comma_in_superinterfaces" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_opening_paren_in_array_creation" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_opening_paren_in_cast" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_opening_paren_in_catch" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_opening_paren_in_for" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_opening_paren_in_foreach" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_opening_paren_in_if" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_opening_paren_in_list" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_opening_paren_in_switch" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_opening_paren_in_while" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_postfix_operator" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_prefix_operator" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_question_in_conditional" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_semicolon_in_for" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_after_unary_operator" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_arrow_in_array_creation" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_arrow_in_field_access" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_arrow_in_foreach" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_arrow_in_method_invocation" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_assignment_operator" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_binary_operator" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_closing_paren_in_array_creation" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_closing_paren_in_cast" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_closing_paren_in_catch" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_closing_paren_in_for" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_closing_paren_in_foreach" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_closing_paren_in_if" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_closing_paren_in_list" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_closing_paren_in_switch" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_closing_paren_in_while" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_colon_in_case" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_colon_in_conditional" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_colon_in_default" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_coloncolon_in_field_access" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_coloncolon_in_method_invocation" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_comma_in_array_creation" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_comma_in_echo" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_comma_in_for_inits" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_comma_in_global" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_comma_in_list" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_comma_in_multiple_constant_declarations" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_comma_in_static" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_comma_in_superinterfaces" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_opening_brace_in_block" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_opening_brace_in_switch" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_opening_paren_in_array_creation" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_opening_paren_in_catch" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_opening_paren_in_for" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_opening_paren_in_foreach" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_opening_paren_in_if" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_opening_paren_in_list" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_opening_paren_in_switch" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_opening_paren_in_while" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_postfix_operator" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_prefix_operator" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_question_in_conditional" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_semicolon" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_semicolon_in_for" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_before_unary_operator" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_between_brackets_in_array_type_reference" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.keep_elseif_statement_on_same_line" value="true"/>
<setting id="com.zend.php.formatter.core.formatter.keep_imple_if_on_one_line" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.keep_then_statement_on_same_line" value="false"/>
<setting id="com.zend.php.formatter.core.formatter.lineSplit" value="100"/>
<setting id="com.zend.php.formatter.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
<setting id="com.zend.php.formatter.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
<setting id="com.zend.php.formatter.core.formatter.put_empty_statement_on_new_line" value="true"/>
<setting id="indentationChar" value=" "/>
<setting id="insert_space_after_opening_paren_in_declare" value="false"/>
<setting id="insert_space_before_closing_paren_in_declare" value="false"/>
<setting id="insert_space_before_opening_paren_in_declare" value="false"/>
</profile>
</profiles>