TypeShort
Replace placeholders into corresponding replacements in real-time while typing.
Details
Installs
- Total 2K
- Win 994
- Mac 309
- Linux 257
Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | Nov 14 | Nov 13 | Nov 12 | Nov 11 | Nov 10 | Nov 9 | Nov 8 | Nov 7 | Nov 6 | Nov 5 | Nov 4 | Nov 3 | Nov 2 | Nov 1 | Oct 31 | Oct 30 | Oct 29 | Oct 28 | Oct 27 | Oct 26 | Oct 25 | Oct 24 | Oct 23 | Oct 22 | Oct 21 | Oct 20 | Oct 19 | Oct 18 | Oct 17 | Oct 16 | Oct 15 | Oct 14 | Oct 13 | Oct 12 | Oct 11 | Oct 10 | Oct 9 | Oct 8 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
Readme
- Source
- raw.githubusercontent.com
ST-TypeShort
TypeShort is a snippet-like plugin for Sublime Text. It replaces placeholders into corresponding replacements in real-time while typing.
Why This Plugin
Have you ever considered $
, ->
, *
or &
, etc to be uncomfortable to type?
Typing them usually requires you to move your fingers farther.
Oh, OOP PHP uses $this->
so often… How long it takes you to type it?
Take the screenshot above as an example, you can set fj█
(█
represents space here just for visibility) as a placeholder for $
in PHP.
This plugin will automatically replace fj█
with $
in PHP whenever you type it.
Although fj█
is 3-char, it can be typed faster than a single $
and you do not have to move any of your finger due to QWERTY keyboard layout.
The ST Built-in Way
You can kind of having the same results with the following keybinding. So actually nowadays you may not need this plugin any more.
[
// HTML
{
"keys": ["c", "m", "t", " "],
"command": "insert_snippet",
"args": { "contents": "" },
"context": [{
"key": "selector",
"operand": "text.html.basic - source.php",
}],
},
// PHP
{
"keys": ["f", "j", " "],
"command": "insert",
"args": { "characters": "$" },
"context": [{
"key": "selector",
"operand": "source.php",
}],
},
{
"keys": ["d", "k", " "],
"command": "insert",
"args": { "characters": "->" },
"context": [{
"key": "selector",
"operand": "source.php",
}],
},
]
Installation
This package is available on Package Control by the name of TypeShort.
Note that you have to set your own (placeholder, replacement)
pairs to make this plugin work properly.
Settings
This plugin does not have any default binding since obviously they are very personal.
To add a binding, edit settings from the menu Preferences » Package Settings » TypeShort » Settings
.
Example Settings
{
// This file is an example settings.
// You should write your own settings in "Preferences » Package Settings » TypeShort » Settings"
// the symbol used to represent the new cursor position after a replacement
"cursor_placeholder": "{|}",
// You can alternatively use either syntax file name, syntax name or scopes in the "syntax_list".
// But scopes are recommended and the use of syntax (file) name may be removed in the future.
//
// - syntax file name: The syntax file name without extension.
// - syntax name: It's package-dependent and as shown on the bottom-right corner of your ST windows.
// - scope: ctrl+alt+shift+p shows it which usually starts with "source.xxx" or "text.xxx".
// You can use any ST selectors here. See https://www.sublimetext.com/docs/3/selectors.html
"bindings": [
{
// only works in HTML
"syntax_list": ["text.html.basic"],
// convert 'cmt ' into '' and place the cursor at its mid
"keymaps": {
"cmt ": "",
},
},
{
// only works in PHP
"syntax_list": ["source.php"],
// convert 'fj ' into '$'
// convert 'dk ' into '->'
"keymaps": {
"fj ": "$",
"dk ": "->",
},
},
{
// only works in C/C++
"syntax_list": [
"source.c", "source.c++",
"source.objc", "source.objc++",
"source.c++11", // C++11 package
],
// convert 'fj ' into '*'
// convert 'dk ' into '->',
"keymaps": {
"fj ": "*",
"dk ": "->",
},
},
],
}