Sublime Text 3 简介
Sublime Text 3 : A sophisticated text editor for
code, markup and prose
Download:
http://www.sublimetext.com/3
Sublime 是一款非常好用且流行的轻量级编辑器,除了代码高亮、语法提示等标配外,简约酷炫的外表看起来更是一种享受(最近一次更新从图标到界面更加扁平化),当然,Sublime只用到这个程度只能算是入门,更高级的玩法是插件扩展,这才是Sublime优于Editplus和Notepad++等轻量级的地方!
在原生的Sublime上通过安装一些插件,就可以对编辑器做自定义(比如自定义字体,自定义主题配色等)和一些功能上的拓展。可以说玩6了插件管理,Sublime就能任你把玩。
Sublime的插件扩展机制是通过Package Control来实现的。插件机制类似于Chrome浏览器的插件,用来扩展功能;而Package Control是用来为Sublime安装其他插件的插件,有点类似python的pip。
插件介绍
介绍几个Markdown类的常用插件:
插件 | 功能 |
---|---|
MarkdownEditing | 一个提高Sublime中Markdown编辑特性的插件 |
MarkdownPreview | Markdown转HTML,提供在浏览器中的预览功能 |
MarkdownLivePreview | 提供在编辑框中实时预览的功能 |
LiveReload | 一个提供md/html等文档的实时刷新预览的的插件 |
https://blog.csdn.net/qq_20011607/article/details/81370236
Package Control 的安装和使用
下面讲讲 Package Control 的安装和使用。
一、安装过程:
1.组合键 Ctrl+Shift+P
调出命令面板;
2.输入 ipc
,选择 Install Package Control
(Package Control: Install Package);
3.耐心等待几秒钟,直到出现下框,表示安装成功。
几点说明:
1). sublime 支持模糊搜索,故这里用了简写,输入完整的Install Package Control也是可以的。
2).等待期间主界面没有任何反馈,切勿以为它没啥反应,其实它在后台为你安装中。其实仔细看的话,编辑器底框会显示安装状态。Sublime的大多数状态消息都只在底框位置显示,这也体现了Sublime的一个特点:强化命令行操作,弱化弹窗交互。
3).安装成功后,在 Perferences → package settings中可以看到package control选项,用package control安装了其他也会显示在这里,其实package control本身也是个插件。这个选项可对各种已安装的插件做一定的配置。 之后再按Ctrl+Shift+P 调出控制面板,输入pac,就可以看到package control这个插件的所有功能(即命令)了,如下图:
小结:插件安装方式
组合键Ctrl+Shift+P 调出命令面板
输入Package Control: Install Package,回车
在搜索框中输入要安装的包名(一个一个,不能同时安多个)
静待几秒即可安装成功。
二、Package Control 的常用命令
Discover Package: 查询插件。会跳转到Package Control的官网中。
Install Package : 安装某个插件
Remove Package: 移除某个已安装的插件
Disable Package :禁用某个已安装插件
Enable Package : 启用某个被禁用的插件
List Package : 列出所有已安装插件
三、使用:用 Package Control 安装插件
在上图中,选择 Package Control:Install Package 选项。
大约3秒后调出安装的搜索框,此时输入安装包名,选中即可,这里以常用的包 MarkdownPreview 为例:
如果插件(包)成功安装的话,就会在编辑框自动打开该包的使用说明文件:
如前所述,安装成功后,在 Perferences→ package settings中可以看到 MarkdownPreview 的选项,在这里可以对该插件进行自定义配置。
四、其他常用插件
名称 | 功能 |
---|---|
ConvertToUTF8 | 解决文件编码转换的问题 |
Emmet | 快速编写html、css、js的神级插件 |
BracktHighLighter | 括号高亮显示 |
ColorPicke | 颜色选择器 |
HTMLBeautify | HTML格式化插件 |
IMESupport | 输入法支持插件 |
Material Theme | 一个主题 |
ChineseLocalization | 汉化插件 |
SideBarEnhancements | 增加左边栏的功能 |
⇧+⌘+P : Show the Command Palette
⌘+D: Use Multiple Selections to rename variables quickly:
Here ⌘+D is used to select the next occurrence of the current word. Once created, each selection allows for full-featured editing.
⌘+P: Quickly jump to files and functions with Goto Anything:
Here ⌘+P is used to open the Goto Anything menu, xcc is used to select the file xla_compilation_cache.cc, @ switches to symbol mode, and :c selects the XlaCompilationCache::Compile method.
⇧+⌘+R: Navigate source using Goto Definition
Here the mouse is hovered over a symbol to jump to the definition. The keyboard shortcut F12 can be used when the caret is located on a symbol, or Goto Symbol in Project can be opened via ⇧+⌘+R to jump to the definition of any symbol in the project.
Some features our users love:
GOTO ANYTHING
Use Goto Anything to open files with only a few keystrokes, and instantly jump to symbols, lines or words.
Triggered with ⌘+P, it is possible to:
Type part of a file name to open it.
Type @ to jump to symbols, # to search within the file, and : to go to a line number.
These shortcuts can be combined, so tp@rf may take you to a function read_file within a file text_parser.py. Similarly, tp:100 would take you to line 100 of the same file.
GOTO DEFINITION
Using information from syntax definitions, Sublime Text automatically generates a project-wide index of every class, method and function. This index powers Goto Definition, which is exposed in three different ways:
A popup is displayed when hovering over a symbol
Pressing F12 when the caret is on a symbol
The Goto Symbol in Project functionality
Symbol indexing can be customized on a per-syntax basis via configuration files, allowing users to tailor the feature to their needs.
MULTIPLE SELECTIONS
Make ten changes at the same time, not one change ten times. Multiple selections allow you to interactively change many lines at once, rename variables with ease, and manipulate files faster than ever.
Try pressing ⇧+⌘+L to split the selection into lines and ⌘+D to select the next occurrence of the selected word. To make multiple selections with the mouse, take a look at the Column Selection documentation.
COMMAND PALETTE
The Command Palette holds infrequently used functionality, like sorting, changing the syntax and changing the indentation settings. With just a few keystrokes, you can search for what you want, without ever having to navigate through the menus or remember obscure key bindings.
参考链接:
https://blog.csdn.net/qq_20011607/article/details/81370123
{
// 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
"channels": [
"https://packagecontrol.io/channel_v3.json"
],
// A list of URLs that contain a packages JSON file. These repositories
// are placed in order before repositories from the "channels"
// setting
"repositories": [],
// A list of packages to install pre-release versions for. Versions
// under 1.0.0 are not considered pre-release, only those using the SemVer
// -prerelease suffixes will be ignored if the package is not in this
// list.
"install_prereleases": [],
// If debugging information for HTTP/HTTPS connections should be printed
// to the Sublime Text console
"debug": false,
// 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.
"package_name_map": {},
// If package install, upgrade and removal info should be submitted to
// the channel for aggregated statistics
"submit_usage": true,
// The URL to post install, upgrade and removal notices to
"submit_url": "https://packagecontrol.io/submit",
// If packages should be automatically upgraded when ST starts
"auto_upgrade": true,
// If missing packages should be automatically installed when ST starts
"install_missing": true,
// If a package was installed by Package Control (has a
// package-metadata.json file) but is not in installed_packages, remove it
// based upon the assumption that it was removed on another machine and
// the Package Control.sublime-settings file was synced to this machine.
"remove_orphaned": true,
// The minimum frequency in hours in which to check for automatic upgrades,
// setting this to 0 will always check for automatic upgrades
"auto_upgrade_frequency": 1,
// Packages to not auto upgrade
"auto_upgrade_ignore": [],
// Timeout for downloading channels, repositories and packages. Doesn't
// have an effect on Windows due to a bug in WinINet.
"timeout": 30,
// The number of seconds to cache repository and package info for
"cache_length": 300,
// An HTTP proxy server to use for requests. Not normally used on Windows
// since the system proxy configuration is utilized via WinINet. However,
// if WinINet is not working properly, this will be used by the Urllib
// downloader, which acts as a fallback.
"http_proxy": "",
// An HTTPS proxy server to use for requests - this will inherit from
// http_proxy if it is set to "" or null and http_proxy has a value. You
// can set this to false to prevent inheriting from http_proxy. Not
// normally used on Windows since the system proxy configuration is
// utilized via WinINet. However, if WinINet is not working properly, this
// will be used by the Urllib downloader, which acts as a fallback.
"https_proxy": "",
// Username and password for both http_proxy and https_proxy. May be used
// with WinINet to set credentials for system-level proxy config.
"proxy_username": "",
"proxy_password": "",
// If HTTP responses should be cached to disk
"http_cache": true,
// Number of seconds to cache HTTP responses for, defaults to one week
"http_cache_length": 604800,
// User agent for HTTP requests. If "%s" is present, will be replaced
// with the current version.
"user_agent": "Package Control v%s",
// A list of package names to ignore when performing operations. This will
// only affect packages that appear to be a git or hg repository, but will
// be especially useful for package developers who manually deal with the
// repository and don't want Package Control touching it.
//
// It can help if trying to list packages to install hangs, possibly due
// to an interactive prompt.
//
// The setting can also be set to the boolean true to ignore all git and hg
// repositories, no matter what the name.
"ignore_vcs_packages": [],
// Custom path(s) to "git" binary for when it can't be automatically
// found on the system and a package includes a .git metadata directory.
// Supports more than one path to allow users to sync settings across
// operating systems.
"git_binary": [],
// This should NOT contain the name of the remote or branch - that will
// be automatically determined.
"git_update_command": ["pull", "--ff", "--commit"],
// Custom path(s) to "hg" binary for when it can't be automatically
// found on the system and a package includes a .hg metadata directory.
// Supports more than one path to allow users to sync settings across
// operating systems.
"hg_binary": [],
// For HG repositories, be sure to use "default" as the remote URL.
// This is the default behavior when cloning an HG repo.
"hg_update_command": ["pull", "--update"],
// Additional packages to ignore when listing unmanaged packages.
"unmanaged_packages_ignore": [],
// The downloader backends that should be used for HTTP(S) requests, split
// by operating system to allow for configuration to be shared.
//
// Valid options include: "urllib", "oscrypto", "curl", "wget",
// (Windows-only) "wininet"
//
// This setting allows Windows users to bypass wininet and use urllib
// instead if they machine or network presents trouble to wininet. Some
// OS X and Linux users have also reported better luck with certain
// proxies using curl or wget instead of urllib.
//
// The "curl" and "wget" options require the command line "curl" or "wget"
// program installed and present in the PATH.
"downloader_precedence": {
"windows": ["wininet", "oscrypto"],
"osx": ["urllib", "oscrypto", "curl"],
"linux": ["urllib", "oscrypto", "curl", "wget"]
},
// Directories to ignore when creating a package
"dirs_to_ignore": [
".circleci",
".git",
".github",
".hg",
".svn",
"_darcs",
"CVS"
],
// Files to ignore when creating a package
"files_to_ignore": [
"*.sublime-project",
"*.sublime-workspace",
"*.tmTheme.cache",
".bzrignore",
".gitignore",
".gitattributes",
".hgignore",
".codecov.yml",
".travis.yml",
"appveyor.yml",
"codecov.yml",
"*.pyc",
".coveragerc",
".flake8",
"pyproject.toml",
"tox.ini",
"mypy.ini"
],
// Files to include, even if they match a pattern in files_to_ignore
"files_to_include": [],
// When a package is created, copy it to this folder - defaults to Desktop
"package_destination": "",
// A way to create different packaging profiles for different types of
// package releases, such as for different platforms or binary-only
// releases.
//
// The key of the object will be the profile name and a list of them will
// be presenting when running the "Create Package File" command. The
// profile "Default" will use the top-level version on the following
// settings:
//
// - "dirs_to_ignore"
// - "files_to_ignore"
// - "files_to_include"
// - "package_destination"
//
// If a profile does not include one of those three setting, it will fall
// back to the top-level settings.
"package_profiles": {
"Binaries Only": {
// Exclude all .py files, but consequently include all .pyc files
"files_to_ignore": [
"*.sublime-project",
"*.sublime-workspace",
"*.tmTheme.cache",
".bzrignore",
".gitignore",
".gitattributes",
".hgignore",
".codecov.yml",
".travis.yml",
"appveyor.yml",
"codecov.yml",
"*.py",
".coveragerc",
".flake8",
"pyproject.toml",
"tox.ini",
"mypy.ini"
],
// Include __init__.py so Sublime Text will load the package
"files_to_include": [
"__init__.py"
]
}
},
// Enable the ability to run the tests - this is only for development
"enable_tests": false
}
{
"bootstrapped": true,
"in_process_packages":
[
],
"installed_packages":
[
"MarkdownEditing",
"MarkdownLivePreview"
]
}
网友评论