来源:   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. serialVersionUID的作用 (zz)

    serialVersionUID的作用 2011-05-12 16:04:19|  分类: java|举报|字号 订阅     在很多应用中,需要对某些对象进行序列化,让它们离开内存空间,入住物理硬盘 ...

  2. ajax返回类型dataType json和text比较

    $.ajax({ type: "post", url: "${ctx}/modules/fos/reference/echart", //dataType:'j ...

  3. 公网IP映射修改后,原先的图片访问却不行了

    描述:www与img在一个公网的nginx下时,www访问img没问题   ip:*.*.*.26 www与jimg同样还在同一组nginx,改另一个公网IP映射进来的时候,却访问不了  ip:*.* ...

  4. Spring的定时任务配置(转)

    spring的定时任务配置分为三个步骤: 1.定义任务 2.任务执行策略配置 3.启动任务 1.定义任务 <!--要定时执行的方法--> <bean id="testTas ...

  5. [SmartFoxServer概述]SFS2X协议

    SFS2X 客户端-服务器协议 SFS2X使用了一种高效的二进制协议,这种协议可以使服务器在各方面都表现出色.消息通过客户端和服务器引擎得到快速转换,在带宽上传输可更加轻便.附加的即时压缩,能够在不影 ...

  6. Web大文件上传控件-bug修复-Xproer.HttpUploader6

    1.修复上传文件夹时,文件夹大小可能不正确的问题.这个问题是由于以MD5模式上传时没有更新文件夹总大小导致.   更新fd_complete.aspx   更新DBFile.cs-fd_complet ...

  7. [java基础]计算机基础知识

    计算机=硬件+软件 1.硬件 计算机核心:CPU.CPU是计算机运算和控制的核心,用来接收计算机指令和运行计算程序. 数据从硬盘加载到内存,CUP从内存读取数据进行运算.内存存取数据快,但是断电或者退 ...

  8. HTML编程

    通俗的解释:HTML是一个没有穿衣服的人 CSS是穿上了华丽衣服的人 JS是使这个人动起来 HTML是英文Hyper Text Mark-up Language(超文本标记语言)的缩写,他是一种制作万 ...

  9. 腾讯DBA官方博客开通了

    腾讯DBA官方博客开通了,欢迎交流哈..     http://tencentdba.com   腾讯互娱游戏DBA团队一直致力于为游戏提供稳定.高效的DB运营服务,这是我们团队的使命. 过去DBA团 ...

  10. SQL Server 导入大数据脚本

    .先使用win+r运行cmd .执行osql -S DESKTOP-RGBEDS3 -U sa -P liyang -d FGCPOE_十院 -i D:\数据库\script.sql 即可!