Sublime Text 3,如何添加到右键单击?

Bow*_*wie 21 sublimetext3

如何添加Sublime Text就像使用Notepad ++编辑那样它没什么大不过的,但它可以节省时间.

在此输入图像描述

Luc*_*nte 48

  1. 使用记事本创建一个新的文本文档并将其保存在桌面上
  2. 将其重命名为OpenWithSublime.bat
  3. 把它放在里面:

@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
 
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3"         /t REG_SZ /v "" /d "Open with Sublime Text 3"   /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3"         /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
 
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3"         /t REG_SZ /v "" /d "Open with Sublime Text 3"   /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3"         /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
pause
Run Code Online (Sandbox Code Playgroud)

  1. 以管理员身份运行它

资料来源:https://gist.github.com/roundand/9367852


r-s*_*ein 18

只需创建一个reg文件subl.reg并使用文本编辑器打开它并添加内容:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Edit with Sublime Text]
@="Edit with &Sublime Text"
"Icon"="C:\\Program Files\\Sublime Text 3\\sublime_text.exe,0"
"MuiVerb"="Edit with Sublime Text"

[HKEY_CLASSES_ROOT\*\shell\Edit with Sublime Text\command]
@="C:\\Program Files\\Sublime Text 3\\sublime_text.exe \"%1\""

[HKEY_CLASSES_ROOT\Directory\Background\shell\Sublime]
@="Open with Sublime Text"
"Icon"="C:\\Program Files\\Sublime Text 3\\sublime_text.exe,0"

[HKEY_CLASSES_ROOT\Directory\Background\shell\Sublime\command]
@="\"C:\\Program Files\\Sublime Text 3\\sublime_text.exe\" \"%V\""

[HKEY_CLASSES_ROOT\Directory\shell\Sublime]
@="Open with Sublime Text"
"Icon"="C:\\Program Files\\Sublime Text 3\\sublime_text.exe,0"

[HKEY_CLASSES_ROOT\Directory\shell\Sublime\command]
@="\"C:\\Program Files\\Sublime Text 3\\sublime_text.exe\" \"%1\""
Run Code Online (Sandbox Code Playgroud)

您可能需要调整Sublime Text安装的路径.当您右键单击文件时,这将添加Sublime Text,右键单击文件夹背景,然后右键单击文件夹.只需双击该文件即可将条目添加到注册表中.

您始终可以通过按window+r,然后regedit在该面板中写入来编辑和删除这些条目.在那里,您将看到相同的路径结构,例如HKEY_CLASSES_ROOT\*\shell右键单击命令.

  • 美丽的。对于不知道如何处理 .reg 文件的人,只需在完成编辑后打开它。 (3认同)

And*_*ill 6

显然,您可以在安装sublime文本时单击"添加到资源管理器上下文菜单"复选框.如果这不起作用,这里有一个似乎深入探讨如何实现这一目标的线程:https://sublimetext.userecho.com/topics/3947-windows-context-menu-right-click-edit-with -sublime,记事本式/

  • 您可以将图标添加到上下文菜单:https://bungeshea.com/open-with-sublime-text-icon/ (3认同)

Don*_*Liu 5

感谢 r-stein 的上述回答。但[HKEY_CLASSES_ROOT\Directory\shell\Sublime\command]有一些问题。最后一个参数应该\"%V\""改为\"%1\"".

完整的subl.reg

Windows Registry Editor Version 5.00

; show in context menu when right click all kinds files
[HKEY_CLASSES_ROOT\*\shell\Sublime]
@="Open with Sublime Text 3"
"Icon"="C:\\Program Files\\Sublime Text 3\\sublime_text.exe,0"

[HKEY_CLASSES_ROOT\*\shell\Sublime\command]
@="\"C:\\Program Files\\Sublime Text 3\\sublime_text.exe\" \"%1\""

; show in context menu when right click empty area of explorer
[HKEY_CLASSES_ROOT\Directory\Background\shell\Sublime]
@="Open with Sublime Text 3"
"Icon"="C:\\Program Files\\Sublime Text 3\\sublime_text.exe,0"

[HKEY_CLASSES_ROOT\Directory\Background\shell\Sublime\command]
@="\"C:\\Program Files\\Sublime Text 3\\sublime_text.exe\" \"%V\""

; show in context menu when right click directory
[HKEY_CLASSES_ROOT\Directory\shell\Sublime]
@="Open with Sublime Text 3"
"Icon"="C:\\Program Files\\Sublime Text 3\\sublime_text.exe,0"

[HKEY_CLASSES_ROOT\Directory\shell\Sublime\command]
@="\"C:\\Program Files\\Sublime Text 3\\sublime_text.exe\" \"%V\""
Run Code Online (Sandbox Code Playgroud)