ap0581w9c 2016-05-21 936浏览量
来源: https://github.com/duydao/Text-Pastry/wiki/Examples
Assuming we have selected every ocurence of null
and Text Pastry was called by pressing CMD + ALT + N:
Enter a list of words, separated by one space, into the command line:
INPUT SELECT TEXTAREA DIV P A
var a = document.getElementsByTagName('null');
var b = document.getElementsByTagName('null');
var c = document.getElementsByTagName('null');
var d = document.getElementsByTagName('null');
var e = document.getElementsByTagName('null');
var f = document.getElementsByTagName('null');
var a = document.getElementsByTagName('INPUT');
var b = document.getElementsByTagName('SELECT');
var c = document.getElementsByTagName('TEXTAREA');
var d = document.getElementsByTagName('DIV');
var e = document.getElementsByTagName('P');
var f = document.getElementsByTagName('A');
The same as above, but this time we copy the list of words into our clipboard:
INPUT SELECT TEXTAREA DIV P A
Insert this into the input panel:
\p
var a = document.getElementsByTagName('null');
var b = document.getElementsByTagName('null');
var c = document.getElementsByTagName('null');
var d = document.getElementsByTagName('null');
var e = document.getElementsByTagName('null');
var f = document.getElementsByTagName('null');
var a = document.getElementsByTagName('INPUT');
var b = document.getElementsByTagName('SELECT');
var c = document.getElementsByTagName('TEXTAREA');
var d = document.getElementsByTagName('DIV');
var e = document.getElementsByTagName('P');
var f = document.getElementsByTagName('A');
This command will use any whitespace as delimiter. If we copy following list, we will get the same result:
INPUT
SELECT
TEXTAREA
DIV
P
A
Lets assume we want to paste some test data into our code:
71602 White Hall
71603 Pine Bluff
71611 Pine Bluff
71612 White Hall
71613 Pine Bluff
71630 Arkansas City
71631 Banks
71635 Crossett
71638 Dermott
71639 Dumas
This command will tell Text Pastry to split up our clipboard data by using the newline character as separator:
\p(\n)
var a = load('null');
var b = load('null');
var c = load('null');
var d = load('null');
var e = load('null');
var f = load('null');
var a = load('71602 White Hall');
var b = load('71603 Pine Bluff');
var c = load('71611 Pine Bluff');
var d = load('71612 White Hall');
var e = load('71613 Pine Bluff');
var f = load('71630 Arkansas City');
Each line of the clipboard data will be stripped/trimmed, so there won't be any leading spaces. The following list would therefore give us the same result when we use \p(\n) as command:
Data without leading/trailing whitespace
INPUT
SELECT
TEXTAREA
DIV
P
A
is equal to data with leading whitespace:
INPUT
SELECT
TEXTAREA
DIV
P
A
We can change this behaviour in the <Packages>/Text Pastry/TextPastry.sublime-settings file:
"clipboard_strip_newline": false
Start at 1, adding 1 for each selection:
\i
var a = null;
var b = null;
var c = null;
var a = 1;
var b = 2;
var c = 3;
Start at 1000, adding 100 for each selection:
\i(1000,100)
var a = null;
var b = null;
var c = null;
var a = 1000;
var b = 1100;
var c = 1200;
You can also use negative numbers to create a negative sequence:
\i(100,-10)
var a = null;
var b = null;
var c = null;
var d = null;
var e = null;
var f = null;
var a = 100;
var b = 90;
var c = 80;
var d = 70;
var e = 60;
var f = 50;
Text Pastry supports the Insert Nums syntax:
1 100 1
Note: The last argument (padding) is optional, negative values are supported.
var a = null;
var b = null;
var c = null;
var d = null;
var e = null;
var f = null;
var a = 1;
var b = 101;
var c = 201;
var d = 301;
var e = 401;
var f = 501;
5 5 3
var a = null;
var b = null;
var c = null;
var d = null;
var e = null;
var f = null;
var a = 005;
var b = 010;
var c = 015;
var d = 020;
var e = 025;
var f = 030;
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
时时分享云计算技术内容,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。