Sublime text,用递增的数字写多行
Sublime text, write multiple lines with increasing numbers
在 Sublime text 中,通过 selecting 多行,或 Ctrl+单击多行,我可以同时编辑所有行。我想要的是,这些行中的数字会有所不同;每行增加。
目前,例如,我会select 6行,按Ctrl+Shift+ L 在每个光标上获取多个光标,然后写例如 article > h1 { font-weight:normal; }
,结果是:
article > h1 { font-weight:normal; }
article > h1 { font-weight:normal; }
article > h1 { font-weight:normal; }
article > h1 { font-weight:normal; }
article > h1 { font-weight:normal; }
article > h1 { font-weight:normal; }
从这里开始,如果我希望它应用于从 h1
到 h6
的所有元素,我将手动编辑每一行以更改数字。
所以我的问题是,在这种情况下,Sublime Text 可以在每行中输出递增的数字吗?还是有另一种更简单的方法在将它们全部设置为 1 后手动更改它们?
有几个包可以帮助您插入数字序列,包括Text Pastry, Insert Nums等。
如果您使用 Text Pastry 为例,您可以通过以下方式实现您想要的效果:
- Select 6 行。
- 类型
article > h
.
- 按ctrl/cmd+alt+n 打开 Text Pastry 命令行。
- 输入
1
并按enter
。
- 输入
{ font-weight:normal; }
.
第 3 步和第 4 步会将序列 1, 2, ...
插入到您当前的选择中。
在 Sublime text 中,通过 selecting 多行,或 Ctrl+单击多行,我可以同时编辑所有行。我想要的是,这些行中的数字会有所不同;每行增加。
目前,例如,我会select 6行,按Ctrl+Shift+ L 在每个光标上获取多个光标,然后写例如 article > h1 { font-weight:normal; }
,结果是:
article > h1 { font-weight:normal; }
article > h1 { font-weight:normal; }
article > h1 { font-weight:normal; }
article > h1 { font-weight:normal; }
article > h1 { font-weight:normal; }
article > h1 { font-weight:normal; }
从这里开始,如果我希望它应用于从 h1
到 h6
的所有元素,我将手动编辑每一行以更改数字。
所以我的问题是,在这种情况下,Sublime Text 可以在每行中输出递增的数字吗?还是有另一种更简单的方法在将它们全部设置为 1 后手动更改它们?
有几个包可以帮助您插入数字序列,包括Text Pastry, Insert Nums等。
如果您使用 Text Pastry 为例,您可以通过以下方式实现您想要的效果:
- Select 6 行。
- 类型
article > h
. - 按ctrl/cmd+alt+n 打开 Text Pastry 命令行。
- 输入
1
并按enter
。 - 输入
{ font-weight:normal; }
.
第 3 步和第 4 步会将序列 1, 2, ...
插入到您当前的选择中。