Sublime text 3
Содержание:
- There are no packages available for installation
- Installation
- Formatter-specific notes
- Settings
- License
- [BONUS] Custom Statistics
- Features
- Adding custom Emmet snippets
- Usage
- Generating Your Own Access Token
- Case Conversion
- Inspiring Generosity, Gittip Style
- Troubleshooting
- Installation
- Notes on configuring the Open With menu:
- Settings
There are no packages available for installation
This message is displayed whenever Package Control can not find any packages
that are installable. The most common reason for this is an HTTP error in
downloading package information from the default channel.
To help resolve the issue, follow these steps:
-
Select the View > Show Console
menu entry - Look for any lines starting with Package Control:
-
Try enabling the for
more information -
Ensure any proxy information is set in
the Package Control settings -
If you have a proxy and it rewrites secure connections, add its CA cert
as trusted:-
Click the Preferences >
Browse Packages… menu - Open the User folder
-
Create a file named Package Control.user-ca-bundle and
paste in a PEM-formatted version of the certificate
-
Click the Preferences >
-
Make sure you have the latest version of Package Control installed:
3.3.0 -
If you are still having trouble, review the
open
issues. If you do not find a relevant issue, please open a new
one, and be sure to include your debug log.
Installation
Via Package Control
The fastest and easiest way to install these packages for Sublime Text is the
following:
- Install Package Control
- Open →
- Select
- Search for and packages and install them
- Happy coding 😉
Set as default
After you installed the language definition file successfully, all you have to
do is assign the files to always open with this syntax highlighter. Go to
→ → →
To remove this setting, you can always overwrite this preference.
Manual installation
Download the files from the python and Cython branches of this
repository. Navigate to your folder and create a and/or a
folder(s) and copy the and sublime-build files into.
Theme file
If you want to use my Work-In-Progress theme file: navigate to
folder and copy into it. Then go to user-settings, and change
your old color theme to the new one.
Formatter-specific notes
Following are notes specific to individual formatters that you should be aware of:
PHP
PHP — Used phpF by @subins2000
Getting and installing PHP — http://www.php.net/manual/en/install.general.php
You must install 5.6 or above ()
On Linux/OSx after installation of package, you must set chmod +x to file fmt.phar in folder %PACKAGESDIR%/CodeFormatter/codeformatter/lib/phpbeautifier
You can list all available transformations from Command Palette: CodeFormatter: Show PHP Transformations
Examples of many transformations can be found here: PHP Transformation Examples
Language specific options:
“js
«codeformatter_php_options”:
{
“syntaxes”: “php”, // Syntax names which must process PHP formatter
“php_path”: “”, // Path for PHP executable, e.g. “/usr/lib/php” or “C:/Program Files/PHP/php.exe”. If empty, uses command “php” from system environments
“format_on_save”: false, // Format on save. Either a boolean (true/false) or a string regexp tested on filename. Example : “(?!.min.|vendor.)*$”
“psr1”: false, // Activate PSR1 style
“psr1_naming”: false, // Activate PSR1 style — Section 3 and 4.3 — Class and method names case
“psr2”: true, // Activate PSR2 style
“indent_with_space”: 4, // Use spaces instead of tabs for indentation
“enable_auto_align”: true, // Enable auto align of = and =>
“visibility_order”: true, // Fixes visibility order for method in classes — PSR-2 4.2
“smart_linebreak_after_curly”: true, // Convert multistatement blocks into multiline blocks
// Enable specific transformations. Example: // You can list all available transformations from command palette: CodeFormatter: Show PHP Transformations // You can also see examples of many transformations at https://github.com/akalongman/sublimetext-codeformatter/blob/master/PHP-Transformations.md "passes": [], // Disable specific transformations "excludes": [] }
### Javascript/JSON Javascript/JSON - used (http://jsbeautifier.org/) by Einar Lielmanis Language specific options: ```js "codeformatter_js_options": { "syntaxes": "javascript,json", // Syntax names which must process JS formatter "format_on_save": false, // Format on save. Either a boolean (true/false) or a string regexp tested on filename. Example : "^((?!.min.|vendor).)*$" "indent_size": 4, // indentation size "indent_char": " ", // Indent character "indent_with_tabs": false, // Indent with one tab (overrides indent_size and indent_char options) "eol": "\n", // EOL symbol "preserve_newlines": false, // whether existing line breaks should be preserved, "max_preserve_newlines": 10, // maximum number of line breaks to be preserved in one chunk "space_in_paren": false, // Add padding spaces within paren, ie. f( a, b ) "space_in_empty_paren": false, // Add padding spaces within paren if parent empty, ie. f( ) "e4x": false, // Pass E4X xml literals through untouched "jslint_happy": false, // if true, then jslint-stricter mode is enforced. Example function () vs function() "brace_style": "collapse", // "collapse" | "expand" | "end-expand". put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line. "keep_array_indentation": false, // keep array indentation. "keep_function_indentation": false, // keep function indentation. "eval_code": false, // eval code "unescape_strings": false, // Decode printable characters encoded in xNN notation "wrap_line_length": 0, // Wrap lines at next opportunity after N characters "break_chained_methods": false, // Break chained method calls across subsequent lines "end_with_newline": false, // Add new line at end of file "comma_first": false // Add comma first }
HTML
HTML — used custom python port, please use it with caution, feature in early beta
Language specific options:
“js
«codeformatter_html_options”:
{
“syntaxes”: “html,asp,xml”, // Syntax names which must process HTML formatter
“format_on_save”: false, // Format on save. Either a boolean (true/false) or a string regexp tested on filename. Example : “(?!.min.|vendor.)*$”
“indent_size”: 4, // indentation size
“indent_char”: “ ”, // Indentation character
“indent_with_tabs”: false, // Indent with one tab (overrides indent_size and indent_char options)
“exception_on_tag_mismatch”: false, // If the last closing tag is not at the same indentation level as the first opening tag, there’s probably a tag mismatch in the file
“expand_javascript”: false, // Expand JavaScript inside of
Settings
A list of regular expressions patterns to ignore. Note that these regular expressions are compared against the file or directory name.
Boolean to keep selection panel open after selecting a resource to open.
Boolean setting specifying if a single command should be listed in the command palette for viewing and editing files or if multiple commands should be used.
True if, when moving up a directory, you would like the previous selection to be automatically chosen. False otherwise.
License
The MIT License (MIT)
Copyright 2013 Scott Kuroda
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the “Software”), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
sOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
[BONUS] Custom Statistics
Statistics of current file are represented in status-bar, based on , which is by default — as you can see it’s just a string containing special directives (see table bellow) and regular chars.
Directive | Description |
---|---|
Amount of pending tasks | |
Amount of completed tasks | |
Amount of cancelled tasks | |
Sum of completed and cancelled tasks | |
Sum of all tasks | |
Ratio of to | |
Percent as pseudo graphics (absents if less than 10%) | |
Date of lastly completed task | |
Return tasks which matched by regex ; e.g. — amounts of tasks with ; or {{@a |
So you can customise it as you like, by adding to , e.g.
{ "stats_format": "☐$o $d ✘$c", // if you want the statistics do not include the archived tasks: "stats_ignore_archive": true }
Additional settings for progress bar
{ "bar_full": "■", // any char "bar_empty": "☐", // any char // if you want to avoid Unicode when copy stats — you can define replacements // e.g. to convert ■■■■■■☐☐☐☐ to "replace_stats_chars": , , "], ] }
Features
The below features are available via the keyboard shortcuts shown, or via the Command Palette (^ means the key):
Feature | Shortcut |
---|---|
Rename | |
Find references | |
Next reference | |
Prev reference | |
Format document | |
Format selection | |
Format line | |
Format braces | |
Navigate to symbol | |
Go to definition | or |
Trigger completion | |
Trigger signature help | |
See previous signature in the tooltip | |
See next signature in the tooltip | |
Paste and format | or |
Quick info | |
Build | (Win) or , (OSX) or |
Error list | (via Command Palette) |
The “format on key” feature is disabled by default, which formats the current line after typing , or .
To enable it, go to -> -> -> , and add to the json file.
For further information about the keyboard shortcuts, please refer to the file for common shortcuts and
.sublime-keymap),
.sublime-keymap),
.sublime-keymap)
for OS-specific shortcuts.
Other settings
These settings can be overridden in , which you can open by going to -> -> -> .
- : the color of the lines drawn underneath/around type errors; either an empty string for the default color, or one of , , , , , ,
- : specifies a gutter icon, defaults to nothing can be set to , , or any other value accepted by Sublime Text
- : will draw type errors with a solid outline instead of the default which is a squiggly line underneath
- : the max width of the quick info popup, default 1024
- : array of command line arguments sent to the tsserver Node.js process before the tsserver script path (useful for e.g. changing max heap size or attaching debugger to the tsserver process)
- : array of command line arguments sent to tsserver Node.js process after the tsserver script path (useful for e.g. overriding tsserver error message locale)
- : environment variables to set for the tsserver Node.js process (useful for e.g. setting ). These variables are merged with the environment variables available to Sublime.
- : boolean to make the autocompletion only provides typescript suggestions and hides the standard completions (aka, all the words of the page). (Default value: ).
Adding custom Emmet snippets
To add new Emmet snippets or modify existing ones, tweak core Emmet preferences etc., go to Preferences > Package Settings > Emmet > Settings and modify key.
You can configure snippets/preferences globally or per syntax. Emmet understands two types of abbreviations: (used for markup syntaxes like HTML, Pug, JSX etc.) and (for CSS, Sass, Less, etc.). In order to add or modify snippets globally, you should use one of these keys in section. If you want to set snippets for specific syntax only (for example, only for JSX or HTML), you should use syntax name as a key. Here’s an example config:
Error: language “jsonc” is not supported
{ "config": { // Use "markup" key to specify global snippets/options for all markup // syntaxes like HTML, XML, JSX, Pug "markup": { // Snippets are just aliases for Emmet abbreviations // Check out default snippets: // https://github.com/emmetio/py-emmet/blob/master/emmet/snippets/html.py "snippets": { "foo": "ul.foo>li.foo-item*4" }, // Add options to fine-tune Emmet,see all available options here: // https://github.com/emmetio/emmet/blob/master/src/config.ts#L79 "options": { "output.tagCase": "upper" } }, // Configure snippets/options for HTML syntax only. // For a list of supported syntaxes, check out keys of `syntax_scopes` // dictionary of `Emmet.sublime-settings` "html": { "snippets": { "myhtml": "main.my-html>section" } }, // Use "stylesheet" key to configure all stylesheet syntaxes like CSS, SCSS, // Sass etc. "stylesheet": { // Stylesheet snippets are either aliases to CSS properties with // optional values or any arbitrary text. // Check out default snippets: // https://github.com/emmetio/py-emmet/blob/master/emmet/snippets/css.py "snippets": { "foo": "foo-bar" }, // You can also set options here: // https://github.com/emmetio/emmet/blob/master/src/config.ts#L79 "options": { "stylesheet.shortHex": false } }, // Configure snippets/options for CSS syntax only. // For a list of supported syntaxes, check out keys of `syntax_scopes` // dictionary of `Emmet.sublime-settings` "css": { "snippets": { "prop": "some-prop:${value}" } } } }
Usage
NOTE: In Windows or Linux use ctrl instead of ⌘
☐ ⌘ + enter or ⌘ + i: new task
☐ ⌘ + d: toggle task as completed.
☐ ctrl + c: toggle task as cancelled on Mac. alt + c on Windows/Linux.
☐ ⌘ + shift + a will archive the done tasks, by removing them from your list and appending them to the bottom of the file under Archive project
☐ ⌘ + shift + o will archive in Org-Mode style, removing the entire subtree after cursor and appending it to new file next to original one, e.g. if original is then new would be
☐ ⌘ + shift + u will open the url under the cursor in your default browser, other than http(s) schemes must be enclosed within , e.g.
☐ Anything with colon at the end of the line is a project title, you can also nest projects by indenting them.
☐ You can write plain text as notes or descriptions wherever you want. Use or for italic and bold just like in Markdown.
☐ You can add tags using sign
You can place cursors on tags, click right mouse button and Filter by tags under cursors:
pending tasks with selected tags will remain visible (and their notes and projects they belong to), but everything else will be hidden/folded; to unfold all press ⌘+k, ⌘+j or ⌘+k, ⌘+0
☐ You can navigate tags in current document via ⌘+shift+r.
☐ PlainTasks comes with a simple snippet for creating separators, if you feel that your task list is becoming too long you can split it into several sections (and fold some of them) using this snippet:
and then tab will give you this:
☐ Completion rules (ctrl+space or alt+/ to see list of them):
- type , press tab — it’ll become — this one is highlighted differently than other tags;
- , tab — ;
- , tab — ;
- , tab — ;
- , tab — — press tab again and current date will be inserted, when you’ll complete or cancel a task with such tag, you’ll know how many time has passed since start; if you have to change done/cancelled/started time, then you can recalculate the time spent on task by pressing tab while cursor is placed on a tag;
- , tab, tab work in the same manner as , but inserts — so you can pause and resume to get more correct result when done/cancel; each toggle tag is either pause or resume depending on its place in sequence;
- , tab, tab — (⌘ + shift + enter creates a new task with this tag);
-
, tab —
If you press tab again, it’ll insert current date, same for .
You can type short date (similar to OrgMode’s date prompt, but not the same) and then press tab to expand it into default format.
Short date should be ___
Dot can be used instead of hyphen, but should be consistent _-
year, month, minute, hour can be omitted:
Notation Meaning 1st day of next month always 1st day of current month always 5th day of current month (or next month if current day is 5th or older) February 3rd of current year or next one 31st day of current/next month at 23 hours and minutes are equal to current moment January 1st of 2016 at 01:01 -
relative period of time starts with a plus sign or two
____ — number is optional as well as letter for days or letter for weeks.Notation Meaning tomorrow as well as or one week since current date, i.e. 3 weeks since current date, i.e. one day since if any, otherwise it is equal to two hours since current date 555 minutes since current date 2 days and 12 hours since current date
-
☐ You can create a link to a file within your project by prefixing the file name with a dot and (back)slash like: or .
The line and column can be specified by colons: .
In SublimeText 3 you can specify a symbol inside that file by using > character like: .
In SublimeText 2 you can specify a text inside that file by using inch characters like: .
Pressing ctrl + o (alt + o on Windows/Linux) will open the file in Sublime and scroll to specific position if any.
Also in SublimeText 3 link may point to directory, open such link will add the directory to current project (sidebar).
In addition, Markdown and “wiki” (Org-Mode, NV, etc.) styles are supported as well, examples:
[](path) [](path ":11:8") [](path ">symbol") [](path "any text") `path` ] ] ] `path` ":11:8" `path` ">symbol" `path` "any text"
☐ To convert current document to HTML, bring up the command palette ⌘ + shift + p and type — it will be opened in default webbrowser, so you can view and save it. ask if you want to save and if yes, allow to choose directory and filename (but won’t open it in webbrowser).
Editor Useful Tools:
☐ Use ⌘ + control + up/down (ctrl + shift + up/down on Windows) to move tasks up and down.
☐ Use ⌘ + r to see a list of projects and quickly jump between them
★ See the Tutorial for more detailed information.
Generating Your Own Access Token
If you feel uncomfortable giving your GitHub username and password to the plugin, you can generate a GitHub API access token yourself. Just open up a Terminal window/shell (on OS X, Linux or Cygwin), and run:
curl -u username -d '{"scopes":, "note": "sublime-github"}' https://api.github.com/authorizations
where is your GitHub username. You’ll be prompt for your password first. Then you’ll get back a response that includes a 40-digit “token” value (e.g. ). Go to Sublime Text 2 -> Preferences -> Package Settings -> GitHub -> Settings — User, and insert the token there. It should look like:
{ "github_token": "6423ba8429a152ff4a7279d1e8f4674029d3ef87" }
Restart Sublime.
That’s it!
Case Conversion
Позволяет переключаться между snake_case, camelCase, PascalCase и т. д. После установки плагина с помощью Package Control (введите «pic» для быстрого доступа к Install Package), попробуйте:
До: navMenu
Нажмите: ;;c, затем ;;c
После: nav_menu
Обратите внимание, что это не будет работать должным образом, если вы попытаетесь преобразовать целую строку. До:
До: <nav id=»menu_system» class=»nav_menu isOpen»>
Нажмите: ;;c, затем ;;c (для camelCase)
После: navIDMenuSystemClassNavMenuIsOpen
Если вы являетесь веб-разработчиком, использующим Package Control Sublime Text 3, советую попробовать перечисленные в этой статье плагины! Если они вам не понравятся, всегда можно удалить их с помощью Package Control: Remove Package.
Inspiring Generosity, Gittip Style
by wbond
at 3:00pm
on Friday, August 9th, 2013
As part of the new site launch and the expanded package detail pages, I
wanted to start an experiment with making supporting package developers
even easier. Now granted, the part I’m playing in the process is rather
small since I am just providing links for each author. The real work that
makes this possible is Gittip, founded
by Chad Whitacre.
I was excited a few weeks ago to see the attention Gittip received when
John Resig announced the Khan Academy has started giving their developers
$5 a week to say thank you to the open source developers who make their
work possible.
My hope is that through exposing the work of the over 1,000 developers
who maintain various packages for Sublime Text, we can encourage each other
to say “thank you!”
In case you’ve never checked it out, Gittip offers weekly donation amounts
as small as $0.25. This may seen inconsequential, however if only 100 users
tip $0.25 a week, the developer can recieve $25. Considering there are
tens of thousands of users of some of the more popular packages, it should
be possible for these small donations to make a big impact and encourage
future open source work.
In closing I wanted to highlight some of the work a few contributors to
Package Control have been doing over the past months. These developers have
spent their time reviewing and giving feedback to fellow package developers
as they merge pull requests into the default channel:
Troubleshooting
If you are having problems or SublimeCodeIntel seems
slow/unresponsive/non-working, there are some things you should try:
- Make sure the SublimeCodeIntel is not being treated as an ignored
package. - Regenerate indexing database.
- Open a new issue.
Ignored package?
To make sure Sublime Text didn’t add SublimeCodeIntel to the list of
ignored packages (this happens some times when packages are being
installed/upgraded):
- Select the menu item
- Find the setting and remove SublimeCodeIntel from
the list.
Regenerate index
To force re-indexation of the code intelligence database you need to
follow these steps:
- Close Sublime Text
- Open a terminal or navigate through your directories to find the
directory that contains ,
and the directory . In Windows, this should be at
. - Delete the whole directory and all of its content.
Particularly, if you want to delete only the indexes, the code intelligence database indexes are located inside . - Start Sublime Text
- Try doing some code intelligence with the files in your project and
enjoy a clean re-indexing! (Remember that the database is being
regenerated with this procedure, so you’ll see it takes some time to
autocomplete the first few times, you’ll have to wait a bit for
things to be fast again)
Opening an issue
If the problems persist after trying the above solutions, open a new
issue in https://github.com/SublimeCodeIntel/SublimeCodeIntel/issues/
When opening new issues, please check no other issues exist which report
the same problem and provide all the messages from the Sublime Text
console (the console is accessed via the shortcut or the
menu) and the file
( in Windows) as well as
mentioning the Sublime Text version, the platform you are using and the
languages you are using the code intelligence on.
Installation
Download or clone the contents of this repository to a folder named exactly as the package name into the Packages/ folder of ST.
Troubleshooting Installation:
- First please note this package only adds a context menu to the “Folders” section and not to the “Open Files” section.
- Open the package folder. Main menu -> Preferences -> Browse Packages.
- Close Sublime Text.
- Remove the folder “Packages/SideBarEnhancements”
- Remove the folder “User/SideBarEnhancements”
- Navigate one folder up, to “Installed Packages/”, check for any instance of SideBarEnhancements and remove it.
- Open ST, with Package Control go to : Remove Package, check for any instance of SideBarEnhancements and remove it.
- Restart ST
- Open ST, check if there is any entry about SideBarEnhancements in Package Control(in sections: “Remove Package” and just in case in “Enable Package”)
- Repeat until you find there no entry about SideBarEnhancements
- Restart ST
- Install it.
- It works
Definitions file: (note the extra subfolder levels). To open it, right-click on any file in an open project and select
- On OSX, the ‘application’ property simply takes the name of an application, to which the file at hand’s full path will be passed as if with , e.g.: “application”: “Google Chrome”
- On OSX, invoking shell commands is NOT supported.
-
You should change Caption and id of the menu item to be unique.
//application 1
{
“caption”: “Photoshop”,
“id”: “side-bar-files-open-with-photoshop”,
“command”: “side_bar_files_open_with”,
“args”: {
“paths”: ,
“application”: “Adobe Photoshop CS5.app”, // OSX
“extensions”:“psd|png|jpg|jpeg”, //any file with these extensions
“args”:
}
},
Vars on “args” param
- \$PATH — The full path to the current file, “C:\Files\Chapter1.txt”
- \$PROJECT — The root directory of the current project.
- \$DIRNAME — The directory of the current file, “C:\Files”
- \$NAME — The name portion of the current file, “Chapter1.txt”
- \$NAME_NO_EXTENSION — The name portion of the current file without the extension, “Chapter1”
- \$EXTENSION — The extension portion of the current file, “txt”
Settings
- Sublack will always look for settings in the following order:
-
- First in a pyproject.toml file
- Second in the project file: first with sublack prefix then in a subsetting (see Project settings).
- Then in Users global settings
- Finally in Sublack’s default settings
Global settings
Preferences -> Package Settings -> sublack -> settings :
Black specifics options
-
- black_line_length:
-
Set custom line length option used by Black. Default = null which lets black default.
-
- black_fast:
-
Black fast mode. default is false.
-
- black_skip_string_normalization:
-
Don’t normalize string quotes or prefixes. Default = false.
-
- black_py36:
-
Force use of python 3.6 only syntax. The default is Black-s default.
-
- black_target_version:
-
Python versions that should be supported by Black’s output. You should enter it as a list ex :
Sublack specifics options
-
- black_command:
-
Set custom location. Default = «black».
-
- black_on_save:
-
Black is always run before saving the file. Default = false.
-
- black_log:
-
Show non error messages in console. Default = info.
-
- black_default_encoding:
-
Should not be changed. Only needed on some OSX platforms.
-
- black_use_blackd:
-
Use blackd instead of black. Default = false.
-
- black_blackd_server_host:
-
default = «localhost»,
-
- black_blackd_port:
-
default = «45484»
-
- black_blackd_autostart:
-
Automatically run blackd in the background wen sublime starts. default is false.
-
- black_use_precommit:
-
run black via pre-commit hook.
-
- black_confirm_formatall:
-
Popup confirmation dialog before format_all command. default = true.
Project settings
Just add sublack as prefix (recommended):
{ "settings" { "sublack.black_on_save" true } }
A sublack subsettings is still possible:
{ "settings" { "sublack" { "black_on_save" true } } }
Sublack supports the use of black configuration in pyproject.toml. Be aware that global/project settings will BE OVERRIDDEN by pyproject.toml’s settings.
Sublack will look for this file in your project directory then in your root folder(s).
See .