sublime Text Pastry使用

简介: 来源:   https://github.com/duydao/Text-Pastry/wiki/Examples Using a text list Using the Clipboard Clipboard Data - Example 2 From 1 to 3 From 1...

 

来源:   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;
相关文章
|
6月前
|
前端开发 JavaScript Linux
Sublime Text 3配置Go语言开发环境
【4月更文挑战第13天】本篇文章 Huazie 向大家介绍使用 Sublime Text 3搭建Go语言开发环境,并演示编译运行 Go语言代码
836 8
Sublime Text 3配置Go语言开发环境
|
5月前
lua环境,sublime text 插件安装
lua环境,sublime text 插件安装
|
3月前
|
Python
Sublime Text Python 代码提示插件 Anaconda
Sublime Text Python 代码提示插件 Anaconda
76 1
|
3月前
|
JSON 数据格式
Sublime Text 查找的内容 高亮显示
Sublime Text 查找的内容 高亮显示
452 0
Sublime Text 查找的内容 高亮显示
|
3月前
Sublime Text 16进制显示
Sublime Text 16进制显示
182 0
|
3月前
Sublime Text 汉化 中文
Sublime Text 汉化 中文
54 0
|
6月前
|
前端开发 Unix Linux
Sublime Text 3配置 Python 开发环境
【5月更文挑战第7天】本篇 Huazie 介绍了 Sublime Text 3 配置 Python 开发环境的相关内容,感兴趣的朋友赶紧配置起来,有任何问题可以随时评论区沟通。
162 1
Sublime Text 3配置 Python 开发环境
|
6月前
|
开发框架 前端开发 C#
Sublime Text 3配置 C# 开发环境
【5月更文挑战第2天】本篇 Huazie 介绍了 Sublime Text 3 配置 C# 的相关内容,感兴趣的朋友赶紧配置起来,有任何问题可以随时评论区沟通。
63582 7
Sublime Text 3配置 C# 开发环境
|
6月前
|
C++
Sublime Text 3 解决中文乱码问题
【5月更文挑战第1天】本篇介绍 Sublime Text 3 解决中文乱码问题,不仅仅适用于 C/C++ 代码,也适用于其他任何 Sublime Text 3 集成的开发环境。
1263 5
Sublime Text 3 解决中文乱码问题
|
6月前
|
API 开发工具 C++
【专栏:工具与技巧篇】使用代码编辑器(VS Code/Sublime Text)提升开发效率
【4月更文挑战第30天】在VS Code与Sublime Text两大流行代码编辑器中,开发者可借助其高效特性提升编程效率。VS Code拥有丰富的插件生态、内置Git集成、强大的调试工具、智能提示和多文件导航功能。Sublime Text则以其轻量级、快速响应、多光标编辑及自定义构建系统见长。学习编辑器的键盘快捷键、自定义配置、使用内置终端以及键绑定和宏,将助开发者进一步提高开发效率。选择适合自己的编辑器并不断适应新技术是提升开发工作流的关键。
307 1