sublime Text Pastry使用

来源:   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;
时间: 2024-10-11 09:33:08

sublime Text Pastry使用的相关文章

Sublime Text 常用的16 个 Sublime Text 快捷键

在我做了一次包含一些现场编码的演示后,一些观众问我是如何操作这么快.当然这里没有唯一的答案,答案是一堆简单的快捷键和大量的实践的组合.为了回应那些询问,我觉得有必要看看我每天想都不用想且使用的快捷键. 这里有一个15 16 个快捷键的精选列表(1个自定义快捷键),以gif动画展示,我每天使用.享受吧! (译者注:原文所列快捷键均为OS X环境,为了方便Windows和Linux环境童鞋的学习,译者将备注Windows和Linux下对应的快捷键) 选择 选择一个选中项的下一个匹配项 选择一个选中项

Sublime Text 3,有了Anaconda就会如虎添翼

作为Python开发环境的Sublime Text 3,有了Anaconda就会如虎添翼.Anaconda是目前最流行也是最有威力的Python代码提示插件. 操作步骤 1.打开package control菜单,输入install或者直接点击install package命令菜单 2.在新窗口输入Anaconda并点击第一个备选项进行安装.安装完成后会显示messages文档 3.由于插件本身无法知道Python安装的路径,所以需要手动设置Python主程序的位置.(刚安装完插件估计就会提示我

Sublime Text 3插件安装方法

一:安装Sublime Text 3插件的方法 安装package control组件,然后直接在线安装: 1.按Ctrl+`调出console(注:安装有QQ输入法的这个快捷键会有冲突的.输入法属性设置-输入法管理-取消热键切换至QQ拼音) 2.粘贴下面代码究竟部命令行并回车: import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); ur

sublime text插件

使用Package Control组件安装 也可以安装package control组件,然后直接在线安装: 按Ctrl+`调出console(注:安装有QQ输入法的这个快捷键会有冲突的,输入法属性设置-输入法管理-取消热键切换至QQ拼音) 粘贴以下代码到底部命令行并回车: 1 import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); url

Sublime Text 编辑器安装 Package Control

1.打开 sublime text  ,按 " Ctrl + `"( " ` ",就是"Tab"上面的那个,或者"1"左边那个键): 2.打开网站 https://packagecontrol.io/installation#st3复制红线部分代码,粘贴到上面提到的" Ctrl + `"的命令框内,并按"Enter"键,等几十秒(依网络状况而定),会提示安装完成: 3.确认安装成功 快捷

打造自己的Sublime Text 3 编辑器

Sublime Text 3据说是windows下的编辑神器,有很多vim的功能,字体颜色超丰富,灰常不错(装X专用*_*). 1,sublime安装 官网http://www.sublimetext.com/3下载 2,package control安装 打开地址https://packagecontrol.io/installation 在Sublime Text 3,菜单 View -> Show Console,会在底部出现一个命令输入框,然后将刚打开页面上面的Sublime Text

Sublime Text 2 配置手册

Preferences.sublime-settings文件: // While you can edit this file, it’s best to put your changes in // “User/Preferences.sublime-settings”, which overrides the settings in here. // // Settings may also be placed in file type specific options files, for

Sublime Text 全程指南

安装(Installation) Sublime Text 官方网站 提供了Sublime Text各系统各版本的下载,目前Sublime Text的最新版本是 Sublime Text 3 .这里以Windows版本的Sublime Text安装为例. 注意在安装时勾选 Add to explorer context menu ,这样在右键单击文件时就可以直接使用Sublime Text打开. 添加Sublime Text到环境变量 使用 Win + R 运行 sysdm.cpl 打开"系统属

sublime text 3 如何支持 javascript 代码提示方法一二

需要安装 SublimeCodeIntel 插件. 安装方法: 1.前示条件是 sublime text 3 已安装 package controll.(插件管理器) 安装 package control 方法: 按 Ctrl + ~ 调出控制台 复制粘贴如下代码,并回车: import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp)