Sublime Text使用筆記

來源:互聯網
上載者:User

標籤:

一 基礎安裝
1. 安裝Package Control使用快速鍵ctrl+`,調出輸出視窗, 然後輸入官網提供的代碼, 擷取代碼地址:https://packagecontrol.io/installation#st2 , 輸入代碼後直接斷行符號開始安裝, 稍等幾秒會提示你安裝結束,讓重啟編輯器.

2. 使用 Ctrl+Shift+P 調用命令選擇區,輸入“Package Control: Install Package”(安裝擴充包), 然後斷行符號進入安裝擴充包命令選擇區, 注:mac 下使用command + shift + P

3. 在擴充包安裝命令選擇區中輸入JsFormat, 然後斷行符號, 進入安裝, 一兩秒就可以安裝成功.

4. 粘貼一段json代碼, 點擊右下角Plain Text可以改變檔案類型為javascript, 然後右鍵菜單JsFormat, 或者直接使用快速鍵 Ctrl + Alt + F

 

二 安裝emmet外掛程式,快速產生html頭部資訊

1. command + shift + P 輸入emmet 斷行符號等待安裝,安裝成功後重啟sublime。

2. command + n 建立文檔,點擊右下角Plain text改成html格式檔案。

3. 輸入doc or html:4s or html:xxs or html:4t or html:5  按tab鍵,就會建立一個html空文檔。

 

三 安裝jquery外掛程式,不再贅述

使用方法:$.ready 然後輸入tab鍵

 

四 安裝SublimeTmpl

1、command + shift + P 

2、輸入Install Package斷行符號

3、輸入SublimeTmpl斷行符號

4、重啟sublime, 按下快速鍵control + option + h (快速產生HTML模板)

 

五 安裝Pretty JSON,對JSON格式資料解析包括編碼解析

1、command + shift + P 

2、輸入Install Package斷行符號

3、輸入Pretty JSON斷行符號

4、重啟sublime, 按下快速鍵control + command + j (格式化json字串),win下用快速鍵(Ctrl + Alt + j)

 

首先安裝Package Control, 之後就可以用Package Control 管理一些外掛程式安裝卸載。

安裝Package Control執行如下操作

The simplest method of installation is through the Sublime Text console. The console is accessed via the ctrl+` shortcut or the View > Show Console menu. Once open, paste the appropriate Python code for your version of Sublime Text into the console.

Sublime Text 2

import urllib2,os,hashlib; h = ‘7183a2d3e96f11eeadd761d777e62404‘ + ‘e330c659d4bb41d3bdf022e94cab3cd0‘; pf = ‘Package Control.sublime-package‘; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( ‘http://sublime.wbond.net/‘ + pf.replace(‘ ‘, ‘%20‘)).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), ‘wb‘ ).write(by) if dh == h else None; print(‘Error validating download (got %s instead of %s), please try manual install‘ % (dh, h) if dh != h else ‘Please restart Sublime Text to finish installation‘)

Sublime Text 3

import urllib.request,os,hashlib; h = ‘7183a2d3e96f11eeadd761d777e62404‘ + ‘e330c659d4bb41d3bdf022e94cab3cd0‘; pf = ‘Package Control.sublime-package‘; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( ‘http://sublime.wbond.net/‘ + pf.replace(‘ ‘, ‘%20‘)).read(); dh = hashlib.sha256(by).hexdigest(); print(‘Error validating download (got %s instead of %s), please try manual install‘ % (dh, h)) if dh != h else open(os.path.join( ipp, pf), ‘wb‘ ).write(by)

資料來源:https://sublime.wbond.net/installation#st3

 

安裝JsFormat

有時從網上扒了人家的js代碼來學習學習,開啟發現被壓縮了,這時就可以用JsFormat外掛程式格式化js代碼,恢複未壓縮時候的排版,挺給力的。按快速鍵Ctrl+Alt+F即可格式化當前的js檔案了。

資料來源:http://www.tuicool.com/articles/qEFJrm

 

// 常用全域使用者配置

功能表列-->Preferentces-->Settings - Default 

{

    "auto_complete": true,

    "auto_complete_commit_on_tab": true,

    // "color_scheme": "Packages/User/Monokai (SL).tmTheme",

    "draw_minimap_border": true,

    "draw_white_space": "all",

    // "font_face": "Source Code Pro",

    "font_size": 12.0,

    "highlight_line": true,

    "highlight_modified_tabs": true,

    "ignored_packages":

    [

        "Vintage",

        "LiveStyle"

    ],

    "line_padding_bottom": 1,

    "line_padding_top": 1,

    "save_on_focus_lost": true,

    "tab_size": 4,  // 設定tab為四個空格

    "translate_tabs_to_spaces": true,

    "trim_trailing_white_space_on_save": false,

    "word_wrap": true

}

功能表列:--> Preferences -> Settings – More -> Syntax Specific – User

{

    "tab_size": 4,

    "translate_tabs_to_spaces": false

}

 

設定檔將會按下面這個順序應用:

Packages/Default/Preferences.sublime-settings

Packages/Default/Preferences (<platform>).sublime-settings

Packages/User/Preferences.sublime-settings

Packages/<syntax>/<syntax>.sublime-settings

Packages/User/<syntax>.sublime-settings

通常情況下,你應該把你的配置放在Packages/User/Preferences.sublime-settings裡。如果你要給特定的檔案類型指定配置,比如,Python, 應該放在Packages/User/Python.sublime-settings檔案中。

 

常用外掛程式:http://www.tuicool.com/articles/qEFJrm

Sublime Text使用筆記

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.