Sublime Text Plugin

本文介绍如何在 Sublime Text 中安装并配置 PackageControl,进而安装其他实用插件,如 SublimeLinter、SublimeCodeIntel、Alignment 等,提升编程效率。

1. Package Control

Install

The Sublime Text package manager that makes it exceedingly simple to find, install and keep packages up-to-date.

Ref: https://packagecontrol.io/installation

1. Open console in Sublime Text by using "Ctrl + ` " or "View -> Show Console".

2. Input the appropriate code into the console for different version.

  • Sublime Text 3
import urllib.request,os,hashlib; h = 'eb2297e1a458f27d836c04bb0cbaf282'+'d0e7a3098092775ccb37ca9d6b2e4b7d'; 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://packagecontrol.io/'+ pf.replace(' ','%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) ifdh != h elseopen(os.path.join( ipp, pf), 'wb').write(by)
  • Sublime Text 2
import urllib2,os,hashlib; h = 'eb2297e1a458f27d836c04bb0cbaf282'+'d0e7a3098092775ccb37ca9d6b2e4b7d'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) ifnotos.path.exists(ipp)elseNone; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen('http://packagecontrol.io/'+ pf.replace(' ','%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb').write(by)ifdh == h elseNone; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) ifdh != h else'Please restart Sublime Text to finish installation')
3. Restart Sublime Text, If you see "Perferences -> Package Settings -> Package Control", it means a successful installation.

Use

Use "Command+Shift+P" to open the command panel of Package Control, and then use the following command to manage packages:

  • Install Package
  • Remove Package
  • List Packages
  • Enable Package
  • Disable Package
  • Upgrade Package

2. SublimeLinter

 SublimeLinter is a linting framework, can help you find potential syntax errors and bugs in your code. Take linter for html, css, js as example.

Ref: http://www.sublimelinter.com/en/latest/about.html

Install

1. Use Package Control to install package "SublimeLinter".

2.  Install node.js firstly, then install external linter binary for css, js, html.

brew install node
npm install -g csslint
npm install -g jslint
npm install -g htmlhint

3. Use  Package Control to install linter package.

  • css: Install package "SublimeLinter-cssint"
  • js: Install package "SublimeLinter-jshint"
  • html: Install package "SublimeLinter-contrib-htmlhint"
4. Open "Preferences -> Package Settings -> SublimeLinter -> Settings - User" file to config SublimeLinter, it’s recommended to set:

"lint_mode":"save only"

    It means linting only occurs when a file is saved, not when it is loaded, so that we can type smoothly. Also, you can config other features in this file.

3. SublimeCodeIntel

SublimeCodelntel is a full-featured code intelligence and smart autocomplete engine for Sublime Text, supporting JavaScript, Python, HTML, Ruby, CSS, PHP, etc.

Ref: http://sublimecodeintel.github.io/SublimeCodeIntel/

Install

Use Package Control to install package "SublimeCodeIntel".

Use

  • "Command + Shift + Space": pop up autocomplete whenever it's available
  • "Ctrl + Click": jump to symbol declaration
  • "Ctrl + Option + Command + Left": go back

Tips: The plugin doesn't support Rails.

4. Alignment

Dead-simple alignment of multi-line selections and multiple selections for Sublime Text.

Ref: http://wbond.net/sublime_packages/alignment

Install

Use Package Control to install package "Alignment".

Use

The default key to use alignment is "Ctrl + Command + A", which conflicts with the capture screen key of QQ. So we edit the key in "Preferences -> KeyBindings - User", here we use "Ctrl + Option + Command + ]" instead.

[
    { "keys": ["super+ctrl+alt+]"], "command": "alignment" }
]

5. BracketHighlighter

A bracket matcher and highlighter for Sublime.

 Ref: http://facelessuser.github.io/BracketHighlighter/

Install

Use Package Control to install package "BracketHighlighter".

6. ColorPicker

A color picker plugin for Sublime Text.

 Ref: http://weslly.github.io/ColorPicker/

Install

Use Package Control to install package "ColorPicker".

Use

Use "Command + Shift + C" to open the color pick panel.



评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值