`
三月沙
  • 浏览: 617981 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

程序员利器sublime text 插件安装

 
阅读更多

sublime text 已经使用了有一年多了,随着其插件越来越丰富,现在平时工作生活所有代码都可以在sublime 上完成,而且其本身是跨平台的。

 

sublime 的插件安装非常方便,安装教程和地址如下

http://wbond.net/sublime_packages/package_control/installation

 

项目托管地址

https://github.com/wbond/sublime_package_control

 

Installation

Get Package Control alpha for Sublime Text 3

Please note that the following method can not validate the sublime.wbond.net SSL certificate. If you have concern over the security of the download, please follow the Manual Instructions below.

Installation is through the Sublime Text 2 console. This is accessed via the ctrl+` shortcut. Once open, paste the following command into the console.

import urllib2,os; 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())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print('Please restart Sublime Text to finish installation')

This command creates the Installed Packages folder for you (if necessary), and then downloads the Package Control.sublime-packageinto it.

Start Managing Your Packages

Manual Instructions

If for some reason the console installation instructions do not work for you (such as having a proxy on your network), perform the following steps to manually install Package Control:

  1. Click the Preferences > Browse Packages… menu entry
  2. Browse up a folder and then into the Installed Packages folder
  3. Download Package Control.sublime-package and copy it into the Installed Packages directory
  4. Restart Sublime Text

Testing Version

If you want to help test the latest changes, or you are having trouble with the stable version (v1.6.3) of Package Control, please use the instructions below to install the testing version (v1.6.9.0). See the testing version changelog on GitHub.

Notable changes include:

  • Refactoring in prep to support Python 3 for Sublime Text 3.

Upgrade

If you already have Package Control installed and want to help test the new version.

  1. Run the Package Control: Add Repository command via the command palette and enter the following URL:
    https://sublime.wbond.net/testing/packages.json
  2. Run the Package Control: Upgrade Package command and select Package Control from the list

Manual Install

If Package Control is not currently working for you, you’ll have to manually install.

  1. Click the Preferences > Browse Packages… menu entry
  2. Browse up a folder and then into the Installed Packages folder
  3. Download the testing version of Package Control.sublime-package and copy it into the Installed Packages directory
  4. Restart Sublime Text
  5. Run the Package Control: Add Repository command via the command palette and enter the URL to keep the testing version of Package Control up-to-date:
    https://sublime.wbond.net/testing/packages.json

Sublime Text 3

There is an alpha quality release of Package Control for Sublime Text 3 available. Please note that it currently functions the same as for ST2, however there will be changes in the future to properly support the new preferred method of keeping .sublime-package files on disk instead of extracting them to the Packages/ folder.

Please use GitHub issues and prefix all bug titles with ST3: .

Git Install

Since Sublime Text 3 no longer extracts the contents of .sublime-package files by default, and the fact that Package Control needs to read CA cert files from disk for SSL certificate verification, the only viable install method right now is via Git.

Please note, the Packages/ folder listed below refers to the folder that opens when you use the Preferences > Browse Packages… menu.

cd Packages/
git clone https://github.com/wbond/sublime_package_control.git "Package Control"
cd "Package Control"
git checkout python3

Testing on Sublime Text 2

The new version of Package Control is targetted at both Sublime Text 2 and Sublime Text 3. If you are still running ST2, and can help, please spend some time testing to make sure it does not regress.

  1. Run the Package Control: Add Repository command via the command palette and enter the following URL:
    https://sublime.wbond.net/alpha/packages.json
  2. Run the Package Control: Upgrade Package command and select Package Control from the list
 

Usage

Package Control is driven by the Command Pallete. To open the pallete, press ctrl+shift+p (Windows, Linux) or cmd+shift+p (OS X). All Package Control commands begin with Package Control:, so start by typing Package.

The command pallete will now show a number of commands. Most users will be interested in the following:

Install Package
Show a list of all available packages that are available for install. This will include all of the packages from the default channel, plus any from repositories you have added.
Add Repository
Add a repository that is not included in the default channel. This allows users to install and automatically update packages from GitHub and BitBucket. To add a package hosted on GitHub, enter the URL in the form https://github.com/username/repo. Don’t include .git at the end! BitBucket repositories should use the format https://bitbucket.org/username/repository.
Remove Package
This removes the package folder, and the package name from the installed_packages list in Packages/User/Package Control.sublime-settings. The installed_packages list allow Package Control to automatically install packages for you if you copy yourPackages/User/ folder to another machine.

By default Package Control checks for new versions on startup. This setting, plus the list of channels and repositories are managed through the Settings.

Additional commands include:

Add Repository Channel
Adds another channel that lists repositories. This is uncommon, but allows users to create a custom channel of repositories to share.
Create Package File
For package developers. Takes a package folder and generates a .sublime-package file that can be uploaded onto the web and referenced in the packages.json file for a repository.
Create Binary Package File
For package developers. Creates a .sublime-package file that does not include the source .py files, but instead the .pycbytecode files. This is useful to distribute commercial packages. Be sure to check the resulting .sublime-package file to ensure that at least one .py file is included so that Sublime Text will load the package.
Disable Package
Disables a package, which causes any Python scripts to be unloaded, and other files such as .sublime-keymap files to be unloaded also.
Discover Packages
Opens up a web browser to the Community Packages list.
Enable Package
Re-enables a package that has been disabled.
Upgrade/Overwrite All Packages
This will upgrade ALL packages, including ones that were not installed via Package Control. If you are developing a custom copy of a package, you may not want to use this command.
Upgrade Package
Show a list of packages that are available for upgrade and let the user pick which they would like to update.
Package Control Settings – Default
Open the default settings file, which can be used as a reference for changing the User settings. Any changes to this file will be lost whenever Package Control is automatically or manually upgraded.
Package Control Settings – User
Opens the user’s settings for Package Control. Any settings changes should be saved here so they are not overwritten when a new version of Package Control is released.
 

