Geo*_*ell 34 windows-7 sublime-text-2
在 Windows 7 中,我可以在命令行执行此操作:
"c:\Program Files\Sublime Text 2\sublime_text.exe" samplefolder
Run Code Online (Sandbox Code Playgroud)
这将启动一个 Sublime Text 窗口,内容samplefolder加载在 Sublime 的侧边栏中。
虽然这可以根据需要工作,但每次都打开命令提示符很不方便。有什么办法可以将此行为添加到 Windows 资源管理器的右键单击菜单中吗?我希望能够右键单击一个文件夹并“使用 Sublime 打开”,就像我可以右键单击一个文件夹和“扫描病毒”一样。
Men*_*Gao 48
这是我用于 Vim 的 .reg 文件,但很清楚,只需将 Vim 相关字符串替换为 Sublime 即可。然后另存为.reg 文件,双击导入。
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\vim]
@="&Vim here"
[HKEY_CLASSES_ROOT\Directory\shell\vim\command]
@="\"C:\\Program Files (x86)\\Vim\\vim73\\gvim.exe\" \"%1\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\vim]
@="&Vim here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\vim\command]
@="\"C:\\Program Files (x86)\\Vim\\vim73\\gvim.exe\" \"%V\""
Run Code Online (Sandbox Code Playgroud)
有两个文件夹上下文菜单,一个是直接右键单击文件夹,这是前两行,另一个是在文件夹空白区域右键单击,这是最后两行。我不知道最后一个%V是什么意思,也没有发现任何相关的东西,它只是有效。
编辑:
对于 Windows 7 上 Sublime Text 2 的默认安装,这里是完整代码。另存为whatever.reg并双击。
Windows Registry Editor Version 5.00
; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\shell\sublime]
@="Open Folder as &Sublime Project"
"Icon"="\"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\",0"
[HKEY_CLASSES_ROOT\Directory\shell\sublime\command]
@="\"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\" \"%1\""
; This will make it appear when you right click INSIDE a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\Background\shell\sublime]
@="Open Folder as &Sublime Project"
"Icon"="\"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\",0"
[HKEY_CLASSES_ROOT\Directory\Background\shell\sublime\command]
@="\"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\" \"%V\""
Run Code Online (Sandbox Code Playgroud)