您好,登錄后才能下訂單哦!
html頁面的美化,直接ctr+shift+p輸入htmlB調用即可。
快捷方式ctr+alt+F,js的格式化。
增強的側欄功能,添加就知道怎么好了
快捷方式ctr+alt+N,New新的文件,支持tab自動補全文件夾,非常方便。
自動同步當前打開文件的side bar位置。
直接安裝就行。
https://packagecontrol.io/packages/phpfmt
注意確保php在系統的PATH中,因為這個功能具是php寫的,需要php執行。
phpfmt已經商業化,需要使用免費的php-cs-fixer.phar作為engine,點擊下載php-cs-fixer.phar拷貝到phpfmt的安裝目錄,更改phpfmt的settings,將engine更改為php-cs-fixer.phar。
另外,在Preferences----Package Settings----phpfmt----Settings - User中添加如下內容
{ "autocomplete": true, "autoimport": true, "passes": [ "AlignEquals", "AlignDoubleArrow", "AlignDoubleSlashComments", "AlignGroupDoubleArrow", "LongArray", ], "psr2": true, "smart_linebreak_after_curly": true, "version": 3 }
要執行,直接使用ctrl+shitf+p phpfmt: format now
。或者快捷鍵ctrl+f11
這個是檢查php代碼錯誤的插件,推薦。
安裝PHP_CodeSniffer:
pear : 下載 http://pear.php.net/go-pear.phar 執行: php go-pear.phar 執行:pear install PHP_CodeSniffer cpi ---安裝package----> sublimilinter_phpcs
sublime的php doc插件 DocBlockr,應該大家已經在用,現在需要修改一下配置,避免到處是[description]而實際上沒有任何有效的description被添加的情況。
Preferences --> Package Settings --> DocBlockr -> Settings -User:
{ "jsdocs_function_description": false, "jsdocs_return_description": false, "jsdocs_param_description": false, "jsdocs_param_name": true, "jsdocs_align_tags": "shallow", "jsdocs_spacer_between_sections": true }
一個示例如下:
/** * Send wechat message and notice for purchasing order finished. * * @param App\Shop $shop * @param App\PurchasingOrder $purchasingOrder * * @return void */
注意
@param
后面有兩個空格,而類型后面有一個空格,不需要對齊。
方法說明后一個空行,@param
塊后一個空行。@return
后不允許有空行。
這是一個color scheme,關注于把注意力放在代碼本身,試用幾個周后確實發現這種scheme有其優勢。建議大家體驗。
因為phpfmt商業化導致無法正常使用,使用php-cs-fixer的engine也需要配置很多數據,建議使用phpcs
,配置如下:
使用composer安裝php-cs-fixer
composer global require friendsofphp/php-cs-fixer
sublime安裝phpcs
pci------------- phpcs
配置phpcs,
preferences--package settings---php code sniffer
將以下內容添加進去:
{ // Example for: // - Windows 8.1 // - With phpcs and php-cs-fixer support // - You have to change "YOUR_USERNAME_HERE" strings. // - Notice: This uses phpcs which is installed // - using composer not xampp. // - Be sure to install phpcs using composer. // We want debugging on "show_debug": true, // Only execute the plugin for php files "extensions_to_execute": ["php"], // Do not execute for twig files "extensions_to_blacklist": ["twig.php"], // Execute the sniffer on file save "phpcs_execute_on_save": true, // Show the error list after save. "phpcs_show_errors_on_save": true, // Show the errors in the gutter "phpcs_show_gutter_marks": true, // Show outline for errors "phpcs_outline_for_errors": true, // Show the errors in the status bar "phpcs_show_errors_in_status": true, // Show the errors in the quick panel so you can then goto line "phpcs_show_quick_panel": true, // Path to php on windows installation // This is needed as we cannot run phars on windows, so we run it through php "phpcs_php_prefix_path": "", // We want the fixer to be run through the php application "phpcs_commands_to_php_prefix": ["Fixer"], // PHP_CodeSniffer settings // Yes, run the phpcs command "phpcs_sniffer_run": true, // And execute it on save "phpcs_command_on_save": true, // This is the path to the bat file when we installed PHP_CodeSniffer "phpcs_executable_path": "C:\\Users\\benjamincao\\AppData\\Roaming\\Composer\\vendor\\bin\\phpcs.bat", // I want to run the PSR2 standard, and ignore warnings "phpcs_additional_args": { "--standard": "PSR2", "-n": "" }, // PHP-CS-Fixer settings // Don't want to auto fix issue with php-cs-fixer "php_cs_fixer_on_save": true, // Show the quick panel "php_cs_fixer_show_quick_panel": false, // The fixer phar file is stored here: "php_cs_fixer_executable_path": "C:\\Users\\benjamincao\\AppData\\Roaming\\Composer\\vendor\\bin\\php-cs-fixer.bat", // Additional arguments, run all levels of fixing "php_cs_fixer_additional_args": { "--level":"psr2", "--fixers":"-psr0,array_element_no_space_before_comma,array_element_white_space_after_comma,extra_empty_lines,blankline_after_open_tag,duplicate_semicolon,function_typehint_space,operators_spaces,align_equals,align_double_arrow,ordered_use,whitespacy_lines,concat_with_spaces,unused_use,unary_operators_spaces,ternary_spaces,single_quote" }, // PHP Linter settings // Yes, lets lint the files "phpcs_linter_run": true, // And execute that on each file when saved (php only as per extensions_to_execute) "phpcs_linter_command_on_save": true, // Path to php "phpcs_php_path": "C:\\php-7.0.5-nts-Win32-VC14-x64\\php.exe", // This is the regex format of the errors "phpcs_linter_regex": "(?P<message>.*) on line (?P<line>\\d+)", // PHP Mess Detector settings // Not turning on the mess detector here "phpmd_run": false, "phpmd_command_on_save": false, "phpmd_executable_path": "", "phpmd_additional_args": {"align_equals":""} }
注意:需要將路徑配置為自己本地路徑。
試一下是否正常。
ctrl+shift+[ 折疊代碼塊(光標所在位置) ctrlshift] 取消折疊(光標所在位置) ctrl+k,0 取消所有折疊 ctrl+k, 1 (-9) 設置折疊等級:1是類層面,2,就是類的所有函數了。 例如如果要將所有函數都折疊,可以這樣操作:ctrl+k,2
打開控制臺,install package
搜 sublimelinter
先安裝sublimelinter本體
安裝完以后再搜索一下,安裝sublimelinter-php
接下來,打開preferences-package settings-sublimeLinter-settings--user
如下配置:
{ "user": { "linters": { }, "paths": { "linux": [], "osx": [], "windows": [ "D:\\xampp\\php" ] }, } }
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。