Settings

The default settings can be viewed by accessing the Preferences > Package Settings > Package Control > Settings – Default menu entry. To ensure settings are not lost when the package is upgraded, make sure all edits are saved to Settings – User.

debug
If set to true, will print HTTP headers and other debug information to the Sublime Text console.
Default: false
submit_usage
If installs, upgrades and removals should be logged to the reporting URL. This data will be used to power the community package listing and will be displayed in aggregate only. No user-identifiable information is sent, just the: package name, operation, package version, package control version, sublime version and sublime platform.
Default: yes
submit_url
Where the usage information should be sent to.
Default: "http://sublime.wbond.net/submit"
installed_packages
A list of packages that have been installed. Package Control will automatically install any packages in this list that are not currently installed, allowing this to be used for sharing package lists with other users. This setting is only tracked in Settings – User.
Default: []
repository_channels
A list of URLs that each contain a JSON file with a list of repositories. The repositories from these channels are placed in order after the repositories from the repositories setting.
Default: ["http://sublime.wbond.net/repositories.json"]
repositories
A list of URLs that contain a packages JSON file. These repositories are placed in order before repositories from therepository_channels setting.
Default: []
package_name_map
This helps solve naming issues where a repository it not named the same as the package should be. This is primarily only useful for GitHub and BitBucket repositories. This mapping will override the mapping that is retrieved from the repository channels.
Default: {}
auto_upgrade
If packages installed via Package Control should be checked for updates when Sublime Text starts. Updates will be automatically installed.
Default: true
auto_upgrade_frequency
The number of hours to wait before trying to auto upgrade packages again.
Default: 6
auto_upgrade_ignore
Packages to exclude from the auto upgrade functionality.
Default: []
install_missing
If set to false, will not automatically install packages from the installed_packages setting that are not present on the current machine. This is really only useful if you don’t want Sublime Text to connect to the internet without explicitly requesting it. In that case you’ll want to set auto_upgrade to false also.
Default: true
timeout
The HTTP timeout (in seconds) to use when downloading channels, repositories and packages.
Default: 30
cache_length
The number of seconds to cache channel and repository metadata for.
Default: 300
http_proxy
The proxy to use for HTTP requests. Should be in the form domainname:port or ip:port.
Default: ""
https_proxy
The proxy to use for HTTPS requests. If http_proxy is set and this settings is not, the value from http_proxy will be used. If set to false, then http_proxy will not be inherited. Should be in the form domainname:port or ip:port.
Default: ""
proxy_username
The username to use for proxy authentication. Default: ""
proxy_password
The password to use for proxy authentication. Default: ""
user_agent
The user agent used by the various downloaders. Default: "Sublime Package Control"
git_binary
The path to git, when using a git repository to track a package. When an empty string, Package Control will look in default locations for the current OS.
Default: ""
git_update_command
The parameters passed to git to update a package.
Default: ["pull", "origin", "master"]
hg_binary
The path to hg, when using an hg repository to track a package. When an empty string, Package Control will look in default locations for the current OS.
Default: ""
hg_update_command
The parameters to pass to hg to update a package. Be sure to keep the remote name as the last parameter, even if it is default.
Default: ["pull", "--update", "default"]
ignore_vcs_packages
If git and hg repositories should be ignored when trying to update packages.
Default: false
dirs_to_ignore
A list of folders to ignore when creating a .sublime-package file.
Default: [".hg", ".git", ".svn", "_darcs", "CVS"]
files_to_ignore
A list of file glob patterns to ignore when creating a .sublime-package file.
Default: [".hgignore", ".gitignore", ".bzrignore", "*.pyc", "*.sublime-project", "*.tmTheme.cache"]
package_destination
The folder to copy a newly created package to. Default to the user’s Desktop if blank. Setting this destination to the Installed Packages directory will cause your source code changes to be overwritten when Sublime Text restarts!
Default: ""
certs

A list of CA cert information for the purpose of providing a secure way to download packages. A default list is provided with Package Control, but then the default repository channel provides updates to the list. It is also possible to add your own entries for custom download locations, or for supporting your local proxy server.

To add your own, be sure to copy the JSON object below and then add your custom entries. The key in the JSON object is the domain the cert applies to. The value is an array with two elements, the first being an identifier for the cert, and the second being a location to copy the cert from. The identifier is used to ensure that Package Control has a copy of the latest version of the cert in its certs/ folder. The location can be either an absolute file path on your local machine, or a URL to download it from.

To create a CA cert that is ensured to be present no matter what domain is being accessed (such as for a proxy server), set the domain name to *, like in the example on the next line:

"*": ["my_proxy_cert", "/file/path/to/proxy/ca_certs"]

This ca cert needs to live somewhere on your machine permanently so that it can be re-added to the ca-bundle.crt file that is provided with each Package Control upgrade.

Default:
{
    "api.bitbucket.org": ["d867a7b2aecc46f9c31afc4f2f50de05", ""],
    "api.github.com": ["1c5282418e2cb4989cd6beddcdbab0b5", ""],
    "bitbucket.org": ["897abe0b41fd2f64e9e2e351cbc36d76", ""],
    "nodeload.github.com": ["1c5282418e2cb4989cd6beddcdbab0b5", ""],
    "raw.github.com": ["1c5282418e2cb4989cd6beddcdbab0b5", ""],
    "sublime.wbond.net": ["7f4f8622b4fd001c7f648e09aae7edaa", ""]
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics