NPPEXEC NPE_CMDALIAS 保存自定义别名吗?
我已经使用 cygwin mintty 一段时间了,它支持使用自定义别名,只需在我的用户属性的 bashRC 文件中定义它们即可。本质上,我可以输入“test”并让它执行一个可能类似于“C:\randomfolder\manySubfolders\someScript.pl”的脚本,因为它只是用脚本的长路径替换快捷方式别名。
notepad++ 插件 NPPExec 使用 npe_cmdalias alias = full 命令支持此行为。
这很好用,但是当 NPP 重新启动时,我的自定义别名会丢失。有没有办法让这些别名持续存在?
谢谢!
I've been using cygwin mintty for awhile now and it supports the use of custom alias's by simply defining them in the bashRC file of my user properties. Essentially I could type "test" and have it execute a script that may look something like "C:\randomfolder\manySubfolders\someScript.pl" as it simply replaces the shortcut alias with the long path to a script.
This behavior is supported in the notepad++ plugin NPPExec using npe_cmdalias alias = full command.
This works well, however my custom alias's are lost when NPP is restarted. Is there a way to make these alias's persist?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
NPPExec 有一种相当复杂的方法来做到这一点。以下是您需要执行的操作:
首先为命令创建一个文本文件。我将其命名为“NppStartScript.txt”并将其保存在“scripts”文件夹中。文件夹结构应如下所示:$(NPP_DIRECTORY)\scripts\NppStartScript.txt,其中 $(NPP_DIRECTORY) 代表您的 Notepad++ 应用程序文件夹。
找到“NppExec.ini”文件。它应该位于“$(NPP_DIRECTORY)\plugins\config”文件夹中。打开文件,在文件底部添加以下配置设置(用换行符与其余设置分开)并保存文件:
<代码>[选项]
ScriptNppStart=$(NPP_DIRECTORY)\scripts\NppStartScript.txt
创建“NppStartScript.txt”,键入命令并保存文件。在您的情况下,它将是:
npe_cmdalias alias = Full command
“完整命令”应该是指向文件的 npp_exec 指令,该文件将包含您要重复执行的命令。这是我的运行 python 命令的样子:
npe_cmdalias rpy = npp_exec "$(NPP_DIRECTORY)\scripts\rpy.txt"
“rpy.txt”包含调用 python 解释器的命令在当前 Notepad++ 选项卡中打开的文件。这是我写的:
D:\Portable Apps\Python\python.exe "$(FULL_CURRENT_PATH)"
重新启动 Notepad++,打开 NPPExec 控制台并输入您的别名。它应该运行您指定的命令
希望这有帮助,如果您遇到任何错误,请告诉我。
NPPExec has a rather convulated way of doing this. Here's what you need to do:
Start by creating a text file for the commands. I named mine 'NppStartScript.txt' and saved it in the 'scripts' folder. Here's what the folder structure should look like: $(NPP_DIRECTORY)\scripts\NppStartScript.txt where $(NPP_DIRECTORY) represents your Notepad++ application folder.
Locate the 'NppExec.ini' file. It should be in the '$(NPP_DIRECTORY)\plugins\config' folder. Open the file, add the following configuration setting at the bottom of the file (separated from the rest of the settings with a line break) and save the file:
[Options]
ScriptNppStart=$(NPP_DIRECTORY)\scripts\NppStartScript.txt
Create the 'NppStartScript.txt', type your command(s) and save the file. In your case it would be:
npe_cmdalias alias = Full command
"Full command" should be a npp_exec directive to a file which will contain the commands that you want to execute repeatedly. Here's what my run python command looks like:
npe_cmdalias rpy = npp_exec "$(NPP_DIRECTORY)\scripts\rpy.txt"
The "rpy.txt" contains the command to invoke the python interpreter on the file that is open in the current Notepad++ tab. Here's what I have written:
D:\Portable Apps\Python\python.exe "$(FULL_CURRENT_PATH)"
Restart Notepad++, open the NPPExec console and type your alias. It should run the command that you specified
Hope this helps, let me know if you encounter any errors.