I'm relatively new to sublime 3. I'm trying to use the RegReplace package to create custom regex find and replace commands that I can run from the command palate. I managed to create the custom rules, but don't know how to execute them.
我是相对较新的sublime 3.我正在尝试使用RegReplace包来创建自定义正则表达式查找和替换我可以从命令味道运行的命令。我设法创建自定义规则,但不知道如何执行它们。
The RegReplace website states: "Once you have replacements defined, there are a number of ways you can run a sequence. One way is to create a command in the command palette by editing/creating a Default.sublime-commands in your User folder and then adding your command(s)"
RegReplace网站声明:“一旦定义了替换,就可以通过多种方式运行序列。一种方法是通过在User文件夹中编辑/创建Default.sublime命令在命令面板中创建命令,然后添加你的命令“
I edited the file that appeared when I clicked "Preferences: Reg Replace - User" on the command palate, adding the code below:
我编辑了在命令口中单击“首选项:注册替换 - 用户”时出现的文件,添加以下代码:
{
"caption": "Reg Replace: process evernote",
"command": "reg_replace",
"args": {"replacements": ["remove evernote bullets", "last option removal"], "find_only":false}
}
However, this command does not appear on my command palate. How do I execute a predefined find and replace rule in RegReplace?
但是,此命令不会出现在我的命令上。如何在RegReplace中执行预定义的查找和替换规则?
1 个解决方案
#1
0
The file that you get to when you select Preferences > Reg Replace > User
is a settings file that stores settings specific to RegReplace
.
选择“首选项”>“注册替换”>“用户”时,您可以获得的文件是一个设置文件,用于存储特定于RegReplace的设置。
As the referenced help page mentioned, you need to create a file named Default.sublime-commands
inside of your User
package (use Preferences > Browse Packages
to see where that is if you're not sure) (or open it if it already exists) and then add in your code from above.
作为提到的引用帮助页面,您需要在User包内创建一个名为Default.sublime-commands的文件(如果您不确定,请使用Preferences> Browse Packages查看它的位置)(如果已经存在,则打开它) )然后从上面添加您的代码。
A sublime-commands
file is a JSON file that expects an array of the commands to be added to the command palette, so you'll need to make sure that you wrap the above in [
and ]
to turn it into an array:
sublime-commands文件是一个JSON文件,它要求将命令数组添加到命令选项板中,因此您需要确保将上面的内容包装在[和]中以将其转换为数组:
[
{
"caption": "Reg Replace: process evernote",
"command": "reg_replace",
"args": {"replacements": ["remove evernote bullets", "last option removal"], "find_only":false}
}
]
#1
0
The file that you get to when you select Preferences > Reg Replace > User
is a settings file that stores settings specific to RegReplace
.
选择“首选项”>“注册替换”>“用户”时,您可以获得的文件是一个设置文件,用于存储特定于RegReplace的设置。
As the referenced help page mentioned, you need to create a file named Default.sublime-commands
inside of your User
package (use Preferences > Browse Packages
to see where that is if you're not sure) (or open it if it already exists) and then add in your code from above.
作为提到的引用帮助页面,您需要在User包内创建一个名为Default.sublime-commands的文件(如果您不确定,请使用Preferences> Browse Packages查看它的位置)(如果已经存在,则打开它) )然后从上面添加您的代码。
A sublime-commands
file is a JSON file that expects an array of the commands to be added to the command palette, so you'll need to make sure that you wrap the above in [
and ]
to turn it into an array:
sublime-commands文件是一个JSON文件,它要求将命令数组添加到命令选项板中,因此您需要确保将上面的内容包装在[和]中以将其转换为数组:
[
{
"caption": "Reg Replace: process evernote",
"command": "reg_replace",
"args": {"replacements": ["remove evernote bullets", "last option removal"], "find_only":false}
}
]