来源:   https://github.com/duydao/Text-Pastry/wiki/Examples

  1. Using a text list
  2. Using the Clipboard
  3. Clipboard Data - Example 2
  4. From 1 to 3
  5. From 1000 to 1300
  6. From 100 to 50
  7. Insert Nums Syntax
  8. Insert Nums Syntax - Example 2

Using a text list

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

Text

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');

Result

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');

Using the Clipboard

The same as above, but this time we copy the list of words into our clipboard:

Clipboard Data

INPUT SELECT TEXTAREA DIV P A

Command

Insert this into the input panel:

\p

Text

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');

Result

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');

Note

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

Clipboard Data - Example 2

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

Command

This command will tell Text Pastry to split up our clipboard data by using the newline character as separator:

\p(\n)

Text

var a = load('null');
var b = load('null');
var c = load('null');
var d = load('null');
var e = load('null');
var f = load('null');

Result

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');

Note

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

From 1 to 3

Start at 1, adding 1 for each selection:

\i

Text

var a = null;
var b = null;
var c = null;

Result

var a = 1;
var b = 2;
var c = 3;

From 1000 to 1300

Start at 1000, adding 100 for each selection:

\i(1000,100)

Text

var a = null;
var b = null;
var c = null;

Result

var a = 1000;
var b = 1100;
var c = 1200;

From 100 to 50

You can also use negative numbers to create a negative sequence:

\i(100,-10)

Text

var a = null;
var b = null;
var c = null;
var d = null;
var e = null;
var f = null;

Result

var a = 100;
var b = 90;
var c = 80;
var d = 70;
var e = 60;
var f = 50;

Insert Nums Syntax

Text Pastry supports the Insert Nums syntax:

1 100 1

Note: The last argument (padding) is optional, negative values are supported.

Text

var a = null;
var b = null;
var c = null;
var d = null;
var e = null;
var f = null;

Result

var a = 1;
var b = 101;
var c = 201;
var d = 301;
var e = 401;
var f = 501;

Insert Nums Syntax - Example 2

5 5 3

Text

var a = null;
var b = null;
var c = null;
var d = null;
var e = null;
var f = null;

Result

var a = 005;
var b = 010;
var c = 015;
var d = 020;
var e = 025;
var f = 030;

sublime Text Pastry使用的更多相关文章

  1. Sublime Text 3中文乱码解决方法以及安装包管理器方法

    一般出现乱码是因为文本采用了GBK编码格式,Sublime Text默认不支持GBK编码. 安装包管理器 简单安装 使用Ctrl+`快捷键或者通过View->Show Console菜单打开命令 ...

  2. 在Sublime Text 3上安装代码格式化插件CodeFormatter

    1.了解CodeFormatter插件 在Sublime Text 3中编写代码,为了能让我们的代码格式变得漂亮整洁,需要一个能自动格式代码的插件.这里发现CodeFormatter插件不错,它能支持 ...

  3. sublime text 3 + python配置,完整搭建及常用插件安装

    四年的时间,一直使用EmEditor编辑器进行Python开发,之前是做面向过程,只需要将一个单独的py文件维护好即可,用着也挺顺手,但是最近在做面向对象的开发,不同的py文件中相互关联较多,感觉单纯 ...

  4. 前端工程师手中的Sublime Text

    原文地址:http://css-tricks.com/sublime-text-front-end-developers/ 我的Blog:http://cabbit.me/sublime-text-f ...

  5. Sublime Text 全程指引 by Lucida

    作者:Lucida 微博:@peng_gong 豆瓣:@figure9 博客园:@figure9 原文链接:http://zh.lucida.me/blog/sublime-text-complete ...

  6. 自定义Sublime Text的图标

    sublime text很赞,windows上最接近mac逼格的轻量编辑器,对于我这样比较喜欢格调的人来说,简直不二之选啊. 美中不足的是,看久了觉得它的图标似乎不是很上心.现在都流行扁平化了而它还停 ...

  7. 如何优雅地使用Sublime Text

    Sublime Text:一款具有代码高亮.语法提示.自动完成且反应快速的编辑器软件,不仅具有华丽的界面,还支持插件扩展机制,用她来写代码,绝对是一种享受.相比于难于上手的Vim,浮肿沉重的Eclip ...

  8. 为 Sublime Text 3059 配置 PHP 编译环境

    关于  Sublime Text 3059 的安装及汉化 请参看 http://www.xiumu.org/note/sublime-text-3.shtml 为 sublime Text 配置 PH ...

  9. 杂谈:用 Sublime Text 2 写 ActionScript3

    Sublime Text这是程序员最喜爱的编辑器,说说在win7下使用Sublime Text来编写as文件以及编译与运行swf. 准备工作 1.Sublime Text 2 2.Java 的JDK( ...

随机推荐

  1. ORA-01653:表空间扩展失败的问题以及增加表空间

    一.脚本修改方式: ----查询表空间使用情况---使用DBA权限登陆SELECT UPPER(F.TABLESPACE_NAME) "表空间名",D.TOT_GROOTTE_MB ...

  2. sqlite数据库中 保存和读取UIData对象

    + (void)getPersonByID:(int)ID { sqlite3 *db = [DB open]; sqlite3_stmt *stmt = nil; int result = sqli ...

  3. Node.js-提供了四种形式的定时器

    Node.js提供了四种形式的定时器 global.setTimeout(); //一次性定时器 global.setInterval(); //周期性定时器 global.nextTick(); / ...

  4. [UE4]武器碰撞

    实现武器战斗伤害系统,击中时如何发出碰撞事件产生伤害,目前探索的有通过物理碰撞和LineTrace两种方法. 物理碰撞通过Overlap事件的方法,优点是易于实现,缺点是无法具体到碰撞骨骼位置,低帧数 ...

  5. PHP生成迅雷、快车、旋风等软件的下载链接代码实例

    PHP生成迅雷.快车.旋风等软件的下载链接代码实例 <?php function Download() { $urlodd=explode('//',$_POST["url" ...

  6. Windbg符号与源码 《第二篇》

    符号文件是一种辅助数据,它包含了对应用程序代码的一些标注信息,这些信息在调试过程中非常有用.如果没有辅助数据,那么能获得的信息就只有应用程序的二进制文件.二进制文件很难调试,因为无法看到代码中的函数名 ...

  7. 递归获取XML元素

    看到的一道题,用递归获取XML元素.... static void Main(string[] args) { string xmlContent = @"<FileSystem> ...

  8. java5 CountDownLatch同步工具

    好像倒计时计数器,调用CountDownLatch对象的countDown方法就将计数器减1,当到达0时,所有等待者就开始执行. java.util.concurrent.CountDownLatch ...

  9. baguetteBox.js响应式画廊插件(纯JS)

    baguetteBox.js baguetteBox.js 是一个简单和易于使用lightbox纯JavaScript脚本,拥有图像放大缩小并带有相应的CSS3过度,并能在触摸屏等设备上完美展示. D ...

  10. atitit。自定义uml MOF EMF体系eclipse emf 教程o7t

    atitit.自定义uml MOF EMF体系eclipse emf  教程o7t 1. 元对象机制(MOF,Meta-Object Facility)and  结构 1 2. 元模型图.模型图.对象 ...